#7756(avcodec:new): add mastering display color volume and content light level information to hevc_metadata bitstream filter
#7756: add mastering display color volume and content light level information to hevc_metadata bitstream filter ---------------------------------+--------------------------------------- Reporter: sneaker | Type: enhancement Status: new | Priority: wish Component: avcodec | Version: git-master Keywords: hevc | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | ---------------------------------+--------------------------------------- It's currently already possible to use the "[https://ffmpeg.org/ffmpeg- bitstream-filters.html#hevc_005fmetadata hevc_metadata" bitstream filter] (-bsf:v hevc_metadata) to add or change colour_primaries, transfer_characteristics and matrix_coefficients of a given HEVC bitstream losslessly. The only things missing to allow ffmpeg to properly set HDR metadata on existing HEVC streams would be to set SMPTE ST 2086 Mastering display color volume SEI and Content light level information SEI message (MaxCLL and MaxFALL). This is useful because not all encoders currently allow setting those as well as in the case you forgot setting them during encode time. -- Ticket URL: <https://trac.ffmpeg.org/ticket/7756> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#7756: add mastering display color volume and content light level information to hevc_metadata bitstream filter -------------------------------------+----------------------------------- Reporter: sneaker | Owner: Type: enhancement | Status: new Priority: wish | Component: avcodec Version: git-master | Resolution: Keywords: hevc | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | -------------------------------------+----------------------------------- Comment (by klobliu): Maybe patch below can meet your command. https://patchwork.ffmpeg.org/project/ffmpeg/patch/20201229035649.5612-1-klob... ffmpeg command: ffmpeg -i HDR_X265_master2.mp4 -vcodec hevc_nvenc -bsf:v hevc_metadata=transfer_characteristics=16:colour_primaries=9:video_full_range_flag=0:matrix_coefficients=9:max_cll="1000|1000":master_display="G(13250|34500)B(7500|3000)R(34000|16000)WP(15635|16450)L(10000000|100)" with_sei_video_265.mp4 -y -- Ticket URL: <https://trac.ffmpeg.org/ticket/7756#comment:1> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
#7756: add mastering display color volume and content light level information to hevc_metadata bitstream filter -------------------------------------+----------------------------------- Reporter: sneaker | Owner: (none) Type: enhancement | Status: new Priority: wish | Component: avcodec Version: git-master | Resolution: Keywords: hevc | Blocked By: Blocking: | Reproduced by developer: 0 Analyzed by developer: 0 | -------------------------------------+----------------------------------- Comment (by Miklos Juhasz): I've created a patch to add support for Maximum Content Light Level (MaxCLL) and Maximum Frame-Average Light Level (MaxFALL) metadata to the hevc_metadata bitstream filter. This will allow users to insert or modify this HDR metadata in HEVC streams. Here's a link to the patch: [[https://gist.github.com/mjuhasz/e1f01937c44108dc442f3a4ea2d9b2a5|add- hdr-sei.patch]] The attached patch adds master_display and max_cll options to the hevc_metadata bitstream filter to handle Mastering Display Colour Volume and Content Light Level Information SEI messages respectively. It ensures the filter is idempotent by replacing any existing SEI messages of the same type. The syntax is the same as that for x265, see [[https://x265.readthedocs.io/en/master/cli.html#cmdoption-master- display|documentation]] {{{ ffmpeg -i input.hevc -c copy -bsf:v "hevc_metadata=max_cll='1000,400':master_display='G(13250,34500)B(7500,3000)R(34000,16000)WP(15635,16450)L(10000000,1)’" output.hevc }}} According to the HEVC specification (ITU-T H.265), MaxCLL and MaxFALL information is contained within Supplemental Enhancement Information (SEI) messages. These SEI messages with static metadata, such as mastering display and content light level information, are often repeated within the bitstream to ensure that a decoder can begin playback from any random access point. Industry best practice is to repeat this information at every Intra Random Access Point (IRAP) frame. My implementation reflects this understanding of the HEVC specification in the following ways: • The filter first removes any pre-existing MaxCLL and MaxFALL SEI messages to avoid conflicts. • If the removal of an SEI message results in an empty NAL unit, that empty NAL unit is also removed to prevent bitstream corruption. • The new MaxCLL and MaxFALL information is then inserted as a new SEI message only at access units containing IRAP frames or parameter sets. This ensures that the static metadata is available at every random access point without unnecessarily bloating the stream by repeating it in every access unit. I tested this patch extensively and it works as expected. I also submitted it to the FFmpeg developer mailing list in the hope that a developer will review it and that it can eventually be merged into the main FFmpeg project. -- Ticket URL: <https://trac.ffmpeg.org/ticket/7756#comment:2> FFmpeg <https://ffmpeg.org> FFmpeg issue tracker
participants (1)
-
FFmpeg