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

Dan twinbee42 at skytopia.com
Wed Sep 14 20:00:28 EEST 2022

That's a great idea to use specified colours directly supported by ffmpeg
and helps narrow down the issue a lot!

Would you count this as a bug? If this is a known legacy quirk, it seems
one of the ugliest and most misleading quirks I have seen in a while, and I could
imagine being responsible for wasting thousands of hours of thought based upon
mis-diagnosed colour-profiling assumptions.

I've spoken with two separate long-time video professionals so far, and they
were both convinced this was a colour profile thing and that my source images
were the problem, and not ffmpeg's behaviour, despite saying I checked both
BMPs in a hex editor, and they were byte-identical (other than resolution/filesize).

Are you using Windows per chance? To make things even more confusing, one
of the aforementioned pros says he can't spot a difference on his non-Windows
system (presuming Mac, could be Linux) between the two output mp4s' colours.

I'm almost suspecting this is a problem only with the Windows version of ffmpeg,
or at least with the OS's viewer (e.g: Chrome / Classic Media Player). Maybe Paul
could confirm that.


On Wed, 14 Sep 2022 15:49:23 +0100, Michael Koch <astroelectronic at t-online.de> wrote:

> Am 14.09.2022 um 11:21 schrieb Dan:
>> Using the latest 5.1.1 "essentials build" by www.gyan.dev.
>> Hi all, I'm a beginner to ffmpeg so I'm having a hard time believing
>> that a utility so old and so widely used has such a fundamental bug,
>> but the evidence is staring me in the face and leads me to no other
>> conclusion.
>> It's incredibly easy to replicate thankfully. I want to convert
>> numerous frames to make an animation, but thankfully, I've simplified
>> the problem to even using a single image to make a '1 frame video' for
>> the purposes of debugging.
>> Simply perform this command line:
>> ffmpeg.exe -i original.png -crf 0 -vcodec libx264 output.mp4
>> ...With this "original.png" ("fC2Tj") image:
>> https://i.stack.imgur.com/5jkct.png
>> And this command line:
>> ffmpeg.exe -i doubleHeight.png -crf 0 -vcodec libx264 output.mp4
>> ...On this "doubleHeight" ("RGIvA") image:
>> https://i.stack.imgur.com/PLdsb.png
>> The double height version is darker than it should be. I've checked
>> the resulting video in both Media Player Classic and Chrome.
> The issue can be reproduced without input images as follows:
> ffmpeg -f lavfi -i color=0x19be0f:s=400x576 -crf 0 -vcodec libx264 -t 5
> -y out1.mp4
> ffmpeg -f lavfi -i color=0x19be0f:s=400x578 -crf 0 -vcodec libx264 -t 5
> -y out2.mp4
> The color seems to be brighter if the height is 576 or smaller, and
> darker if the height is 578 or larger.
> It's clearly visible if you play both videos side by side. I did test
> with VLC Player and FFplay. I don't see how zscale could fix this issue.
> Michael
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://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