summaryrefslogtreecommitdiff
path: root/libavcodec/videotoolboxenc.c
Commit message (Collapse)AuthorAge
* avcodec/defs: Add AV_PROFILE_* defines, deprecate FF_PROFILE_* definesAndreas Rheinhardt2023-09-07
| | | | | | | | | These defines are also used in other contexts than just AVCodecContext ones, e.g. in libavformat. Furthermore, given that these defines are public, the AV-prefix is the right one, so deprecate (and not just move) the FF-macros. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/videotoolboxenc: use color parameters conversion from avutilZhao Zhili2023-07-23
| | | | Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* lavc/videotoolboxenc: fix enabling low-latency encodexufuji4562023-07-02
| | | | | | | | | Use CFDictionarySetValue to enable low-latency encoding mode. Since the key is a type of "EncoderSpecification", instead of "CompressionProperty". Signed-off-by: xufuji456 <839789740@qq.com> Signed-off-by: Rick Kern <kernrj@gmail.com>
* avcodec/videotoolboxenc: inherit profile from AVCodecContextZhao Zhili2023-06-19
| | | | | | | This can happen when user set the avctx->profile field directly instead of specify profile via option. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avcodec/videotoolboxenc: remove AUTO_PROFILE defineZhao Zhili2023-06-19
| | | | | | Use FF_PROFILE_UNKNOWN as auto mode. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avcodec/videotoolboxenc: use int as the type of profileZhao Zhili2023-06-19
| | | | | | | | | | | Other than save a few bytes, it also has the benefit to show the AV_OPT_TYPE_CONST value in help, e.g., -profile <int> E..V....... Profile (from 0 to INT_MAX) (default 0) baseline 66 E..V....... Baseline Profile ... Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* lavc/videotoolboxenc: support additional optionsRick Kern2023-06-03
| | | | | | | | | | | Added support for more VideoToolbox encoder options: - qmin and qmax options are now used - max_slice_bytes: Max number of bytes per H.264 slice - max_ref_frames: Limit the number of reference frames - Disable open GOP when the cgop flag is set - power_efficient: Enable power-efficient mode Signed-off-by: Rick Kern <kernrj@gmail.com>
* avcodec/videotoolboxenc: add CBP/CHP profilexufuji4562023-06-03
| | | | | | | The CBP/CHP profile has available with H264 in iOS 15.0. Official Doc: https://developer.apple.com/documentation/videotoolbox/kvtprofilelevel_h264_constrainedbaseline_autolevel Signed-off-by: Rick Kern <kernrj@gmail.com>
* lavc/videotoolboxenc: use ffmpeg profile constantsRick Kern2023-06-03
| | | | Signed-off-by: Rick Kern <kernrj@gmail.com>
* lavc/videotoolboxenc: warn when alpha quality not setRick Kern2023-05-20
| | | | | | Added a warn log when alpha quality cannot be set, but continue encoding. Signed-off-by: Rick Kern <kernrj@gmail.com>
* lavc/videotoolboxenc: better compat_keys docsRick Kern2023-05-20
| | | | | | | Added more specific docs about when to use compat_keys, and how to add new constants. Signed-off-by: Rick Kern <kernrj@gmail.com>
* lavc/videotoolboxenc: better compat_keys documentationRick Kern2023-05-19
| | | | | | | Added documentation that describes when compat_keys should be used, and why it exists. Signed-off-by: Rick Kern <kernrj@gmail.com>
* avcodec/videotoolboxenc: add low-latency encodingxufuji4562023-05-19
| | | | | | | | When using low-latency mode, it eliminates frame reordering and follows a one-in-one-out encoding mode Signed-off-by: xufuji456 <839789740@qq.com> Signed-off-by: Rick Kern <kernrj@gmail.com>
* lavc/videotoolboxenc: fix warningsJun Zhao2023-04-09
| | | | | | | fix mixing declarations and code and function declaration without a prototype warnings Signed-off-by: Jun Zhao <barryjzhao@tencent.com>
* avcodec/videotoolboxenc: fix error codeZhao Zhili2023-01-11
| | | | | | | 1. Fix return 0 on error. 2. Fix return OS error code passthrough. Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avcodec/videotoolboxenc: pass error code throughZhao Zhili2023-01-11
| | | | Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* avcodec/videotoolboxenc: log when get_cv_pixel_format failedZhao Zhili2023-01-11
| | | | Signed-off-by: Zhao Zhili <zhilizhao@tencent.com>
* lavc/videotoolboxenc: fix warningsRick Kern2022-12-03
| | | | | | This handles an unhandled error, and removes an unnecessary variable. Signed-off-by: Rick Kern <kernrj@gmail.com>
* lavc/videotoolboxenc: Fix crash by uninitialized valueThilo Borgmann2022-09-21
| | | | If create_cv_pixel_buffer() fails, pixel_buffer_info might get into CFRelease() containing an arbitrary value.
* avcodec/codec_internal: Add macro to set AVCodec.long_nameAndreas Rheinhardt2022-09-03
| | | | | | | | It reduces typing: Before this patch, there were 105 codecs whose long_name-definition exceeded the 80 char line length limit. Now there are only nine of them. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/videotoolboxenc: Add CBR option to H264 and HEVC encoderSebastian Beckmann2022-08-29
| | | | | | | | | Adds an option to use constant bitrate instead of average bitrate to the videotoolbox encoders. This is enabled via -constant_bit_rate true. macOS 13 is required for this option to work. Signed-off-by: Sebastian Beckmann <beckmann.sebastian@outlook.de> Signed-off-by: Rick Kern <kernrj@gmail.com>
* avcodec: Make init-threadsafety the defaultAndreas Rheinhardt2022-07-18
| | | | | | | | | | | and remove FF_CODEC_CAP_INIT_THREADSAFE All our native codecs are already init-threadsafe (only wrappers for external libraries and hwaccels are typically not marked as init-threadsafe yet), so it is only natural for this to also be the default state. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc/videotoolboxenc: Speed/Quality prioriry settingSimone Karin Lehmann2022-05-02
| | | | | | | | Add options to h264, hevc and prores encoders to prioritize speed. Speeds up encoding by 50% - 70% Signed-off-by: Simone Karin Lehmann <simone@lisanet.de> Signed-off-by: Rick Kern <kernrj@gmail.com>
* avcodec/codec_internal: Use union for FFCodec decode/encode callbacksAndreas Rheinhardt2022-04-05
| | | | | | | | | | | This is possible, because every given FFCodec has to implement exactly one of these. Doing so decreases sizeof(FFCodec) and therefore decreases the size of the binary. Notice that in case of position-independent code the decrease is in .data.rel.ro, so that this translates to decreased memory consumption. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/codec_internal: Add FFCodec, hide internal part of AVCodecAndreas Rheinhardt2022-03-21
| | | | | | | | | | | | | | | | Up until now, codec.h contains both public and private parts of AVCodec. This exposes the internals of AVCodec to users and leads them into the temptation of actually using them and forces us to forward-declare structures and types that users can't use at all. This commit changes this by adding a new structure FFCodec to codec_internal.h that extends AVCodec, i.e. contains the public AVCodec as first member; the private fields of AVCodec are moved to this structure, leaving codec.h clean. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avcodec/internal: Move FF_CODEC_CAP_* to a new header codec_internal.hAndreas Rheinhardt2022-03-21
| | | | | | | | | | Also move FF_CODEC_TAGS_END as well as struct AVCodecDefault. This reduces the amount of files that have to include internal.h (which comes with quite a lot of indirect inclusions), as e.g. most encoders don't need it. It is furthemore in preparation for moving the private part of AVCodec out of the public codec.h. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* lavc/videotoolboxenc: explicitly set realtime=falsercombs2021-12-22
| | | | | | On some encoders, this defaults to true, which can result in encode speed being _limited_ to only slightly above realtime (as a power-saving measure), so we need a way to disable it.
* libavcodec/videotoolboxenc: use the correct types for optionsrcombs2021-12-22
| | | | | These are all set by AV_OPT_TYPE_INT or AV_OPT_TYPE_BOOL; the only reason they worked before was that this is only used on little-endian.
* lavc/videotoolboxenc: add ProRes supportrcombs2021-12-22
|
* lavc/videotoolboxenc: add handling for non-NAL-based codecsrcombs2021-12-22
|
* lavc/videotoolboxenc: vastly simplify get_cv_pixel_inforcombs2021-12-22
| | | | | | No longer requires per-format switch cases. The frame==0 path was unused (and would've crashed anyway).
* lavc/videotoolboxenc: config-gate ATSC CC supportrcombs2021-12-22
|
* lavc/videotoolboxenc: fix RGB supportrcombs2021-12-22
|
* lavc/videotoolboxenc: detect alpha more genericallyrcombs2021-12-22
| | | | Fixes support for alpha in hardware input frames
* lavc/videotoolboxenc: don't access int64_t member as intrcombs2021-12-22
|
* lavc/videotoolboxenc: use common routine for pixfmt conversionrcombs2021-12-22
|
* avcodec/videotoolboxenc: fix pixel buffer memory leaksongyutong2021-11-09
| | | | | | | | In function vtenc_populate_extradata(), there is a manually created pixel buffer that has not been released. So we should use CVPixelBufferRelease to release this pixel buffer at the end, otherwise will cause a memory leak. Signed-off-by: Rick Kern <kernrj@gmail.com>
* avcodec/videotoolboxenc: use goto end for memory cleanupLimin Wang2021-10-13
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/videotoolboxenc: Fixes non-B-Frame encodingNoHalfBits2021-09-27
| | | | | | | | | | | | Sets vtctx->has_b_frames to 0 if the VideoToolbox compression session will not emit B-frames (and, in consequence, no valid DTSs). Required for the handling of invalid DTSs in 'vtenc_cm_to_avpacket' (line 2018ff) to work correctly and not abort encoding with "DTS is invalid." when no B-frames are generated. Signed-off-by: NoHalfBits <ffmpeg-devel@fluthaus.com> Signed-off-by: Rick Kern <kernrj@gmail.com>
* Fix for bug #9231: B-frames parameter is ignored in videotoolboxencAnselm Busse2021-08-13
| | | | | | | | | This commit fixes the bug as report in https://trac.ffmpeg.org/ticket/9231 by removing the line that overwrites the user settings for max_b_frames. Signed-off-by: Anselm Busse <anselm.busse@outlook.com> Signed-off-by: Rick Kern <kernrj@gmail.com>
* lavc/videotoolboxenc.c: Fix preprocessor macro for OSX 10.10.5 and probably ↵Thilo Borgmann2021-06-14
| | | | older versions
* avcodec/videotoolboxenc: #define TARGET_CPU_ARM64 to 0 if not provided by ↵Zane van Iperen2021-05-19
| | | | | | | | | | the SDK Fixes build failure on older SDKs without it. Fixes #9242 Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec/videotoolboxenc: Avoid copying data, allow user-supplied buffersAndreas Rheinhardt2021-05-06
| | | | | | | | | | | Here the packet size is known before allocating the packet because the encoder provides said information (and works with internal buffers itself), so one use this information to avoid the implicit use of another intermediate buffer for the packet data; and by switching to ff_get_encode_buffer() one can also allow user-supplied buffers. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: Rick Kern <kernrj@gmail.com>
* lavc/videotoolboxenc: set DataRateLimits for hevcZhao Zhili2021-05-06
| | | | | | | | From the comment it's not available on old version. It works now by testing on macOS 11.2.1. There is no document about since when. So trying to set the configuration and ignore the error for hevc. Signed-off-by: Rick Kern <kernrj@gmail.com>
* avcodec: Constify AVCodecsAndreas Rheinhardt2021-04-27
| | | | | | | | | | Given that the AVCodec.next pointer has now been removed, most of the AVCodecs are not modified at all any more and can therefore be made const (as this patch does); the only exceptions are the very few codecs for external libraries that have a init_static_data callback. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* lavc/videotoolboxenc: Add support for HEVC with Alpha.Hironori Bono2021-03-19
| | | | | | | | | | | | | | | This change supports the "HEVC Video with Alpha" profile introduced in WWDC 2019 <https://developer.apple.com/videos/play/wwdc2019/506/>. (This change is a partial fix for Ticket #7965.) For example, the following command converts an animation PNG file to an HEVC with Alpha video: ./ffmpeg -i fate-suite/apng/clock.png -c:v hevc_videotoolbox -allow_sw 1 -alpha_quality 0.75 -vtag hvc1 clock.mov (This change uses the "HEVC Video with Alpha" profile only when the '-alpha_quality' value is not 0 for backward compatibility.) Signed-off-by: Hironori Bono <bouno@rouge.plala.or.jp>
* videotoolboxenc: enable constant quality with -q:v on Apple Silicon Macs and ↵Simone Karin Lehmann2021-03-19
| | | | | | | use b-frames für HEVC and H264 and b-pyramid for HEVC. Signed-off-by: Simone Karin Lehmann <simone@lisanet.de> Signed-off-by: Rick Kern <kernrj@gmail.com>
* avcodec/videotoolboxenc: Fix SEI enum identifiersAndreas Rheinhardt2021-01-22
| | | | | | | Broken in 64b3aac8d07a8744656737619b70977359d9a6a5. Tested-by: Mark Himsley <mark.himsley@gmail.com> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* h264: Use common SEI typesMark Thompson2021-01-21
|
* libavcodec/videotoolboxenc: Fix crash when frame received after errorRick Kern2020-09-28
| | | | Signed-off-by: Rick Kern <kernrj@gmail.com>