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

Dan twinbee42 at skytopia.com
Wed Sep 14 14:17:11 EEST 2022


On Wed, 14 Sep 2022 11:12:25 +0100, Paul B Mahol <onemda at gmail.com> wrote:

> On 9/14/22, Dan <twinbee42 at skytopia.com> wrote:
>> 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:
>
> Scale filter may give different colors depending on frame dimensions.
>
> Use zscale filter instead.

Oh, that's interesting! Would you call this a bug? Going by the element of
least surprise, it doesn't seem to make sense that scaling in a different
way should change the colours of the output and especially not in such a
seemingly unpredictable and erratic way. I've spent countless hours
trying to track this down.

Does this have anything to do with image colour profiles by the way?

Anyway, I tried your suggestion, and I'm now getting this error:

"[Parsed_zscale_0 @ 000002315a134f00] code 1026: YUV color family cannot have RGB matrix coefficients".

My command line looks like this:

ffmpeg.exe -i test.bmp -crf 0 -vcodec libx264 -vf zscale=w=-1:h=-1 output.mp4

Thanks, D


More information about the ffmpeg-user mailing list