VP9でエンコードしたときにつけるHDRメタデータをmkvmergeでつける。指定する値は元の映像と同じ値を指定する。libx265は-x265-paramsから直接指定できる。
- VP9(libvpx-vp9)のエンコード設定について
- Command Line Options — x265 documentation
- MKVToolNix Downloads – Matroska tools for Linux/Unix and Windows
- mkvmerge — Merge multimedia streams into a Matroska file
オプションは--foo 0:bar
形式で、最初の数字は何番目の映像ストリームかの指定。
オプション名 | 入力値 | mediainfo | 備考 |
colour-range | 1 | Limited | リミテッドレンジ |
colour-primaries | 9 | BT.2020 | 色域 |
colour-transfer-characteristics | 16:PQ, 18:HLG | PQ or HLG | 伝達関数 |
colour-matrix | 9 | BT.2020 non-constant | マトリックス |
chromaticity-coordinates | 任意 | Mastering display color primaries | |
white-colour-coordinates | 任意 | Mastering display color primaries | ホワイトポイント |
min-luminance | 0 ~ 1000 | Mastering display luminance | |
max-luminance | 0 ~ 1000 | Mastering display luminance | |
max-content-light | 0 ~ 1000 | Maximum Content Light Level | MaxCLL |
max-frame-light | 0 ~ 1000 | Maximum Frame-Average Light Level | MaxFALL |
HDR10のPQのとき。
mkvmerge -o output.mkv --colour-range 0:1 --colour-primaries 0:9 --colour-transfer-characteristics 0:16 --colour-matrix 0:9 --chromaticity-coordinates 0:0.680,0.320,0.265,0.690,0.150,0.060 --white-colour-coordinates 0:0.3127,0.3290 --min-luminance 0:0.0001 --max-luminance 0:1000 --max-content-light 0:1000 --max-frame-light 0:600 input.webm
HLGのときは--colour-transfer-characteristics 0:18
に変更する。
ホワイトポイントの指定。
- P3D65 (Display)
--white-colour-coordinates 0:0.3127,0.3290
- P3-DCI (Theater)
--white-colour-coordinates 0:0.314,0.351
- P3-D60 (ACES Cinema)
--white-colour-coordinates 0:0.32168,0.33767
mediainfoではなくffmpegからHDRメタデータの値を調べるには、ffprobeからside_dataを取得する。数値は少数ではなくmkvmergeが読めない分数なので適宜変換する。
ffprobe "input" -show_streams -select_streams v:0 -read_intervals "%+#10" -show_frames -show_entries side_data -v quiet -pretty -print_format json -of json > output.json