Member-only story
Introduction
In multimedia processing, the need often arises to convert a collection of photos into a cohesive video. This can be useful for creating slideshows, time-lapse videos, or simply merging a series of images into a single video file. FFmpeg, a powerful multimedia framework, provides a convenient command-line interface to achieve this task.
In this blog post, we’ll explore few examples of using FFmpeg to create videos from photos — one resulting in a WebM video and the other in an MP4/MKV video.
Prerequisites
Before getting started, ensure you have FFmpeg installed on your system. You can install it using your package manager. For example, on Debian/Ubuntu systems:
sudo apt-get install ffmpeg
Creating a WebM Video
To create a WebM video from a series of JPEG images, use the following FFmpeg command:
ffmpeg -framerate 1/3 -pattern_type glob -i ‘files*.jpeg’ -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis output.webm
Let’s break down the command:
-framerate 1/3
: Specifies the frame rate of the output video. In this case, one frame every three seconds.-pattern_type glob -i ‘files*.jpeg’
: Uses a glob pattern to match all JPEG files starting with “files” in the current directory.-c:v libvpx
: Chooses the libvpx codec for video…