@@ -285,6 +285,23 @@ level_idc value (for example, @samp{42}), or the special name @samp{auto}
indicating that the filter should attempt to guess the level from the
input stream properties.
+@item mastering_display
+@item content_light_level
+Manipulate mastering display colour volume (see H.264 section D.2.29)
+and content light level info (see H.264 section D.2.31) SEI messages in
+the stream.
+
+Possible actions:
+@table @samp
+@item insert
+Insert this type of message, taking the values from packet side-data.
+@item remove
+Remove all instances of this message.
+@item extract
+Extract the content of this type of message, attaching it to the packets
+as side-data.
+@end table
+
@end table
@section h264_mp4toannexb
@@ -78,6 +78,9 @@ typedef struct H264MetadataContext {
int flip;
int level;
+
+ int mastering_display;
+ int content_light_level;
} H264MetadataContext;
@@ -449,6 +452,20 @@ static int h264_metadata_update_fragment(AVBSFContext *bsf, AVPacket *pkt,
return err;
}
+ if (pkt) {
+ err = ff_cbs_bsf_apply_metadata(bsf, pkt, au,
+ CBS_METADATA_MASTERING_DISPLAY,
+ ctx->mastering_display);
+ if (err < 0)
+ return err;
+
+ err = ff_cbs_bsf_apply_metadata(bsf, pkt, au,
+ CBS_METADATA_CONTENT_LIGHT_LEVEL,
+ ctx->content_light_level);
+ if (err < 0)
+ return err;
+ }
+
if (pkt)
ctx->done_first_au = 1;
@@ -609,6 +626,14 @@ static const AVOption h264_metadata_options[] = {
{ LEVEL("6.2", 62) },
#undef LEVEL
+ BSF_ELEMENT_OPTIONS_PIRE("mastering_display",
+ "Mastering display colour volume SEI",
+ mastering_display, FLAGS),
+
+ BSF_ELEMENT_OPTIONS_PIRE("content_light_level",
+ "Content light level information SEI",
+ content_light_level, FLAGS),
+
{ NULL }
};