Opened 2 years ago

Last modified 20 months ago

#5831 new enhancement

HDR Metadata in Encoding

Reported by: smallishzulu Owned by:
Priority: normal Component: undetermined
Version: unspecified Keywords: metadata, hdr
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Hi,

I try to dump HDR metadata (mastering display color primaries & luminance) of a HDR video using;

root@kizil105:/home/admintv# /opt/ffmpeg/bin/ffmpeg -i /tmp/exodus_hdr.mp4 -f ffmetadata -y metadata.txt
ffmpeg version N-81560-ge3fd185 Copyright (c) 2000-2016 the FFmpeg developers

built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
configuration: --prefix=/opt/ffmpeg --enable-shared --enable-static --enable-nonfree --enable-gpl --extra-cflags='-I/opt/ffmpeg/include -I/usr/local/include' --extra-ldflags=-L/opt/ffmpeg/lib --bindir=/opt/ffmpeg/bin --extra-libs=-ldl --enable-libx264 --enable-libx265 --enable-nonfree --enable-gpl --enable-nvenc --enable-vdpau --enable-libzvbi --enable-libfdk-aac --enable-libzimg --enable-avresample --enable-libzmq --enable-libfreetype
libavutil 55. 29.100 / 55. 29.100
libavcodec 57. 54.102 / 57. 54.102
libavformat 57. 48.102 / 57. 48.102
libavdevice 57. 0.102 / 57. 0.102
libavfilter 6. 60.100 / 6. 60.100
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100

[aac @ 0x1cb64c0] This stream seems to incorrectly report its last channel as LFE[3], mapping to LFE[0]
Input #0, mpegts, from '/tmp/exodus_hdr.mp4':

Duration: 00:00:02.13, start: 1.525000, bitrate: 44519 kb/s
Program 1

Metadata:

service_name : Service01
service_provider: FFmpeg

Stream #0:0[0x100]: Video: hevc (Main 10) ([36][0][0][0] / 0x0024), yuv420p10le(tv, bt2020nc/bt2020/smpte2084), 3840x2160 [SAR 1:1 DAR 16:9], 23.98 fps, 24 tbr, 90k tbn, 23.98 tbc
Stream #0:1[0x101](und): Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, 5.1, fltp, 400 kb/s

Output #0, ffmetadata, to 'metadata.txt':

Metadata:

encoder : Lavf57.48.102

Stream mapping:
Press [q] to stop, ? for help
size= 0kB time=-577014:32:22.77 bitrate=N/A speed=N/A
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Output file is empty, nothing was encoded

However; I am not able to get HDR related metadata:

root@kizil105:/home/admintv# cat metadata.txt
;FFMETADATA1
encoder=Lavf57.48.102

Mediainfo output for exodus_hdr.mp4:

General
ID : 1 (0x1)
Complete name : C:\Users\Ali KIZIL\Desktop\exodus_hdr.mp4
Format : MPEG-TS
File size : 11.3 MiB
Duration : 2 s 83 ms
Overall bit rate mode : Variable
Overall bit rate : 45.4 Mb/s

Video
ID : 256 (0x100)
Menu ID : 1 (0x1)
Format : HEVC
Format/Info? : High Efficiency Video Coding
Format profile : Main 10@L5.1@High
Codec ID : 36
Duration : 2 s 83 ms
Width : 3 840 pixels
Height : 2 160 pixels
Display aspect ratio : 16:9
Frame rate : 23.976 (24000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0 (Type 2)
Bit depth : 10 bits
Writing library : ATEME Titan KFE 3.7.0 (4.7.0.2002)
Color range : Limited
Color primaries : BT.2020
Transfer characteristics : 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, B: x=0.150000 y=0.060000, White point: x=0.312700 y=0.329000
Mastering display luminance : min: 0.0200 cd/m2, max: 1200.0000 cd/m2

Audio
ID : 257 (0x101)
Menu ID : 1 (0x1)
Format : AAC
Format/Info? : Advanced Audio Codec
Format version : Version 4
Format profile : LC
Muxing mode : ADTS
Codec ID : 15
Duration : 1 s 877 ms
Bit rate mode : Variable
Channel(s) : 6 channels
Channel positions : Front: L C R, Side: L R, LFE
Sampling rate : 48.0 kHz
Frame rate : 46.875 FPS (1024 spf)
Compression mode : Lossy

Menu
ID : 4096 (0x1000)
Menu ID : 1 (0x1)
List : 256 (0x100) (HEVC) / 257 (0x101) (AAC)
Service name : Service01
Service provider : FFmpeg
Service type : digital television

HRD Metadata part is:

Mastering display color primaries : R: x=0.680000 y=0.320000, G: x=0.265000 y=0.690000, B: x=0.150000 y=0.060000, White point: x=0.312700 y=0.329000
Mastering display luminance : min: 0.0200 cd/m2, max: 1200.0000 cd/m2

It would be nice to import this metadata info back to encode such like;

/opt/ffmpeg/bin/ffmpeg -loglevel verbose-re -i /media/usb0/4k_sampels/Exodus_UHD_HDR_Exodus_draft.mp4 -i metadata.txt -map_metadata 1 -c:v:0 nvenc_hevc -preset llhq -profile:v:0 main10 -vb 8000k -c:a:0 mp2 -b:a:0 384k -f mpegts -color_range 1 -color_trc smpte2084 -color_primaries bt2020 -colorspace 9 -y /tmp/out.ts

for HDR transcoding.

Additional note:

Below command also does not add metadat to transcoding:

/opt/ffmpeg/bin/ffmpeg -loglevel verbose-re -i /media/usb0/4k_sampels/Exodus_UHD_HDR_Exodus_draft.mp4 -c:v:0 nvenc_hevc -preset llhq -profile:v:0 main10 -vb 8000k -c:a:0 mp2 -b:a:0 384k -f mpegts -metadata:s:v:0 master-display="G(13248,34499)B(7500,2999)R(34000,15999)WP(15700,17550)L(10000000,100)" -color_range 1 -color_trc smpte2084 -color_primaries bt2020 -colorspace 9 -y /tmp/out.ts
Kind Regards,

Attachments (2)

exodus_hdr.zip (2.5 MB) - added by smallishzulu 2 years ago.
Shorten Test File
hdr-mediainfo.png (58.8 KB) - added by smallishzulu 2 years ago.
MediaInfo? Screenshot of Test File

Change History (3)

Changed 2 years ago by smallishzulu

Shorten Test File

Changed 2 years ago by smallishzulu

MediaInfo? Screenshot of Test File

comment:1 Changed 20 months ago by cehoyos

Does nvenc support his colourspace?

Note: See TracTickets for help on using tickets.