guide-ffmpeg

How to create an FFmpeg video from images in just 5 easy steps?

Public Space

4 minutes


How to Easily Create a Time-Lapse Video from Photo Sequences with FFmpeg


Wondering how to effortlessly turn a series of photos into a video? In this guide, we'll demonstrate converting image sequences into videos to craft time-lapses using FFmpeg, a robust command-line utility for processing images and videos.


FFmpeg is an exceptional command-line tool that facilitates a myriad of operations with images and videos. Through FFmpeg, you can transform a sequence of pictures into a video file. If you're eager to learn how to generate a video from pictures with FFmpeg, I'm here to guide you.


Creating an FFmpeg output stream from a set of images is straightforward. I'll explain how to achieve this with ease and clarity for your comprehension.


Cast aside your concerns and delve into the process of making a video from images with FFmpeg.



Install FFmpeg


First and foremost: install FFmpeg. The simplest method is through the Mac package manager Homebrew. If Homebrew isn't already installed, don't stress; another approach is to open a terminal and copy-paste the following text into the terminal window, then press return.

bash "/usr/bin/ruby -e \"$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)\""


Subsequently, Homebrew will commence the installation process. Now you can install FFmpeg using Homebrew with ease. Open a terminal again, copy this next text, paste, and then hit return.

bash brew install ffmpeg

Everything should proceed smoothly, and FFmpeg will install swiftly!


Preparing the Images


To ensure your final output file meets your needs, proper preparation of the input files is pivotal. FFmpeg interprets and sequences image files using pattern matching. Therefore, maintaining the correct order of your images is crucial.


FFmpeg supports nearly three distinct patterns. Let’s review these patterns:

  • Filenames with leading zeros, for instance, filename-%03d.png corresponds to images ranging from filename-001.png to filename-999.png.

  • Filenames without leading zeros, like filename-%d.png, corresponds to images ranging from filename-1.png to filename-999.png.

  • Prefixes without a consistent pattern, such as filename-*.png, corresponds to any image beginning with filename-.

Adhering to a sequential numbering order isn't necessary. Should you opt for this approach, an additional parameter will be required for the image-to-video conversion, which we'll explain later.


Remember, if any filename includes a ‘%’ character, it's not a problem. Simply insert “%%” in place of the ‘%’ character to prevent any complications!

If you've prepared all image files for creating a video stream with FFmpeg, let's proceed on how to generate it.

Create a Video From Images


With the source image files organized in the correct sequence and naming, move forward! Execute the command below in the terminal:

bash ffmpeg -i img-%02d.png video_name.avi


FFmpeg will search for image files named ‘img-’ followed by a two-digit number. In the command section, you'll need to specify a search pattern for FFmpeg to locate the image sequence.

The specified pattern should match the naming convention you've chosen when preparing your images.

Setting The Frame Rate


While compiling a video from a sequence of images, frame rate is a critical parameter. Frame rate refers to the count of frames per second. It's important to note that the ideal frame rate hinges on the character of your source images.

For instance, with stop-motion animation, a frame rate of 25 fps is typically best.


Conversely, for a slow-paced slideshow, you'd prefer a reduced frame rate, such as 2 fps. Here's a reminder: overlooking to set a suitable frame rate will result in an output that falls short of your vision. You might encounter unexpected outcomes in your final video.

To output a video file at a 5 fps frame rate, input the command below:

bash ffmpeg -framerate 5 -i img-%02d.png video.avi



Changing the Video Format


In the examples above, I mentioned using the avi format for the final product. For your flexibility, FFmpeg supports an extensive assortment of video formats. Alter the output video format by simply changing the file extension of the end product.

To discover the supported video formats available:

bash ffmpeg -encoders


Now you know how to craft a video from image sequences with FFmpeg. This article has discussed various settings that enable you to convert image series into a video stream. By adhering to these instructions, you can produce high-caliber videos that align with your ambitions. Ultimately, the quality of your video relies on the excellency and arrangement of your input images.

With the knowledge of creating videos from images using FFmpeg, begin transforming your pictures into remarkable time-lapses!


For more sophisticated time-lapse photography, consider using Enlaps' Tikee cameras. Their superior imaging performance guarantees professional-grade results for all your time-lapse endeavors. For additional information, be sure to check out Enlaps.


Frequently Asked Questions

How to combine images into a video?
To integrate images into a single video using FFmpeg, execute the command ffmpeg -i img-%02d.png video_name.avi. This identifies image files fitting the pattern img-XX.png and compiles them into a video named video_name.avi.


How to overlay an image on a video in FFmpeg?
To superimpose an image onto a video with FFmpeg, employ the command: ffmpeg -i video.mp4 -i overlay.png -filter_complex "overlay=10:10" output.mp4. This arranges the image overlay.png at coordinates (10,10) on the video video.mp4.


Can FFmpeg convert to MP4?
Indeed, FFmpeg is capable of converting video material to MP4. Use the command ffmpeg -i inputfile outputfile.mp4, replacing inputfile with your source video and outputfile.mp4 with your preferred output name.


How do I turn a picture into a moving video?
To turn a static image into a dynamic video with FFmpeg, apply effects like zoom or fade. For instance, the command ffmpeg -loop 1 -i image.png -vf "zoompan=z='zoom+0.001':d=125" -t 5 output.mp4 generates a 5-second video where the image progressively zooms in.


How do I insert an image into FFmpeg?
Inserting an image into a video in FFmpeg is done via the overlay filter. Execute the command ffmpeg -i video.mp4 -i image.png -filter_complex "overlay=0:0" output.mp4 to place the image in the video's top-left corner.


Does FFmpeg work on images?
Absolutely, FFmpeg excels with images. It can alter, merge, and convert images into videos, as well as extract frames from video files, making it a versatile image manipulation tool.


How to extract images from a video using FFmpeg?
To extract stills from a video, utilize the command ffmpeg -i video.mp4 -vf fps=1 image-%03d.png. This draws one frame every second from video.mp4 and saves them as numbered images like image-001.png, image-002.png, and onward.

Bulletin d'information

Subscribe for our newsletter

Get the latest news, exclusive offers, use cases, and expert advice by signing up now!

Need a personalized demonstration

To better understand the Tikee solution and to learn more before getting started, we offer you the opportunity to schedule a one-on-one appointment, via video conference.

Contact Us

Before contacting us, have you checked our FAQ?

You might find your answer there.

Contact Us

Before contacting us, have you checked our FAQ?

You might find your answer there.

Contact Us

Before contacting us, have you checked our FAQ?

You might find your answer there.

Contact us

account icon
USA ($)
USA ($)
USA ($)