I am trying to add two overlays using ffmpeg as below:
[v0][1:v] overlay=21:24:enable='between(t,0.000, 1.135)' [v1];
[v1][2:v] overlay=120:24:enable='between(t,0.000, 1.135)' "
These two images [1:v] and [2:v] are below pngs:
The first png is 99px wide and I want to place it on x=21
The second png I want to place right behind the first one x=21+99=120
But I am getting the output as below: It seems that there is 1px gap between them and I have no idea where is it coming from.
How can I ensure it is pixel perfect and there is no gap?
Also I noticed that if the image is 98px and I use:
[v0][1:v] overlay=21:24:enable='between(t,0.000, 1.135)' [v1];
[v1][2:v] overlay=119:24:enable='between(t,0.000, 1.135)' "
then suprisingly it is fine, same for 100px wide and next images x=121
The whole command to give more context (remove newlines to execute):
.\bin\ffmpeg.exe -ss 0 -to 5.681
-i C:\Users\Radoslaw\Videos\ttt.mp4
-i .\tempAssets\player1.png
-i .\tempAssets\serving.png
-filter_complex
[0:v] select='between(t,1.247,2.550)+between(t,4.181,5.681)', setpts='PTS-STARTPTS-((gt(T,2.550)*1.630))/TB' [v0];
[0:a] aselect='between(t,1.247,2.550)+between(t,4.181,5.681)', asetpts='PTS-STARTPTS-((gt(T,2.550)*1.630))/TB';
[v0][1:v] overlay=21:21:enable='between(t,0.000, 2.803)' [v1];
[v1][2:v] overlay=120:21:enable='between(t,0.000, 2.803)'
Untitled.mp4
@Gyan your answer helped for the mentioned simple scenario but if I change the order:
[v0][2:v] overlay=120:24:enable='between(t,0.000, 1.135)':format=auto,format=yuv444p [v1];
[v1][1:v] overlay=21:24:enable='between(t,0.000, 1.135)' "
then I get the 1px gap again. Any suggestions?