[FFmpeg-devel] [PATCH 2/4] avcodec/nvenc: Fix b-frame parameter handling
timo at rothenpieler.org
timo at rothenpieler.org
Thu Dec 25 14:55:32 CET 2014
From: Timo Rothenpieler <timo at rothenpieler.org>
---
libavcodec/nvenc.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index 345fb78..6a37ea6 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -155,7 +155,6 @@ typedef struct NvencContext
char *preset;
int cbr;
int twopass;
- int gobpattern;
int gpu;
} NvencContext;
@@ -582,6 +581,12 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx)
memcpy(&ctx->encode_config, &preset_config.presetCfg, sizeof(ctx->encode_config));
ctx->encode_config.version = NV_ENC_CONFIG_VER;
+ if (avctx->max_b_frames < -1)
+ avctx->max_b_frames = -1;
+
+ /* 0 is intra-only, 1 is I/P only, 2 is one B Frame, 3 two B frames, and so on. */
+ ctx->encode_config.frameIntervalP = avctx->max_b_frames + 1;
+
if (avctx->gop_size >= 0) {
ctx->encode_config.gopLength = avctx->gop_size;
ctx->encode_config.encodeCodecConfig.h264Config.idrPeriod = avctx->gop_size;
@@ -656,10 +661,6 @@ static av_cold int nvenc_encode_init(AVCodecContext *avctx)
break;
}
- if (ctx->gobpattern >= 0) {
- ctx->encode_config.frameIntervalP = 1;
- }
-
ctx->encode_config.encodeCodecConfig.h264Config.h264VUIParameters.colourDescriptionPresentFlag = 1;
ctx->encode_config.encodeCodecConfig.h264Config.h264VUIParameters.videoSignalTypePresentFlag = 1;
@@ -1132,7 +1133,6 @@ static const AVOption options[] = {
{ "preset", "Set the encoding preset (one of hq, hp, bd, ll, llhq, llhp, default)", OFFSET(preset), AV_OPT_TYPE_STRING, { .str = "hq" }, 0, 0, VE },
{ "cbr", "Use cbr encoding mode", OFFSET(cbr), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
{ "2pass", "Use 2pass cbr encoding mode (low latency mode only)", OFFSET(twopass), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE },
- { "goppattern", "Specifies the GOP pattern as follows: 0: I, 1: IPP, 2: IBP, 3: IBBP", OFFSET(gobpattern), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 3, VE },
{ "gpu", "Selects which NVENC capable GPU to use. First GPU is 0, second is 1, and so on.", OFFSET(gpu), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
{ NULL }
};
--
2.2.1
More information about the ffmpeg-devel
mailing list