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

Michael Koch astroelectronic at t-online.de
Thu Sep 15 12:11:19 EEST 2022


Am 15.09.2022 um 11:01 schrieb Paul B Mahol:
> On 9/15/22, Michael Koch <astroelectronic at t-online.de> wrote:
>> Am 15.09.2022 um 00:30 schrieb Paul B Mahol:
>>> On 9/15/22, Dan <twinbee42 at skytopia.com> wrote:
>>>>> zscale=...,format=yuv420p
>>>> Ohhhh.... okay. I tried that before (except using two -vf commands),
>>>> because
>>>> I
>>>> suspected you might've meant that.
>>>>
>>>> Just tried it again, still no luck. Let me know if I need to tweak
>>>> anything:
>>>>
>>>> ffmpeg.exe -f lavfi -i color=0x19be0f:s=400x578 -crf 0 -vcodec libx264
>>>> -vf
>>>> zscale=w=-1:h=-1,format=yuv420p -t 5 -y "578.mp4"
>>>>
>>>> I'm using Media Player Classic to test the colours, which breaks the pic
>>>> using the 578 pixel
>>>> height. Chrome actually works with both the 576 and 578 pixel height, but
>>>> as
>>>> soon as I
>>>> change the height to 984, then both Media Player Classic AND Chrome show
>>>> it
>>>> broken.
>>>>
>>>> Datascope shows the strange and seemingly unrelated 78,4C,44 values for
>>>> all
>>>> three sizes,
>>>> but it does that even without using zscale at all.
>>> Good, we move forward, that are real values encoded in bitstream.
>>>
>>> Anything RGB values you complain about have nothing directly related
>>> about ffmpeg.
>>>
>>> Also make sure that all software are reinterpreting your files correctly.
>>> The files need to signal correct encoded colorspace/primaries/range/etc
>>> so
>>> it can be correctly displayed on screen.
>> Below is a Windows batch file for reproducing with FFplay. I did use the
>> latest version from Gyan. The color difference is clearly visible.
> Looks like you had hard time understanding text you quoted above.
>
>> ffmpeg -f lavfi -i color=0x19be0f:s=400x576 -vf
>> zscale,setrange=full,format=yuv420p -colorspace bt709 -color_primaries
>> bt709 -crf 0 -vcodec libx264 -t 5 -y out1.mp4
>> ffmpeg -f lavfi -i color=0x19be0f:s=400x578 -vf
>> zscale,setrange=full,format=yuv420p -colorspace bt709 -color_primaries
>> bt709 -crf 0 -vcodec libx264 -t 5 -y out2.mp4
>> start ffplay -left 0 -top 0 out1.mp4
>> start ffplay -left 400 -top 0 out2.mp4
>>
>> When inspecting the files with FFprobe or ExifTool, I see no differences
>> except height and small differences in bitrate and filesize.
> ffplay is broken/buggy and should not be used here, it will display
> differently stuff
> all the time, and uses SDL library by default for video output.
>
> Using datascope filter it clearly shows pixels are exactly same.

You are right that datascope shows no difference. But the issue is also 
reproducible with VLC player.



More information about the ffmpeg-user mailing list