Am 10.02.2020 um 18:31 schrieb Michael Koch:
Paul,

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.
No, as already said if timebases and fps do not match you can not get
results you expect.
Use fps filter somehow...

Here is a new example for unexpected behaviour of the overlay filter:

c:\ffmpeg\ffmpeg -f lavfi -i testsrc2=size=hd1080:duration=10 -f lavfi -i color=black:size=50x50:duration=7 -lavfi "[1]sendcmd=f=test.cmd[2];[0][2]overlay=x=0:y=0:format=rgb" -t 10 -y out.mp4

The coordinates come from this test.cmd file:

0.0-1.0   overlay x 'lerp(1735-50,1723-50,t)',
          overlay y 'lerp( 527-50, 529-50,t)';
1.0-2.0   overlay x 'lerp(1723-50,1605-50,t-1)',
          overlay y 'lerp( 529-50, 526-50,t-1)';
2.0-3.0   overlay x 'lerp(1605-50,1440-50,t-2)',
          overlay y 'lerp( 526-50, 526-50,t-2)';
3.0-4.0   overlay x 'lerp(1440-50,1266-50,t-3)',
          overlay y 'lerp( 526-50, 523-50,t-3)';
4.0-5.0   overlay x 'lerp(1266-50,1113-50,t-4)',
          overlay y 'lerp( 523-50, 523-50,t-4)';
5.0-6.0   overlay x 'lerp(1113-50,1007-50,t-5)',
          overlay y 'lerp( 523-50, 522-50,t-5)';
6.0-7.0   overlay x 'lerp(1007-50, 966-50,t-6)',
          overlay y 'lerp( 522-50, 522-50,t-6)';
7.0-8.0   overlay x 'lerp( 966-50, 964-50,t-7)',
          overlay y 'lerp( 522-50, 522-50,t-7)';
8.0-9.0   overlay x 'lerp( 964-50, 964-50,t-8)',
          overlay y 'lerp( 522-50, 522-50,t-8)';
9.0-10.0  overlay x 'lerp( 964-50, 964-50,t-9)',
          overlay y 'lerp( 522-50, 522-50,t-9)';

Please note that all movements end at 8s. No movement is specified from 8s to 10s.

In the command line I have two different durations, 10s for the main video and 7s for the overlay. Expected behaviour would be that after 7s the last frame is used and overlaid at the correct position. But it seems that sendcmd gets the wrong time, so that there is movement visible until the end at 10s.

I just found my error myself. The sendcmd command is inserted at the wrong place in the filter chain. It must be inserted where the longer of the two inputs is.

Michael

_______________________________________________
ffmpeg-user mailing list
[email protected]
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
[email protected] with subject "unsubscribe".

Reply via email to