diff --git a/doc/bitstream_filters.texi b/doc/bitstream_filters.texi index 60e729484d..e3c56f1887 100644 --- a/doc/bitstream_filters.texi +++ b/doc/bitstream_filters.texi @@ -253,6 +253,11 @@ Set whether the stream has fixed framerate - typically this indicates that the framerate is exactly half the tick rate, but the exact meaning is dependent on interlacing and the picture structure (see H.264 section E.2.1 and table E-6). +@item zero_new_constraint_set_flags +Zero constraint_set4_flag and constraint_set5_flag in the SPS. These +bits were reserved in a previous version of the H.264 spec, and thus +some hardware decoders require these to be zero. The result of zeroing +this is still a valid bitstream. @item crop_left @item crop_right diff --git a/libavcodec/h264_metadata_bsf.c b/libavcodec/h264_metadata_bsf.c index ef74cba560..452a8ec5dc 100644 --- a/libavcodec/h264_metadata_bsf.c +++ b/libavcodec/h264_metadata_bsf.c @@ -61,6 +61,7 @@ typedef struct H264MetadataContext { AVRational tick_rate; int fixed_frame_rate_flag; + int zero_new_constraint_set_flags; int crop_left; int crop_right; @@ -228,6 +229,10 @@ static int h264_metadata_update_sps(AVBSFContext *bsf, need_vui = 1; } SET_VUI_FIELD(fixed_frame_rate_flag); + if (ctx->zero_new_constraint_set_flags) { + sps->constraint_set4_flag = 0; + sps->constraint_set5_flag = 0; + } if (sps->separate_colour_plane_flag || sps->chroma_format_idc == 0) { crop_unit_x = 1; @@ -618,6 +623,9 @@ static const AVOption h264_metadata_options[] = { { "fixed_frame_rate_flag", "Set VUI fixed frame rate flag", OFFSET(fixed_frame_rate_flag), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, FLAGS }, + { "zero_new_constraint_set_flags", "Set constraint_set4_flag / constraint_set5_flag to zero", + OFFSET(zero_new_constraint_set_flags), AV_OPT_TYPE_BOOL, + { .i64 = 0 }, 0, 1, FLAGS }, { "crop_left", "Set left border crop offset", OFFSET(crop_left), AV_OPT_TYPE_INT, diff --git a/libavcodec/version.h b/libavcodec/version.h index 1288cecebe..2a420a7e28 100644 --- a/libavcodec/version.h +++ b/libavcodec/version.h @@ -28,7 +28,7 @@ #include "libavutil/version.h" #define LIBAVCODEC_VERSION_MAJOR 59 -#define LIBAVCODEC_VERSION_MINOR 2 +#define LIBAVCODEC_VERSION_MINOR 3 #define LIBAVCODEC_VERSION_MICRO 100 #define LIBAVCODEC_VERSION_INT AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \