aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Rothenpieler <timo@rothenpieler.org>2021-06-06 21:53:53 +0200
committerTimo Rothenpieler <timo@rothenpieler.org>2021-06-06 22:01:56 +0200
commit8bcce5673a267ed371140bf3228ffb420ca2f69b (patch)
treebdac80e70cf398409f2661c70c120a3994bf6a79
parentc67f354be8610eefb9a2b195f6dc4d6da637b687 (diff)
downloadffmpeg-8bcce5673a267ed371140bf3228ffb420ca2f69b.tar.gz
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>
-rw-r--r--libavcodec/nvenc.c10
-rw-r--r--libavcodec/nvenc.h1
-rw-r--r--libavcodec/nvenc_h264.c2
-rw-r--r--libavcodec/nvenc_hevc.c4
-rw-r--r--libavcodec/version.h2
5 files changed, 13 insertions, 6 deletions
diff --git a/libavcodec/nvenc.c b/libavcodec/nvenc.c
index a2513c8a8b..ee046b9cef 100644
--- a/libavcodec/nvenc.c
+++ b/libavcodec/nvenc.c
@@ -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 {
diff --git a/libavcodec/nvenc.h b/libavcodec/nvenc.h
index ccf484fe38..85d3a33601 100644
--- a/libavcodec/nvenc.h
+++ b/libavcodec/nvenc.h
@@ -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);
diff --git a/libavcodec/nvenc_h264.c b/libavcodec/nvenc_h264.c
index 5ad6b35836..c7af7fa682 100644
--- a/libavcodec/nvenc_h264.c
+++ b/libavcodec/nvenc_h264.c
@@ -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 }
};
diff --git a/libavcodec/nvenc_hevc.c b/libavcodec/nvenc_hevc.c
index 2c8b2197cf..c85a317518 100644
--- a/libavcodec/nvenc_hevc.c
+++ b/libavcodec/nvenc_hevc.c
@@ -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 }
};
diff --git a/libavcodec/version.h b/libavcodec/version.h
index 48165b9ac4..5b1e9e77f3 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -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, \