Sachin Kainth
Sachin Kainth

Reputation: 46760

Using FFMPEG to use mutiple static images

I know how to combine a single image with an mp3 to create a video like this

"ffmpeg.exe" -loglevel 0 -loop 1 -i c:\path\foo.jpg -i c:\path\foo.mp3 -c:v libx264 -pix_fmt yuv420p -crf 0 -c:a copy -shortest c:\path\foo.mkv

How can I make ffmpeg create a video using multiple images that it cycles through at regular intervals, or even randomly? Basically I want to use more than one image in a video rather than just 1.

Upvotes: 0

Views: 188

Answers (1)

Roland Smith
Roland Smith

Reputation: 43533

You can use the examples from the wiki to create a slideshow from images.

For example:

ffmpeg -framerate 1/3 -pattern_type glob -i '*.jpg' -c:v libx264 out.mp4

Keep in mind that all images must have the same size! In my test the resulting mp4 file was approximately the same size as the sum of the input files;

> du out.mp4
768 out.mp4
> du -c *.jpg|grep total
648 total

Note that photos from a digital camera are generally a lot bigger than even a HD movie, so you might want to scale the images. This can be done using the scale filter, or with an external program like ImageMagick. In my example I scaled the images before making a movie out of them.

Upvotes: 1

Related Questions