[FFmpeg-user] Colour metadata not preserved when re-encoding ProRes/mov to FFV1/mkv

Kieran O Leary kieran.o.leary at gmail.com
Tue Jul 24 23:03:52 EEST 2018


Hi Carl/Reto:

Reto: We are just experimenting at the moment and seeing if this is a
good idea or not for some in-house legacy prores SD PAL telecine files
that have been in our backlog for several years. We have no
conclusions yet, just doing some experimenting/having fun/learning a
lot.

Carl, see below:

On Tue, Jul 24, 2018 at 8:35 PM, Carl Eugen Hoyos <ceffmpeg at gmail.com> wrote:
> 2018-07-24 16:05 GMT+02:00, W M <cinemaeos at outlook.com>:
>
>> At the Irish Film Institute Film Archive, we are investigating the
>> technicalities of normalising ProRes materials to FFV1, the major issue
>> we've identified is that colour metadata "color primaries", "transfer
>> characteristics", "matrix coefficients" are not carried over to the FFV1/mkv
>> file.
>
> Command line and complete, uncut console output missing.
>


I am not working off of git-master at the moment, but i tried earlier
with git master and i found the same behaviour:

I'm pasting five command lines,

1) generate a prores file with a colr_atom. We used mediainfo
--Details=1 to verify that colour metadata is present in the colr atom
as well as within the prores bitstrem (icpf section)

2) transcode this file to ffv1/mkv

3) ffprobe output showing that no colour metadata values are present.

4) rewrap prores to matroska

5) colour values are present in this rewrapped file


1) generate a prores file with a colr_atom (we also tried this test
with a file exported from FCP7) . We used mediainfo --Details=1 to
verify that colour metadata is present in the colr atom as well as
within the prores bitstrem (icpf section)

$ ffmpeg -f lavfi -i testsrc=size=720x576 -colorspace bt470bg
-color_primaries bt470bg  -color_trc bt709 -c:v prores -pix_fmt
yuv422p10le -movflags write_colr -t 1 colour.mov
ffmpeg version N-90339-ged1a750 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609
  configuration: --prefix=/home/kieranjol/ffmpeg_build
--pkg-config-flags=--static
--extra-cflags=-I/home/kieranjol/ffmpeg_build/include
--extra-ldflags=-L/home/kieranjol/ffmpeg_build/lib
--extra-libs='-lpthread -lm' --bindir=/home/kieranjol/bin --enable-gpl
--enable-libass --enable-libfdk-aac --enable-libfreetype
--enable-libmp3lame --enable-libopus --enable-libtheora
--enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265
--enable-nonfree --enable-libopenjpeg
  libavutil      56. 10.100 / 56. 10.100
  libavcodec     58. 14.100 / 58. 14.100
  libavformat    58. 10.100 / 58. 10.100
  libavdevice    58.  2.100 / 58.  2.100
  libavfilter     7. 13.100 /  7. 13.100
  libswscale      5.  0.102 /  5.  0.102
  libswresample   3.  0.101 /  3.  0.101
  libpostproc    55.  0.100 / 55.  0.100
Input #0, lavfi, from 'testsrc=size=720x576':
  Duration: N/A, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: rawvideo (RGB[24] / 0x18424752), rgb24,
720x576 [SAR 1:1 DAR 5:4], 25 tbr, 25 tbn, 25 tbc
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> prores (native))
Press [q] to stop, [?] for help
[prores @ 0x42230c0] encoding with ProRes standard (apcn) profile
[prores @ 0x42262c0] encoding with ProRes standard (apcn) profile
[prores @ 0x42296c0] encoding with ProRes standard (apcn) profile
[prores @ 0x422cb80] encoding with ProRes standard (apcn) profile
[prores @ 0x41ea3c0] encoding with ProRes standard (apcn) profile
Output #0, mov, to 'colour.mov':
  Metadata:
    encoder         : Lavf58.10.100
    Stream #0:0: Video: prores (apcn / 0x6E637061),
yuv422p10le(bt470bg/bt470bg/bt709), 720x576 [SAR 1:1 DAR 5:4], q=2-31,
200 kb/s, 25 fps, 12800 tbn, 25 tbc
    Metadata:
      encoder         : Lavc58.14.100 prores
frame=   25 fps=0.0 q=-0.0 Lsize=    1711kB time=00:00:00.96
bitrate=14601.0kbits/s speed=6.11x
video:1710kB audio:0kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.050018%


***

2) transcode this file to ffv1/mkv


$ ffmpeg -i colour.mov -c:v ffv1 -level 3  out.mkv
ffmpeg version N-90339-ged1a750 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609
  configuration: --prefix=/home/kieranjol/ffmpeg_build
--pkg-config-flags=--static
--extra-cflags=-I/home/kieranjol/ffmpeg_build/include
--extra-ldflags=-L/home/kieranjol/ffmpeg_build/lib
--extra-libs='-lpthread -lm' --bindir=/home/kieranjol/bin --enable-gpl
--enable-libass --enable-libfdk-aac --enable-libfreetype
--enable-libmp3lame --enable-libopus --enable-libtheora
--enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265
--enable-nonfree --enable-libopenjpeg
  libavutil      56. 10.100 / 56. 10.100
  libavcodec     58. 14.100 / 58. 14.100
  libavformat    58. 10.100 / 58. 10.100
  libavdevice    58.  2.100 / 58.  2.100
  libavfilter     7. 13.100 /  7. 13.100
  libswscale      5.  0.102 /  5.  0.102
  libswresample   3.  0.101 /  3.  0.101
  libpostproc    55.  0.100 / 55.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'colour.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf58.10.100
  Duration: 00:00:01.00, start: 0.000000, bitrate: 14018 kb/s
    Stream #0:0(eng): Video: prores (apcn / 0x6E637061),
yuv422p10le(smpte170m/bt470bg/bt709, progressive), 720x576, 14011
kb/s, SAR 1:1 DAR 5:4, 25 fps, 25 tbr, 12800 tbn, 12800 tbc (default)
    Metadata:
      handler_name    : DataHandler
      encoder         : Lavc58.14.100 prores
File 'out.mkv' already exists. Overwrite ? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (prores (native) -> ffv1 (native))
Press [q] to stop, [?] for help
[ffv1 @ 0x30b0000] bits_per_raw_sample > 8, forcing range coder
Output #0, matroska, to 'out.mkv':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf58.10.100
    Stream #0:0(eng): Video: ffv1 (FFV1 / 0x31564646), yuv422p10le,
720x576 [SAR 1:1 DAR 5:4], q=2-31, 200 kb/s, 25 fps, 1k tbn, 25 tbc
(default)
    Metadata:
      handler_name    : DataHandler
      encoder         : Lavc58.14.100 ffv1
frame=   25 fps=0.0 q=-0.0 Lsize=     695kB time=00:00:00.96
bitrate=5920.4kbits/s speed=5.75x
video:693kB audio:0kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.196114%



***
3) ffprobe output showing that no colour metadata values are present.

$ ffprobe -v 0 -show_streams out.mkv |grep color
color_range=unknown
color_space=unknown
color_transfer=unknown
color_primaries=unknown


**

4) rewrap prores to matroska


$ ffmpeg -i colour.mov -c copy  woah.mkv
ffmpeg version N-90339-ged1a750 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609
  configuration: --prefix=/home/kieranjol/ffmpeg_build
--pkg-config-flags=--static
--extra-cflags=-I/home/kieranjol/ffmpeg_build/include
--extra-ldflags=-L/home/kieranjol/ffmpeg_build/lib
--extra-libs='-lpthread -lm' --bindir=/home/kieranjol/bin --enable-gpl
--enable-libass --enable-libfdk-aac --enable-libfreetype
--enable-libmp3lame --enable-libopus --enable-libtheora
--enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265
--enable-nonfree --enable-libopenjpeg
  libavutil      56. 10.100 / 56. 10.100
  libavcodec     58. 14.100 / 58. 14.100
  libavformat    58. 10.100 / 58. 10.100
  libavdevice    58.  2.100 / 58.  2.100
  libavfilter     7. 13.100 /  7. 13.100
  libswscale      5.  0.102 /  5.  0.102
  libswresample   3.  0.101 /  3.  0.101
  libpostproc    55.  0.100 / 55.  0.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'colour.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf58.10.100
  Duration: 00:00:01.00, start: 0.000000, bitrate: 14018 kb/s
    Stream #0:0(eng): Video: prores (apcn / 0x6E637061),
yuv422p10le(smpte170m/bt470bg/bt709, progressive), 720x576, 14011
kb/s, SAR 1:1 DAR 5:4, 25 fps, 25 tbr, 12800 tbn, 12800 tbc (default)
    Metadata:
      handler_name    : DataHandler
      encoder         : Lavc58.14.100 prores
Output #0, matroska, to 'woah.mkv':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf58.10.100
    Stream #0:0(eng): Video: prores (apcn / 0x6E637061),
yuv422p10le(smpte170m/bt470bg/bt709, progressive), 720x576 [SAR 1:1
DAR 5:4], q=2-31, 14011 kb/s, 25 fps, 25 tbr, 1k tbn, 12800 tbc
(default)
    Metadata:
      handler_name    : DataHandler
      encoder         : Lavc58.14.100 prores
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame=   25 fps=0.0 q=-1.0 Lsize=    1712kB time=00:00:00.96
bitrate=14595.2kbits/s speed= 235x
video:1710kB audio:0kB subtitle:0kB other streams:0kB global
headers:0kB muxing overhead: 0.106087%


**

5) colour values are present in this rewrapped file

$ ffprobe -v 0 -show_streams woah.mkv |grep color
color_range=unknown
color_space=smpte170m
color_transfer=bt709
color_primaries=bt470bg



AAAAAND just for fun, here's a section of a mediainfo --details=1
output of the remuxed stream copied prores/mov to prores/mkv that
shows the values present in the container, not just the stream:

0001C9     FlagInterlaced - 2 (0x2) (3 bytes)
0001C9      Header (2 bytes)
0001C9       Name:                             26 (0x1A)
0001CA       Size:                             1 (0x01)
0001CB      Data:                              2 (0x02)
0001CC     Colour (15 bytes)
0001CC      Header (3 bytes)
0001CC       Name:                             5552 (0x15B0)
0001CE       Size:                             12 (0x0C)
0001CF      TransferCharacteristics - 1 (0x1) - BT.709 (4 bytes)
0001CF       Header (3 bytes)
0001CF        Name:                            5562 (0x15BA)
0001D1        Size:                            1 (0x01)
0001D2       Data:                             1 (0x01)
0001D3      MatrixCoefficients - 6 (0x6) - BT.601 (4 bytes)
0001D3       Header (3 bytes)
0001D3        Name:                            5553 (0x15B1)
0001D5        Size:                            1 (0x01)
0001D6       Data:                             6 (0x06)
0001D7      Primaries - 5 (0x5) - BT.601 PAL (4 bytes)
0001D7       Header (3 bytes)
0001D7        Name:                            5563 (0x15BB)
0001D9        Size:                            1 (0x01)
0001DA       Data:                             5 (0x05)


Best,

Kieran O'Leary.


More information about the ffmpeg-user mailing list