Verify HDR10 Metadata after FFmpeg FFV1 Transcode
Transcoding HDR10 video to the lossless FFV1 codec is a common archiving practice, but ensuring that critical high-dynamic-range (HDR) metadata is preserved during the process is crucial. This article provides a step-by-step guide on how to verify that HDR10 metadata—specifically mastering display color volume and content light level data—remains intact after an FFmpeg FFV1 transcode using tools like MediaInfo and FFmpeg’s ffprobe.
Step 1: Identify the HDR10 Metadata in the Source File
Before transcoding, you must know what metadata exists in the source file. HDR10 relies on three main components: * Color Metadata: Color primaries (BT.2020), Transfer characteristics (SMPTE ST 2084 / PQ), and Matrix coefficients (BT.2020 non-constant). * Mastering Display Color Volume (SMPTE ST 2086): Red, Green, Blue coordinates, white point, and luminance range. * Content Light Level Information: MaxCLL (Maximum Content Light Level) and MaxFALL (Maximum Frame-Average Light Level).
Step 2: Perform the FFV1 Transcode
To preserve HDR10 metadata, you must use a container that supports
it, such as Matroska (.mkv). Ensure you are using a modern
version of FFmpeg, which automatically copies side data (like HDR10
metadata) by default.
Run your transcode command:
ffmpeg -i input_hdr10.mp4 -c:v ffv1 -level 3 -coder 1 -context 1 -g 1 -slices 24 -c:a copy output.mkvStep 3: Verify Metadata using FFprobe
The most reliable way to check if the metadata survived the transcode
is to inspect the side data of the video frames using
ffprobe. Because HDR10 metadata is stored as frame side
data, you need to probe the first frame of the output file.
Run the following command:
ffprobe -i output.mkv -select_streams v:0 -show_frames -read_intervals "%+#1" -show_entries frame=side_data_list -v quiet -of jsonWhat to look for in the JSON output
In the output, search for "side_data_list". You should
see two distinct blocks of data:
Mastering Display Metadata (
side_data_type: Mastering display metadata):{ "side_data_type": "Mastering display metadata", "red_x": "34000/50000", "red_y": "16000/50000", "green_x": "13250/50000", ... "min_luminance": "50/100000", "max_luminance": "10000000/10000" }Content Light Level (
side_data_type: Content light level metadata):{ "side_data_type": "Content light level metadata", "max_content": 1000, "max_average": 400 }
If both blocks are present and match the values of your source file, the metadata has been successfully preserved.
Step 4: Verify Metadata using MediaInfo
As an alternative or double-check, you can use the command-line tool
MediaInfo. It reads the container header level
metadata.
Run this command:
mediainfo output.mkvLook at the Video section of the text output. You should see the following lines: * Color primaries: BT.2020 * Transfer characteristics: PQ (or SMPTE ST 2084) * Matrix coefficients: BT.2020 non-constant * Mastering display color primaries: R: x=0.680000 y=0.320000, G: x=0.265000 y=0.690000… * Mastering display luminance: min: 0.0050 cd/m2, max: 1000 cd/m2 * Maximum Content Light Level (MaxCLL): 1000 cd/m2 * Maximum Frame-Average Light Level (MaxFALL): 400 cd/m2
If MediaInfo displays these parameters, your FFV1 file is properly tagged for HDR10 playback and archiving.