ffmpeg slideshow with crossfade

You can retime the frames before applying the filter:

ffmpeg -i IMG_%3d.jpg  -vf "setpts=N/0.5/TB,framerate=fps=25" -codec:v mpeg4 out.mp4

Update: The framerate filter appears to be tied to the input framerate at ingest, so an alt method using pipes

ffmpeg -framerate 0.5 -i IMG_%3d.jpg -vf fps=2 -f nut - | ffmpeg -f nut -i - -vf framerate=25 -c:v mpeg4 out.mp4

A single-line workaround:

ffmpeg -i IMG_%3d.jpg -vf zoompan=z=1:d=4:s=WxH:fps=2,framerate=25 -c:v mpeg4 out.mp4

where W and H are replaced with the input dimensions.


I'd like to summarize the solution:

ffmpeg -i IMG_%3d.jpg -vf zoompan=d=(A+B)/B:s=WxH:fps=1/B,framerate=25:interp_start=0:interp_end=255:scene=100 -c:v mpeg4 -maxrate 5M -q:v 2 out.mp4

where A is the duration in seconds how long each picture is shown (without crossfade duration), B is the crossfade duration in seconds, and WxH is the size of the output video.