Create a Movie from Images with Ffmpeg

Ffmpeg by John van Sickle is a powerful tool that puts control into the hands of the artist.

‘…it’s a project containing a command line suite of tools that allow someone to convert quite literally any piece of media to any other piece of media. It includes an entire library of codecs that can be used to wrangle just about any piece of video. It includes sub-components that allow for just about infinite flexibility.’

-Duke University

Full disclosure, I’m new to ffmpeg and far from expert, but wanted to share what I’ve learned so far. This tutorial assumes you’ve already got ffmpeg installed for your Linux distro, and that you have some images ready to append into a movie.

Image file formats and naming conventions

  • Images must have no spaces in the filename and be numbered sequentially starting from 0 or 1. If the sequence starts on a number other than 0 or 1, the start number flag must be used. See below.
  • All image names must have the same number of numeric digits, i.e. 001, 01 or 1

Open image folder in a Terminal window

Right-click on the image folder name and select Open in Terminal

Create the movie file

At the $ prompt, enter the ffmpeg command as follows, editing as necessary:

$ ffmpeg -framerate 24 -i flames%2d.png -fs 880400000 testmovie.mp4
  • framerate = 24 fps
  • input filename is ‘flames’ with 2 numeric digits
  • max output filesize is +880MB. I’ve found it’s a good idea to give it a high top end or the process may not complete.

Here is the same command with -start_number and -pix_fmt flags added:

$ ffmpeg -start_number 15 -framerate 24 -i flames%2d.png -fs 880400000 -pix_fmt yuv420 testmovie.mp4
  • start number = 15. Edit as needed.
  • The -pix_fmt yuv420p flag must be specified whenever Mac compatibility is desired.

Play the movie

Open the file with VLC Player, or use ffplay from the command line:

$ ffplay -loop 0 testmovie.mp4

Spacebar to pause/resume playback, Close window or Esc to stop.

Here is a scrolling flames loop output with ffmpeg.

To get info about your movie:

$ ffmpeg -i testmovie.mp4

Further reading:

Questions? Comments? Concerns? Leave them in a comment and I’ll do my best to address them. 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s