[FFmpeg-user] How to use -vf colorspace to convert SMPTE431/432 to bt709?

Kieran O'Leary kieran.oleary at irishfilm.ie
Sun Nov 6 13:29:20 EET 2016


Hi,

I noticed recently that Vittorio Giovara added SMPTE 431/432 support to the colorspace video filter. I often create h264/prores copies of XYZ Digital Cinema Packages via ffmpeg in a film archive. However the colours do not always look correct. By this I mean they do not look the same as when played back in a cinema projector or with EasyDCP player when the source colour space is declared as XYZ. You can see examples of this on pages 30/31 of this manual: https://www.easydcp.com/sync/manuals/easyDCP_Player_User_Manual.pdf

I was hoping that the colorspace filter could 'burn in' the colour conversion from the greenish images of the source to something more correct.

Is this possible with the colorpspace filter  in its current form? As it doesn't currently accept XYZ as input, I am taking the XYZ 12-bit Jpeg2000 files and converting them to either h264 or prores and it's these YUV files that I'm experimenting with. Should I use a different intermediate? My guess is that I need to declare the input primaries as smpte431 and declare the output as bt709 using -vf colorspace=iprimaries=smpte431:all=bt709 but am I on the complete wrong track here? That command (full output below) threw up an error saying' unsupported input transfer characteristics 2 (unknown). As there is no SMPTE431/432 itrc option, I didn't know what to put. I tried itrc=gamma22 (just to try something) but got another error: [Parsed_colorspace_0 @ 0x7fccf8700360] Unsupported input colorspace 2 (unknown)

Here's what I tried:

ffmpeg -i data_muxed_2016_11_06T10_36_06.mkv -vf colorspace=iprimaries=smpte431:all=bt709 -an color.mkv

ffmpeg version N-44918-g7746103 Copyright (c) 2000-2016 the FFmpeg developers

  built with Apple LLVM version 7.3.0 (clang-703.0.31)

  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-7746103 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libtesseract --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/2.1.2/include/openjpeg-2.1 --enable-vda

  libavutil      55. 35.100 / 55. 35.100

  libavcodec     57. 66.101 / 57. 66.101

  libavformat    57. 57.100 / 57. 57.100

  libavdevice    57.  2.100 / 57.  2.100

  libavfilter     6. 66.100 /  6. 66.100

  libavresample   3.  2.  0 /  3.  2.  0

  libswscale      4.  3.100 /  4.  3.100

  libswresample   2.  4.100 /  2.  4.100

  libpostproc    54.  2.100 / 54.  2.100

Input #0, matroska,webm, from 'data_muxed_2016_11_06T10_36_06.mkv':

  Metadata:

    ENCODER         : Lavf57.57.100

  Duration: 00:03:00.77, start: 0.000000, bitrate: 12533 kb/s

    Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 24 fps, 24 tbr, 1k tbn, 48 tbc (default)

    Metadata:

      FILE_PACKAGE_UMID: 0x060A2B340101010501010F20130000003CBE7F62D0F24DC0A3E352045221FE0C

      FILE_PACKAGE_NAME: File Package: SMPTE 429-4 frame wrapping of JPEG 2000 codestreams

      TRACK_NAME      : Picture Track

      ENCODER         : Lavc57.66.101 libx264

      DURATION        : 00:03:00.771000000

    Stream #0:1: Audio: aac (LC), 48000 Hz, 5.1, fltp (default)

    Metadata:

      FILE_PACKAGE_UMID: 0x060A2B340101010501010F20130000000E8C1ADC9E914415BA3CC9BC095FFD84

      FILE_PACKAGE_NAME: File Package: SMPTE 382M frame wrapping of wave audio

      TRACK_NAME      : Sound Track

      ENCODER         : Lavc57.66.101 aac

      DURATION        : 00:02:59.349000000

File 'color.mkv' already exists. Overwrite ? [y/N] y

[libx264 @ 0x7fe30d8d1800] using SAR=1/1

[libx264 @ 0x7fe30d8d1800] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX

[libx264 @ 0x7fe30d8d1800] profile High, level 4.0

[libx264 @ 0x7fe30d8d1800] 264 - core 148 r2699 a5e06b9 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=18 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00

Output #0, matroska, to 'color.mkv':

  Metadata:

    encoder         : Lavf57.57.100

    Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 24 fps, 1k tbn, 24 tbc (default)

    Metadata:

      FILE_PACKAGE_UMID: 0x060A2B340101010501010F20130000003CBE7F62D0F24DC0A3E352045221FE0C

      FILE_PACKAGE_NAME: File Package: SMPTE 429-4 frame wrapping of JPEG 2000 codestreams

      TRACK_NAME      : Picture Track

      DURATION        : 00:03:00.771000000

      encoder         : Lavc57.66.101 libx264

    Side data:

      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1

Stream mapping:

  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))

Press [q] to stop, [?] for help

[Parsed_colorspace_0 @ 0x7fe30c400000] Unsupported input transfer characteristics 2 (unknown)

Failed to inject frame into filter network: Invalid argument

Conversion failed!


ffmpeg -i data_muxed_2016_11_06T10_36_06.mkv -vf colorspace=itrc=gamma22:iprimaries=smpte432:all=bt709 -an color.mkv

ffmpeg version N-44918-g7746103 Copyright (c) 2000-2016 the FFmpeg developers

  built with Apple LLVM version 7.3.0 (clang-703.0.31)

  configuration: --prefix=/usr/local/Cellar/ffmpeg/HEAD-7746103 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libtesseract --enable-libx264 --enable-libxvid --enable-opencl --disable-lzma --enable-libopenjpeg --disable-decoder=jpeg2000 --extra-cflags=-I/usr/local/Cellar/openjpeg/2.1.2/include/openjpeg-2.1 --enable-vda

  libavutil      55. 35.100 / 55. 35.100

  libavcodec     57. 66.101 / 57. 66.101

  libavformat    57. 57.100 / 57. 57.100

  libavdevice    57.  2.100 / 57.  2.100

  libavfilter     6. 66.100 /  6. 66.100

  libavresample   3.  2.  0 /  3.  2.  0

  libswscale      4.  3.100 /  4.  3.100

  libswresample   2.  4.100 /  2.  4.100

  libpostproc    54.  2.100 / 54.  2.100

Input #0, matroska,webm, from 'data_muxed_2016_11_06T10_36_06.mkv':

  Metadata:

    ENCODER         : Lavf57.57.100

  Duration: 00:03:00.77, start: 0.000000, bitrate: 12533 kb/s

    Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 24 fps, 24 tbr, 1k tbn, 48 tbc (default)

    Metadata:

      FILE_PACKAGE_UMID: 0x060A2B340101010501010F20130000003CBE7F62D0F24DC0A3E352045221FE0C

      FILE_PACKAGE_NAME: File Package: SMPTE 429-4 frame wrapping of JPEG 2000 codestreams

      TRACK_NAME      : Picture Track

      ENCODER         : Lavc57.66.101 libx264

      DURATION        : 00:03:00.771000000

    Stream #0:1: Audio: aac (LC), 48000 Hz, 5.1, fltp (default)

    Metadata:

      FILE_PACKAGE_UMID: 0x060A2B340101010501010F20130000000E8C1ADC9E914415BA3CC9BC095FFD84

      FILE_PACKAGE_NAME: File Package: SMPTE 382M frame wrapping of wave audio

      TRACK_NAME      : Sound Track

      ENCODER         : Lavc57.66.101 aac

      DURATION        : 00:02:59.349000000

File 'color.mkv' already exists. Overwrite ? [y/N] y

[libx264 @ 0x7fccf88e9000] using SAR=1/1

[libx264 @ 0x7fccf88e9000] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX

[libx264 @ 0x7fccf88e9000] profile High, level 4.0

[libx264 @ 0x7fccf88e9000] 264 - core 148 r2699 a5e06b9 - H.264/MPEG-4 AVC codec - Copyleft 2003-2016 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=18 lookahead_threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00

Output #0, matroska, to 'color.mkv':

  Metadata:

    encoder         : Lavf57.57.100

    Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=-1--1, 24 fps, 1k tbn, 24 tbc (default)

    Metadata:

      FILE_PACKAGE_UMID: 0x060A2B340101010501010F20130000003CBE7F62D0F24DC0A3E352045221FE0C

      FILE_PACKAGE_NAME: File Package: SMPTE 429-4 frame wrapping of JPEG 2000 codestreams

      TRACK_NAME      : Picture Track

      DURATION        : 00:03:00.771000000

      encoder         : Lavc57.66.101 libx264

    Side data:

      cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1

Stream mapping:

  Stream #0:0 -> #0:0 (h264 (native) -> h264 (libx264))

Press [q] to stop, [?] for help

[Parsed_colorspace_0 @ 0x7fccf8700360] Unsupported input colorspace 2 (unknown)

Failed to inject frame into filter network: Invalid argument

Conversion failed!

Thanks,

Kieran.



------
This email has been scanned for spam and malware by The Email Laundry.



More information about the ffmpeg-user mailing list