[FFmpeg-user] ffmpeg MP4/x264 output colours change when input source is different resolution (bug?)

Dan twinbee42 at skytopia.com
Wed Sep 21 18:10:21 EEST 2022


On Sun, 18 Sep 2022 22:49:58 +0100, Reino Wijnsma <rwijnsma at xs4all.nl> wrote:

> With FFmpeg, creating a temp-file, zscale does work:
>
> ffmpeg -i PLdsb.png -t 5 -vf "zscale=m=709" -c:v libx264 -crf 0 PLdsb_zscale-bt709.mp4
>
> Again, not exactly the same colour, but very close.

  ....SNIP....

> These are all VUI (Video Usability Information) options and, unlike the colourmatrix conversions above, don't have a direct impact on the video-image itself.

  ....SNIP....

> ffmpeg -i PLdsb.png -t 5 -color_range tv -colorspace bt470bg -c:v libx264 -crf 0 PLdsb_vui-tv601.mp4

Thanks for both of those ffmpeg CLI lines! They do actually work for me (in MPC and Chrome).
Would you consider both of the lines safe to use?

Unfortunately, the line that I used which failed before, now also succeeds in producing accurate colours:

ffmpeg.exe -i testchart.png -crf 0 -vcodec libx264 -t 5 -y -colorspace bt470bg testchart.mp4

Here is the URL again for the test chart: https://www.belle-nuit.com/test-chart

I'm at a loss why it's suddenly producing correct colour results when it didn't before.

> If you insist on using these VUI options, then in contrast to what you might expect (PC,BT.709) it's actually TV,BT.601 that has the expected result.
> Welcome to the wonderful world of video conversions.

Feels like I'm going crazy haha. Hope it's all simplified and unified in the future, and all this
arbitrary legacy baggage can be put behind us once and for all.

Dan


More information about the ffmpeg-user mailing list