mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-01-13 21:28:01 +02:00
lavc/videotoolboxenc: Add realtime encoding property
Hint to the encoder that encoding should be done in real-time, even at the expense of quality. Signed-off-by: Rick Kern <kernrj@gmail.com>
This commit is contained in:
parent
272dd437bc
commit
ca429e7253
@ -76,6 +76,7 @@ typedef struct VTEncContext {
|
|||||||
int64_t profile;
|
int64_t profile;
|
||||||
int64_t level;
|
int64_t level;
|
||||||
int64_t entropy;
|
int64_t entropy;
|
||||||
|
int64_t realtime;
|
||||||
|
|
||||||
int64_t allow_sw;
|
int64_t allow_sw;
|
||||||
|
|
||||||
@ -747,6 +748,16 @@ static av_cold int vtenc_init(AVCodecContext *avctx)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (vtctx->realtime) {
|
||||||
|
status = VTSessionSetProperty(vtctx->session,
|
||||||
|
kVTCompressionPropertyKey_RealTime,
|
||||||
|
kCFBooleanTrue);
|
||||||
|
|
||||||
|
if (status) {
|
||||||
|
av_log(avctx, AV_LOG_ERROR, "Error setting realtime property: %d\n", status);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
status = VTCompressionSessionPrepareToEncodeFrames(vtctx->session);
|
status = VTCompressionSessionPrepareToEncodeFrames(vtctx->session);
|
||||||
if (status) {
|
if (status) {
|
||||||
av_log(avctx, AV_LOG_ERROR, "Error: cannot prepare encoder: %d\n", status);
|
av_log(avctx, AV_LOG_ERROR, "Error: cannot prepare encoder: %d\n", status);
|
||||||
@ -1520,6 +1531,9 @@ static const AVOption options[] = {
|
|||||||
{ "cabac", "CABAC entropy coding", 0, AV_OPT_TYPE_CONST, { .i64 = VT_CABAC }, INT_MIN, INT_MAX, VE, "coder" },
|
{ "cabac", "CABAC entropy coding", 0, AV_OPT_TYPE_CONST, { .i64 = VT_CABAC }, INT_MIN, INT_MAX, VE, "coder" },
|
||||||
{ "ac", "CABAC entropy coding", 0, AV_OPT_TYPE_CONST, { .i64 = VT_CABAC }, INT_MIN, INT_MAX, VE, "coder" },
|
{ "ac", "CABAC entropy coding", 0, AV_OPT_TYPE_CONST, { .i64 = VT_CABAC }, INT_MIN, INT_MAX, VE, "coder" },
|
||||||
|
|
||||||
|
{ "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 },
|
||||||
|
|
||||||
{ NULL },
|
{ NULL },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user