From: BatuhanOzer <[email protected]> Adds the usage_type parameter to the AVOption table to allow setting SCREEN_CONTENT_REAL_TIME. This allows the encoder to optimize for screen capture content, significantly improving efficiency.
Signed-off-by: BatuhanOzer <[email protected]> --- libavcodec/libopenh264enc.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/libavcodec/libopenh264enc.c b/libavcodec/libopenh264enc.c index 6f6f264636..c9a42d0bcc 100644 --- a/libavcodec/libopenh264enc.c +++ b/libavcodec/libopenh264enc.c @@ -54,6 +54,9 @@ typedef struct SVCContext { // rate control mode int rc_mode; + + // Expose the libopenh264 usage type + int usage_type; } SVCContext; #define OFFSET(x) offsetof(SVCContext, x) @@ -84,6 +87,9 @@ static const AVOption options[] = { #if OPENH264_VER_AT_LEAST(1, 4) { "timestamp", "bit rate control based on timestamp", 0, AV_OPT_TYPE_CONST, { .i64 = RC_TIMESTAMP_MODE }, 0, 0, VE, .unit = "rc_mode" }, #endif + { "usage_type", "Set libopenh264 usage type for encoder tuning", OFFSET(usage_type), AV_OPT_TYPE_INT, { .i64 = CAMERA_VIDEO_REAL_TIME }, CAMERA_VIDEO_REAL_TIME, SCREEN_CONTENT_REAL_TIME, VE, .unit = "usage_type" }, + { "camera", "real-time camera video encoding", 0, AV_OPT_TYPE_CONST, { .i64 = CAMERA_VIDEO_REAL_TIME }, 0, 0, VE, .unit = "usage_type" }, + { "screen", "real-time screen content encoding", 0, AV_OPT_TYPE_CONST, { .i64 = SCREEN_CONTENT_REAL_TIME }, 0, 0, VE, .unit = "usage_type" }, { NULL } }; @@ -132,6 +138,8 @@ static av_cold int svc_encode_init(AVCodecContext *avctx) (*s->encoder)->GetDefaultParams(s->encoder, ¶m); + param.iUsageType = s->usage_type; + if (avctx->framerate.num > 0 && avctx->framerate.den > 0) { param.fMaxFrameRate = av_q2d(avctx->framerate); } else { -- 2.51.0.windows.1 _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
