There's no reason to ignore them if set.
Signed-off-by: James Almer <[email protected]>
---
doc/encoders.texi | 14 ++++++++++++++
libavcodec/libx265.c | 13 +++++++++++++
2 files changed, 27 insertions(+)
diff --git a/doc/encoders.texi b/doc/encoders.texi
index a207363650..673eaf6496 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -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.
diff --git a/libavcodec/libx265.c b/libavcodec/libx265.c
index 963c28fb1d..508fade98b 100644
--- a/libavcodec/libx265.c
+++ b/libavcodec/libx265.c
@@ -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 },
};
--
2.24.1
_______________________________________________
ffmpeg-devel mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".