[FFmpeg-devel] [PATCH 2/2] lavc/videotoolboxenc: explicitly set realtime=false
rcombs
rcombs at rcombs.me
Sat Dec 18 23:53:19 EET 2021
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.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/libavcodec/videotoolboxenc.c b/libavcodec/videotoolboxenc.c
index 5f1e3a9b9c..3599d730d8 100644
--- a/libavcodec/videotoolboxenc.c
+++ b/libavcodec/videotoolboxenc.c
@@ -1391,10 +1391,10 @@ static int vtenc_create_encoder(AVCodecContext *avctx,
}
}
- if (vtctx->realtime) {
+ if (vtctx->realtime >= 0) {
status = VTSessionSetProperty(vtctx->session,
compat_keys.kVTCompressionPropertyKey_RealTime,
- kCFBooleanTrue);
+ vtctx->realtime ? kCFBooleanTrue : kCFBooleanFalse);
if (status) {
av_log(avctx, AV_LOG_ERROR, "Error setting realtime property: %d\n", status);
@@ -2676,7 +2676,7 @@ static const enum AVPixelFormat prores_pix_fmts[] = {
{ "require_sw", "Require software encoding", OFFSET(require_sw), AV_OPT_TYPE_BOOL, \
{ .i64 = 0 }, 0, 1, VE }, \
{ "realtime", "Hint that encoding should happen in real-time if not faster (e.g. capturing from camera).", \
- OFFSET(realtime), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, \
+ OFFSET(realtime), AV_OPT_TYPE_BOOL, { .i64 = 0 }, -1, 1, VE }, \
{ "frames_before", "Other frames will come before the frames in this session. This helps smooth concatenation issues.", \
OFFSET(frames_before), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE }, \
{ "frames_after", "Other frames will come after the frames in this session. This helps smooth concatenation issues.", \
--
2.33.1
More information about the ffmpeg-devel
mailing list