[FFmpeg-user] dpx to prores & h.264 - color shift

Andreas Hummel kazhadena at googlemail.com
Mon Oct 17 14:59:01 EEST 2016


Hello Kevin, thanks for the hint. I replaced the -colormatrix option with
the -vf scale=.. option you suggested but i'm still getting a slight hue
shift in the final converted movie.

Even the added -sws_flags you suggested thx @Andy couldn't solve the
problem. I tried various combinations but somehow i can't get a color
correct output with ffmpeg so far.


ffmpeg.exe -loglevel verbose -y -f image2 -start_number 0 -r 25 -i INPUT -r
25 -vcodec prores_ks -profile:v 3 -pix_fmt yuv422p10le -vf
scale=in_range=full:in_color_matrix=bt709:out_range=tv:out_color_matrix=bt709
-sws_flags accurate_rnd+full_chroma_int+full_chroma_inp+bitexact
-color_primaries bt709 -color_trc bt709 -colorspace bt709 -vendor ap10
OUTPUT.mov

########
The log looks currently like this:
Input #0, image2, from 'INPUT':
  Duration: 00:01:04.48, start: 0.000000, bitrate: N/A
    Stream #0:0: Video: dpx, 1 reference frame, gbrp10le, 1920x1080 [SAR
1:1 DAR 16:9], 25 tbr, 25 tbn, 25 tbc
[Parsed_scale_0 @ 00000000025899a0] w:iw h:ih flags:'bicubic' interl:0
[graph 0 input from stream 0:0 @ 0000000002587ba0] w:1920 h:1080
pixfmt:gbrp10le tb:1/25 fr:25/1 sar:1/1 sws_param:flags=2
[graph 0 input from stream 0:0 @ 0000000002587ba0] TB:0.040000
FRAME_RATE:25.000000 SAMPLE_RATE:nan
[Parsed_scale_0 @ 00000000025899a0] w:1920 h:1080 fmt:gbrp10le sar:1/1 ->
w:1920 h:1080 fmt:yuv422p10le sar:1/1 flags:0x4
Output #0, mov, to 'OUTPUT.mov':
  Metadata:
    encoder         : Lavf57.51.103
    Stream #0:0: Video: prores (prores_ks), 1 reference frame (apch /
0x68637061), yuv422p10le(bt709), 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200
kb/s, 25 fps, 12800 tbn, 25 tbc
    Metadata:
      encoder         : Lavc57.61.102 prores_ks
Stream mapping:
  Stream #0:0 -> #0:0 (dpx (native) -> prores (prores_ks))
Press [q] to stop, [?] for help
No more output streams to write to, finishing.e=00:01:04.28
bitrate=115202.2kbits/s speed=0.42x
frame= 1612 fps= 11 q=-0.0 Lsize=  904052kB time=00:01:04.44
bitrate=114928.4kbits/s speed=0.42x
video:904040kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB
muxing overhead: 0.001372%
Input file #0 (INPUT.dpx):
  Input stream #0:0 (video): 1612 packets read (13390381056 bytes); 1612
frames decoded;
  Total: 1612 packets (13390381056 bytes) demuxed
Output file #0 (OUTPUT.mov):
  Output stream #0:0 (video): 1612 frames encoded; 1612 packets muxed
(925736976 bytes);
  Total: 1612 packets (925736976 bytes) muxed



########
I checked my input footage with ffprobe and mediainfo and the output is as
follows:

--> ffprobe
Input #0, dpx_pipe, from 'INPUT':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: dpx, gbrp10le, 1920x1080 [SAR 1:1 DAR 16:9], 25
tbr, 25 tbn, 25 tbc

--> mediainfo
Format                                   : DPX
Format version                        : Version 1.0
File size                                 : 12.5 GiB
Duration                                  : 1 min 4 s
Overall bit rate                         : 1 661 Mb/s
Encoded date                          : 2016-10-05T10:36:57Mit
Writing library                          : daVinci

Video
Format                                   : DPX
Format version                           : Version 1.0
Duration                                 : 1 min 4 s
Bit rate                                 : 1 661 Mb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 25.000 FPS
Color space                              : RGB
Bit depth                                : 10 bits
Scan type                                : Progressive
Compression mode                         : Lossless
Bits/(Pixel*Frame)                       : 32.047
Stream size                              : 12.5 GiB (100%)
Writing library                          : daVinci
Encoded date                             : 2016-10-05T10:36:57Mit
Color primaries                          : Printing density


########
The output file has the following info:

-->ffprobe
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'OUTPUT.mov':
  Metadata:
    major_brand     : qt
    minor_version   : 512
    compatible_brands: qt
    encoder         : Lavf57.51.103
  Duration: 00:01:04.48, start: 0.000000, bitrate: 114857 kb/s
    Stream #0:0(eng): Video: prores (apch / 0x68637061), yuv422p10le,
1920x1080, 114855 kb/s, SAR 1:1 DAR 16:9, 25 fps, 25 tbr, 12800 tbn, 12800
tbc (default)
    Metadata:
      handler_name    : DataHandler
      encoder         : Lavc57.61.102 prores_ks





2016-10-13 15:05 GMT+02:00 Andy Furniss <adf.lists at gmail.com>:

> Kevin Wheatley wrote:
>
>> Andreas,
>>
>> instead of using the -colormatrix option try instead using
>>
>> -vf scale=in_range=full:in_color_matrix=bt709:out_range=tv:out_c
>> olor_matrix=bt709
>>
>> assuming your DPX files are utilising full range encoding
>>
>
> also scale has flags which may or may not affect quality in this case.
>
> IIRC getting them to work can be a bit variable, historically
>
> -sws-flags flag1+flag2 ... used to work, but not last time I tested so
>
> -vf scale=........:flags=flag1+flag2..... was what I last used - best
>
> to double check with -loglevel verbose + check output to be sure.
>
> https://www.ffmpeg.org/ffmpeg-scaler.html#scaler_005foptions
>
> I am thinking of trying accurate_rnd full_chroma_int full_chroma_inp
> bitexact
>
> not that I know what's best or relevant, so trial and error really.
>
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".
>


More information about the ffmpeg-user mailing list