Log in

View Full Version : Pass hdr10 master-display metadata to x265


zweifingerjoe
3rd March 2021, 20:15
AFAIK --master-display and --max-cll are the only HDR10 metadata options that can be different for different hdr10 sources. If you want to reencode such sources with x265 or ffmpeg using x265, you'll need to pass that metadata from the source to the encoder.
While max-cll is easily obtainable by querying the source with mediainfo, the string needed for the master-display option is not.
As I became too lazy to extract and convert that string manually everytime, I made a little tool that generates a master-display string to be used with x265's --master-display parameter directly. It supports manual input in cd/mē and information extraction via ffmpeg from the source file (which must have an hevc video stream).

Let's assume you just made a backup of a 4K blu-ray with makemkv. If you want to obtain the master-display string for x265 you just have to use this simple command:

convertmdinfo -i /path/to/my/movie.mkv

You can get the source on github via the link below and build it with gcc and probably other C compilers. You'll need the ffmpeg libs and headers though.

https://github.com/jwdev42/convertmdinfo