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

Michael Koch astroelectronic at t-online.de
Wed Sep 14 17:49:23 EEST 2022


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



More information about the ffmpeg-user mailing list