0

I am having a single Image which I want to slide (Transition) from right to Left and stop at the end point and convert that into Video using FFMPEG. Although there are many posts regarding transitions but I couldn't find transition for single image to Video.

I had used the solution from this question:

ffmpeg -i C:\Sagar\Projects\Demos\Canvas\Canvas\BoxImage\1\output.png -i C:\Sagar\Projects\Demos\Canvas\Canvas\BoxImage\1\output.png -filter_complex "[0:v][1:v]overlay=x='if(lte(-w+(t)*100,w/2),-w+(t)*100,w/2)':y=0[out]" -map '[out]' -y C:\Sagar\Projects\Demos\Canvas\Canvas\BoxImage\1\outputout.mp4

but gives an error "Invalid stream specifier [out]":

Invalid stream specifier [out]

I have also tried

ffmpeg -f lavfi -i "color=black:d=15:s=1920x1080[background];movie='C:\Sagar\Projects\Demos\Canvas\Canvas\BoxImage\2\output.png' [overlay];[background][overlay]overlay='W-n:(H-h)/2'" C:\Sagar\Projects\Demos\Canvas\Canvas\BoxImage\2\outputoutput.mp4

But it still gives me error as below

error 2

slhck
  • 223,558
  • 70
  • 607
  • 592

1 Answers1

0

Assuming you want the background to be black, use

ffmpeg -loop 1 -i img.png -filter_complex 
       "split=2[bg][slider];[bg]drawbox=c=black:t=fill[bg];
        [bg][slider]overlay=x='max(W-(w/4)*t,0)':y=0" -t 10 out.mp4

This will create a 10-second video in which the the images slides from right to left in 4 seconds and then stops there.

Gyan
  • 34,439
  • 6
  • 56
  • 98
  • Thanks for the help. But this video shows Image on load and then slide, I want - when video starts the image should slide from right towards left and stop when it reaches to center. I want exact opposite of your output. i.e. first there will be black background and then it will slide from right to left to show my image and stop. – Sagar Malde Dec 29 '18 at 06:53
  • Corrected...... – Gyan Dec 29 '18 at 07:33
  • Hi, Can I set the Output video in 1024x576 resolution? – Sagar Malde Dec 29 '18 at 09:09
  • Add `scale=1024:576,setsar=1` after the overlay. – Gyan Dec 29 '18 at 09:25