#8875 closed defect (fixed)

ffmpeg HDR signaling

Reported by: Helg1980 Owned by:
Priority: normal Component: ffmpeg
Version: unspecified Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

Summary of the bug:

Hi!

I encountered the following problem:

I need to transfer video files encoded by ProRes and DNxHD from the "MKV" container to the native "MOV" container.

When I copy a video from the "MKV" container to the " MOV " container, the following metadata is not saved:

  • Color range (Limited)
  • Color primaries (bt2020)
  • Transfer characteristics (PQ)
  • Matrix coefficients (bt2020nc)

This as I noticed happens for codecs DNxHD and ProRes, but for example for codec H265 this error is not present.

Please tell me how to save this metadata for the "MOV" container with the ProRes and DNxHD codecs.

How to reproduce:

% ffmpeg -i "temp_prores_file.mkv" -map 0:0 -c:v copy -c:a copy -y "output_prores_file.mov"

ffmpeg 4.3 (on Manjaro Linux)

Change History (4)

comment:1 by Carl Eugen Hoyos, 14 months ago

Please test current FFmpeg git head, provide the command line you tested together with the complete, uncut console output and point us to an input sample to make this a valid ticket.

comment:2 by Helg1980, 14 months ago

Tested video:

ProRes: https://mega.nz/file/zg5GjQjA#6j0-Fea0t5Tyd3TGWLie20ASI-9AZHcKPWbif6pWqjw

DNxHD: https://mega.nz/file/G8wSlSSD#_6pt-tiwhnjhg3FyvzRx-VwnSteMhmw9qxr6vrB6HbA

ProRes test:

[helg@Houston ~]$ ffmpeg -i "/run/media/helg/My Passport/CacheClip/temp_prores_file.mkv" -map 0:0 -c:v copy -c:a copy -y "/run/media/helg/My Passport/CacheClip/output_prores_file.mov"
ffmpeg version n4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 10.1.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-nvdec --enable-nvenc --enable-omx --enable-shared --enable-version3
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, matroska,webm, from '/run/media/helg/My Passport/CacheClip/temp_prores_file.mkv':
  Metadata:
    MAJOR_BRAND     : isom
    MINOR_VERSION   : 1
    COMPATIBLE_BRANDS: isom
    ENCODER         : Lavf58.45.100
  Duration: 00:00:10.01, start: 0.000000, bitrate: 1585904 kb/s
    Stream #0:0: Video: prores (HQ) (apch / 0x68637061), yuv422p10le(tv, bt709/bt2020/smpte2084), 3840x2160, SAR 1:1 DAR 16:9, 59.94 fps, 59.94 tbr, 1k tbn, 1k tbc (default)
    Metadata:
      HANDLER_NAME    : Video Media Handler
      ENCODER         : Lavc58.91.100 prores_ks
      DURATION        : 00:00:10.010000000
    Side data:
      Mastering Display Metadata, has_primaries:1 has_luminance:1 r(0.6800,0.3200) g(0.2650,0.6900) b(0.1500 0.0600) wp(0.3140, 0.3510) min_luminance=0.100000, max_luminance=950.000000
    Stream #0:1(eng): Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
      HANDLER_NAME    : Sound Media Handler
      ENCODER         : Lavc58.91.100 pcm_s16le
      DURATION        : 00:00:10.005000000
Output #0, mov, to '/run/media/helg/My Passport/CacheClip/output_prores_file.mov':
  Metadata:
    MAJOR_BRAND     : isom
    MINOR_VERSION   : 1
    COMPATIBLE_BRANDS: isom
    encoder         : Lavf58.45.100
    Stream #0:0: Video: prores (HQ) (apch / 0x68637061), yuv422p10le(tv, bt709/bt2020/smpte2084), 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 59.94 fps, 59.94 tbr, 16k tbn, 1k tbc (default)
    Metadata:
      HANDLER_NAME    : Video Media Handler
      ENCODER         : Lavc58.91.100 prores_ks
      DURATION        : 00:00:10.010000000
    Side data:
      Mastering Display Metadata, has_primaries:1 has_luminance:1 r(0.6800,0.3200) g(0.2650,0.6900) b(0.1500 0.0600) wp(0.3140, 0.3510) min_luminance=0.100000, max_luminance=950.000000
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=  600 fps=281 q=-1.0 Lsize= 1935959kB time=00:00:09.99 bitrate=1587038.6kbits/s speed=4.69x    
video:1935951kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000424%

Here, by the way, I noticed that the colorspace "bt709" parameter is defined incorrectly in the line:
Stream #0:0: Video: prores (HQ) (apch / 0x68637061), yuv422p10le(tv, bt709/bt2020/smpte2084)
(When output to Mediainfo, the correct value is shown: bt2020nc)

DNxHD test:

[helg@Houston ~]$ ffmpeg -i "/run/media/helg/My Passport/CacheClip/temp_dnxhd_file.mkv" -map 0:0 -c:v copy -c:a copy -y "/run/media/helg/My Passport/CacheClip/output_dnxhd_file.mov"            
ffmpeg version n4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
  built with gcc 10.1.0 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-avisynth --enable-fontconfig --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libdav1d --enable-libdrm --enable-libfreetype --enable-libfribidi --enable-libgsm --enable-libiec61883 --enable-libjack --enable-libmfx --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librav1e --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-nvdec --enable-nvenc --enable-omx --enable-shared --enable-version3
  libavutil      56. 51.100 / 56. 51.100
  libavcodec     58. 91.100 / 58. 91.100
  libavformat    58. 45.100 / 58. 45.100
  libavdevice    58. 10.100 / 58. 10.100
  libavfilter     7. 85.100 /  7. 85.100
  libswscale      5.  7.100 /  5.  7.100
  libswresample   3.  7.100 /  3.  7.100
  libpostproc    55.  7.100 / 55.  7.100
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, matroska,webm, from '/run/media/helg/My Passport/CacheClip/temp_dnxhd_file.mkv':
  Metadata:
    MINOR_VERSION   : 1
    COMPATIBLE_BRANDS: isom
    MAJOR_BRAND     : isom
    ENCODER         : Lavf58.45.100
  Duration: 00:00:10.01, start: 0.000000, bitrate: 1747835 kb/s
    Stream #0:0: Video: dnxhd (DNXHR HQX) (AVdh / 0x68645641), yuv422p10le(tv, bt2020nc/bt2020/smpte2084, progressive), 3840x2160, SAR 1:1 DAR 16:9, 59.94 fps, 59.94 tbr, 1k tbn, 1k tbc (default)
    Metadata:
      HANDLER_NAME    : Video Media Handler
      ENCODER         : Lavc58.91.100 dnxhd
      DURATION        : 00:00:10.009000000
    Side data:
      Mastering Display Metadata, has_primaries:1 has_luminance:1 r(0.6800,0.3200) g(0.2650,0.6900) b(0.1500 0.0600) wp(0.3140, 0.3510) min_luminance=0.100000, max_luminance=950.000000
    Stream #0:1(eng): Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s (default)
    Metadata:
      HANDLER_NAME    : Sound Media Handler
      ENCODER         : Lavc58.91.100 pcm_s16le
      DURATION        : 00:00:10.005000000
Output #0, mov, to '/run/media/helg/My Passport/CacheClip/output_dnxhd_file.mov':
  Metadata:
    MINOR_VERSION   : 1
    COMPATIBLE_BRANDS: isom
    MAJOR_BRAND     : isom
    encoder         : Lavf58.45.100
    Stream #0:0: Video: dnxhd (DNXHR HQX) (AVdh / 0x68645641), yuv422p10le(tv, bt2020nc/bt2020/smpte2084, progressive), 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 59.94 fps, 59.94 tbr, 16k tbn, 1k tbc (default)
    Metadata:
      HANDLER_NAME    : Video Media Handler
      ENCODER         : Lavc58.91.100 dnxhd
      DURATION        : 00:00:10.009000000
    Side data:
      Mastering Display Metadata, has_primaries:1 has_luminance:1 r(0.6800,0.3200) g(0.2650,0.6900) b(0.1500 0.0600) wp(0.3140, 0.3510) min_luminance=0.100000, max_luminance=950.000000
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=  600 fps=105 q=-1.0 Lsize= 2133606kB time=00:00:09.99 bitrate=1749063.5kbits/s speed=1.74x    
video:2133600kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000286%

comment:3 by Helg1980, 14 months ago

Looks like I figured it out, the solution was '-movflags +write_colr':

ffmpeg -i "input.mkv" -map 0:0 -movflags +write_colr -c:v copy -map 0:a -c:a copy -y "output.mov"

comment:4 by Helg1980, 14 months ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.