@@ -2415,6 +2415,20 @@ during configuration. You need to explicitly configure the build with
@subsection Options
@table @option
+@item b
+Sets target video bitrate.
+
+@item bf
+
+@item g
+Set the GOP size.
+
+@item keyint_min
+Minimum GOP size.
+
+@item refs
+Number of reference frames each P-frame can use. The range is from @var{1-16}.
+
@item preset
Set the x265 preset.
@@ -241,6 +241,15 @@ static av_cold int libx265_encode_init(AVCodecContext *avctx)
if (!(avctx->flags & AV_CODEC_FLAG_GLOBAL_HEADER))
ctx->params->bRepeatHeaders = 1;
+ if (avctx->gop_size >= 0)
+ ctx->params->keyframeMax = avctx->gop_size;
+ if (avctx->keyint_min > 0)
+ ctx->params->keyframeMin = avctx->keyint_min;
+ if (avctx->max_b_frames >= 0)
+ ctx->params->bframes = avctx->max_b_frames;
+ if (avctx->refs >= 0)
+ ctx->params->maxNumReferences = avctx->refs;
+
if (ctx->x265_opts) {
AVDictionary *dict = NULL;
AVDictionaryEntry *en = NULL;
@@ -556,6 +565,10 @@ static const AVClass class = {
static const AVCodecDefault x265_defaults[] = {
{ "b", "0" },
+ { "bf", "-1" },
+ { "g", "-1" },
+ { "keyint_min", "-1" },
+ { "refs", "-1" },
{ NULL },
};
There's no reason to ignore them if set. Signed-off-by: James Almer <jamrial@gmail.com> --- doc/encoders.texi | 14 ++++++++++++++ libavcodec/libx265.c | 13 +++++++++++++ 2 files changed, 27 insertions(+)