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

Dan twinbee42 at skytopia.com
Tue Oct 11 18:47:50 EEST 2022


On Sun, 25 Sep 2022 10:38:22 +0100, Reino Wijnsma <rwijnsma at xs4all.nl> wrote:

> On 2022-09-21T17:10:21+0200, Dan <twinbee42 at skytopia.com> wrote:
>> 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?
> These commands, after careful observation, are the ones that work for me to closely match the original colours.
> I'm no expert, nor am I an FFmpeg-developer, so someone else would have to answer whether it's "safe" to use.
> I guess it is though.

I resubscribed just to give some finality to this.

I managed to reproduce the problem that I had before and just to confirm at least one of
your two command lines came through wonderfully! The line with: "-color_range tv -colorspace bt470bg"
inside was quite good, though some RGB values were off by up to 4 units.

However the winning line:

ffmpeg -i input.png -t 5 -vf "zscale=m=709" -c:v libx264 -crf 0 out.mp4

...seems practically flawless, with RGB values only off by up 1/256. The "zscale=m=709"
really seems to do the trick.

Tested with the flat green colour and with the testchart.png

Thanks, Dan


More information about the ffmpeg-user mailing list