1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00

avcodec/nvenc: add option to disable all extra SEI data

With these triggering a lot of crashes recently, an option to globally
disable all of them is added as a tool to work around those crashes in
case the SEI data is not needed by the user.

Also re-enables s12m for hevc_nvenc, since the issue is not specifically
with that, but it affects all SEI data.

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
This commit is contained in:
Timo Rothenpieler 2021-06-06 21:53:53 +02:00
parent c67f354be8
commit 8bcce5673a
5 changed files with 13 additions and 6 deletions

View File

@ -2325,10 +2325,12 @@ static int nvenc_send_frame(AVCodecContext *avctx, const AVFrame *frame)
pic_params.inputTimeStamp = frame->pts;
res = prepare_sei_data_array(avctx, frame);
if (res < 0)
return res;
sei_count = res;
if (ctx->extra_sei) {
res = prepare_sei_data_array(avctx, frame);
if (res < 0)
return res;
sei_count = res;
}
nvenc_codec_specific_pic_params(avctx, &pic_params, ctx->sei_data, sei_count);
} else {

View File

@ -222,6 +222,7 @@ typedef struct NvencContext
int tuning_info;
int multipass;
int ldkfs;
int extra_sei;
} NvencContext;
int ff_nvenc_encode_init(AVCodecContext *avctx);

View File

@ -182,6 +182,8 @@ static const AVOption options[] = {
{ "ldkfs", "Low delay key frame scale; Specifies the Scene Change frame size increase allowed in case of single frame VBV and CBR",
OFFSET(ldkfs), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, UCHAR_MAX, VE },
#endif
{ "extra_sei", "Pass on extra SEI data (e.g. a53 cc) to be included in the bitstream",
OFFSET(extra_sei), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE },
{ NULL }
};

View File

@ -148,7 +148,7 @@ static const AVOption options[] = {
{ "middle", "", 0, AV_OPT_TYPE_CONST, { .i64 = 2 }, 0, 0, VE, "b_ref_mode" },
#endif
{ "a53cc", "Use A53 Closed Captions (if available)", OFFSET(a53_cc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE },
{ "s12m_tc", "Use timecode (if available)", OFFSET(s12m_tc), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, VE },
{ "s12m_tc", "Use timecode (if available)", OFFSET(s12m_tc), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE },
{ "dpb_size", "Specifies the DPB size used for encoding (0 means automatic)",
OFFSET(dpb_size), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, VE },
#ifdef NVENC_HAVE_MULTIPASS
@ -163,6 +163,8 @@ static const AVOption options[] = {
{ "ldkfs", "Low delay key frame scale; Specifies the Scene Change frame size increase allowed in case of single frame VBV and CBR",
OFFSET(ldkfs), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, UCHAR_MAX, VE },
#endif
{ "extra_sei", "Pass on extra SEI data (e.g. a53 cc) to be included in the bitstream",
OFFSET(extra_sei), AV_OPT_TYPE_BOOL, { .i64 = 1 }, 0, 1, VE },
{ NULL }
};

View File

@ -29,7 +29,7 @@
#define LIBAVCODEC_VERSION_MAJOR 59
#define LIBAVCODEC_VERSION_MINOR 1
#define LIBAVCODEC_VERSION_MICRO 100
#define LIBAVCODEC_VERSION_MICRO 101
#define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
LIBAVCODEC_VERSION_MINOR, \