[FFmpeg-user] gif overlay miscalculating x and y, extra frame flash

Michael Koch astroelectronic at t-online.de
Mon Feb 10 11:30:13 EET 2020


Am 10.02.2020 um 09:35 schrieb Paul B Mahol:
> On 2/10/20, Michael Koch <astroelectronic at t-online.de> wrote:
>> Am 09.02.2020 um 23:51 schrieb S Andreason:
>>> Hi,
>>> I continued building and rendering after asking some questions last
>>> week. After 6 days x10 hours per day of
>>> (render,test,measure,edit,repeat) I finally was able to publish my
>>> video. In doing so I made it easy to duplicate the bugs I have been
>>> seeing.
>>>
>>> I have put the 7 files together in one 56Mb package for you to
>>> download at
>>> https://www.seahorsecorral.org/videos/tests/ffmpeg-test-gif.zip
>>>
>>> The issue is with -i gif and
>>> overlay=x=(calculations):y=(calculations):between
>>> 1. between calculates n differently than the 30fps video,
>>> 2. the last calculation for x and y are held over in memory for the
>>> next overlay, resulting in offsets and drift over time.
>> I have a similar problem, not sure if it's the same as yours, but it's
>> easier to reproduce.
>> A small black rectangle is overlaid over a video, and its position is
>> shifted to the right by one pixel per second. Theoretically we should
>> see 9 steps in the 10s video. But I see only 4 steps, in 2s intervals.
>>
>> ffmpeg -f lavfi -i testsrc2=size=vga -f lavfi -i color=black:size=20x40
>> -lavfi overlay=x=400+t:y=200 -c:v mpeg4 -q:v 0 -y -t 10 out.mp4
>>
> You reasoning is completely invalid. And ffmpeg output is correct.
> Next time read more documentation with understanding and learn how to
> use overlay format option.

When I add :format=rgb then all steps are indeed visible. I don't 
understand why it doesn't work with the default yuv420 format. Doesn't 
yuv420 mean "full resolution for luminance, half resolution for color"? 
The black rectangle has a different luminance than the background. Can 
you please explain why half of the steps are invisible?

Nevertheless I have the same problem as the original poster, also when I 
add :format=rgb. Something is wrong with the x,y calculations in the 
overlay filter. In my example I'm using sendcmd to set x and y. The 
coordinates are sometimes off by a few pixels. At the moment my command 
line is too complicated to show here. Give me a little bit of time to 
find an example that's easier to reproduce.

Michael



More information about the ffmpeg-user mailing list