diff options
author | Zhao Zhili <quinkblack@foxmail.com> | 2021-04-25 16:06:04 +0800 |
---|---|---|
committer | Rick Kern <kernrj@gmail.com> | 2021-05-06 00:11:56 -0400 |
commit | 71ad83667d32f64c658034baa3cc56246ae67363 (patch) | |
tree | 9a02ea4a8ac3d28a5a8eb6f683c9cd87e84ca445 /libavcodec | |
parent | 41ef57fdb27c9583e61af8eea1ba710314cd86e5 (diff) | |
download | ffmpeg-71ad83667d32f64c658034baa3cc56246ae67363.tar.gz |
lavc/videotoolboxenc: set DataRateLimits for hevc
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>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/videotoolboxenc.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c index e576ff7d7e..e4f890f7f7 100644 --- a/libavcodec/videotoolboxenc.c +++ b/libavcodec/videotoolboxenc.c @@ -1113,8 +1113,8 @@ static int vtenc_create_encoder(AVCodecContext *avctx, return AVERROR_EXTERNAL; } - if (vtctx->codec_id == AV_CODEC_ID_H264 && max_rate > 0) { - // kVTCompressionPropertyKey_DataRateLimits is not available for HEVC + if ((vtctx->codec_id == AV_CODEC_ID_H264 || vtctx->codec_id == AV_CODEC_ID_HEVC) + && max_rate > 0) { bytes_per_second_value = max_rate >> 3; bytes_per_second = CFNumberCreate(kCFAllocatorDefault, kCFNumberSInt64Type, @@ -1152,7 +1152,11 @@ static int vtenc_create_encoder(AVCodecContext *avctx, if (status) { av_log(avctx, AV_LOG_ERROR, "Error setting max bitrate property: %d\n", status); - return AVERROR_EXTERNAL; + // kVTCompressionPropertyKey_DataRateLimits is available for HEVC + // now but not on old release. There is no document about since + // when. So ignore the error if it failed for hevc. + if (vtctx->codec_id != AV_CODEC_ID_HEVC) + return AVERROR_EXTERNAL; } } |