Filmora
Filmora - AI Video Editor
Edit Faster, Smarter and Easier!
OPEN
Wondershare AI Image to Video Generator
Transfer Image to Video Easily
  • Generate any trendy videos you want by image upload
  • Versatile video template for your choice
  • Customize video and add effects or audio effects with clicks.

How to Use FFmpeg for Image to Video Conversion [A Beginner's Guide]

James Hogan
James Hogan Originally published Dec 19, 24, updated Dec 30, 24

Have you ever tried using FFmpeg to make videos from images? Maybe you want to merge product images to create marketing videos or make learning more enjoyable for your students. While many video editing tools are available, FFmpeg is a flexible, powerful command-line tool that offers control over video and audio processing.

command line image conversion

FFmpeg stands for Fast Forward Moving Picture Experts Group. It is an open-source tool; this means it is open and accessible to everyone and is constantly updated by a large community of developers contributing to it. FFmpeg might look intimidating at first glance, but rest assured that you can effortlessly convert your images to videos with some guidance. This tool supports every video and audio format.

So, whether you’re a complete novice or have previous experience using FFmpeg, this article will show you methods to change FFmpeg pictures to images and the basic commands for converting, optimizing, and customizing image-to-video conversion.

In this article
    1. Installing FFmpeg
    2. Use FFmpeg to Convert Images to Videos
    3. Naming Image Sequences

Part 1: How to Convert Images Using FFmpeg to Create a Video

how to use ffmpeg

Installing FFmpeg

Installing the tool is the first step in using FFmpeg for image to video conversion. Some operating systems have FFmpeg installed by default, so if you’re using Ubuntu, you probably already have it on your computer.

To check if FFmpeg is installed, enter this command prompt.

ffmpeg -version

If the command gives you version details, it means FFmpeg is installed correctly. If it does not, install the copy of FFmpeg that suits your operating system from the website—if you’re using Windows.

For Mac users, the easiest way to install FFmpeg is through the Mac package manager, Homebrew.

As Homebrew gets installed on your computer, you can easily install FFmpeg using Homebrew. Paste this command in the terminal and hit return.

brew install FFmpeg

Use FFmpeg to Convert Images to Videos

convert images with ffmpeg

Basic Command for Single Image Conversion

To create a static video with a single image, use this command.

ffmpeg -loop 1 -i input.jpg-c:v libx264 -t 10 output.mp4

The -loop 1 keeps the image repeated on a loop while the - t 10 sets the video duration to 10. You can adjust the number depending on your desired video length.

Command for Image Sequence Conversion

When using FFmeg for image sequence to video conversion, ensure the pictures are correctly named sequentially and numerically. You can make videos from an image sequence in two ways: by using format specifiers, the glob pattern, or the FFmpeg concat demuxer.

Using Format Specifiers

If your image sequence is sequentially named, format specifiers indicate which images FFmpeg should use. To use format specifiers, copy and paste this command.

ffmpeg -framerate 1 -i image%d.jpg-c:v libx264 -r 30 output.mp4

-i image%d.jpgis the input image sequence, where %d represents the numerical sequence in the filenames. It searches for the images with the same name as the input image sequence, setting the image with the lowest digit as the starting image. Add -start_number n to the above command to specify the start image. If you use -start_number_8, the starting image will be image8.jpg.

-framerate 1 defines how many pictures are read per second, in this case, 1 photo per second. Not inputting a frame rate will set the default framerate to 25, which is 25 pictures read per second.

-r 30 represents the output video’s framerate. If the framerate of the input images is not defined, it is set to a default of 25.

-c:v libx264 is the codec used to encode the video. To increase the compatibility of your video for different players, add -pix_fmt yuv420p to the command prompt. It should look something like this.

ffmpeg -framerate 1 -i image%d.jpg-c:v libx264 -r 30 -pix_fmt yuv420p output.mp4

command line image conversion

Using Glob Pattern

The glob pattern allows you to specify your desired input images.

ffmpeg -framerate 1 -pattern_type glob -i '.jpg' -c:v libx264 -r 30 -pix_fmt yuv420p output.mp4

The pattern .jpgselects all the.jpgfiles in the current directory. This pattern is useful if your images are named sequentially but not numerically.

Using the concat demuxer

The concat demuxer links images together in a series. First, create a file input.txt and add the images you need for the video. Specify a duration for which each photo will be displayed, like this.

file 'image01.jpg'

duration 1

file 'image02.jpg'

duration 1

file 'image03.jpg'

duration 1

Use this command prompt to get a video slideshow output of these images.

ffmpeg -f concat -i input.txt -c:v libx264 -r 30 -pix_fmt yuv420p output.mp4

naming image sequence

Naming Image Sequences

When naming the images,

-i image%d.jpgis for images named image1.jpg.

-i image%02d is for two-sequences like image01.jpg.

-i image%03d.jpgis for three-sequence images like image001.jpg.

Stick to the right naming format and ensure it matches the format specified in the command. If there are inconsistencies, you may get an error message.

Part 2. Issues You Might Encounter While Converting Images to Video Using FFmpeg

Here are common issues you may face when using FFmpeg for image to video conversion and how to address them.

FFmpeg’s Active Development

As an open-source tool, FFmpeg is constantly changing with frequent updates. So, there might be occasional bugs that affect your video editing process. Ensure you’re using the latest version of FFmpeg. If you experience any issues, go through FFmpeg’s official documentation or join communities to get help from more experienced users.

handling issues with conversion

Incorrect File Naming

FFmpeg relies on precise file naming for image sequence conversions. An incorrect name or missing name or number sequence can cause errors. Ensure that all names are in a consistent sequential order, as explained in the previous section. If you’re working with many images, consider using bulk renaming tools to simplify things.

Path and Command Errors

It’s also common to have typo errors in your commands. However, this can prevent your command prompt and input files from creating your desired output. Double-check your command prompts to avoid syntax errors. Also, consult the documentation if you’re unsure of anything.

Pixel Format Compatibility

FFmpeg’s default settings or your commands might not produce videos that are compatible with all media players. Add -pix_fmt yuv420p to your command prompt to ensure maximum compatibility with common players and devices.

ffmpeg -framerate 1-i image%d.jpg-c:v libx264 -pix_fmt yuv420p output.mp4

Part 3: How to Customize Converted Videos With FFmpeg

customize your video

To Add an Audio Track to a Slideshow

Copy and paste this command.

ffmpeg -framerate 1 -pattern_type glob -i '.jpg' -i audio.mp3 \-shortest -c:v libx264 -r 30 -pix_fmt yuv420p output.mp4

- i audio.mp3 adds a second input file, an audio file. -shortest sets the length of the output video to the shortest length of the two input files (image and audio). If the audio file is longer than the image sequence, this command will set the length of the output audio to the image sequence length.

To Add Text Overlays and Watermarks to FFmpeg Converted Videos

If you want to add a text or watermark to your video, save it as an image in JPG or PNG format. Then, use this command prompt.

Ffmpeg -i input.mp4 -i watermark.png-filter_complex "overlay=10:12" output.mp4

-i input.mp4 is the input video file, while -i watermark.pngis the input (watermark or text) image file. -filter_complex "overlay=10:12" overlays the input image on the video at specific coordinates (10,12), and output.mp4 is the final output video.

customize video

To adjust watermark transparency, use the blend filter using this command.

ffmpeg -i input.mp4 -i watermark.png-filter_complex"[0:v][1:v]overlay=10:12:format=auto,blend=all_mode='overlay':all_opacity=0.7" output.mp4

all_opacity controls the watermark transparency. 0.7 means 70% opacity. You can adjust the figure to achieve your desired watermark opacity.

To Adjust Converted Video Speed to Create Time-Lapse or Slow Motion Effects on FFmpeg

Action Command Prompt
To speed up video by 2x ffmpeg -i input.mp4 -filter:v "setpts=0.5PTS" -an output.mp4
To speed up audio by 2x ffmpeg -i input.mp3 -filter:a "atempo=2.0" output.mp3
To speed up both video and audio ffmpeg -i input.mp4 -vf "setpts=0.5PTS" -af "atempo=2.0" output.mp4
To slow down video by 2x ffmpeg -i input.mp4 -filter:v "setpts=2.0PTS" -an output.mp4
To slow down audio by 2x ffmpeg -i input.mp3 -filter:a "atempo=0.5" output.mp3
To slow down both audio and video ffmpeg -i input.mp4 -vf "setpts=2.0PTS" -af "atempo=0.5" output.mp4

-filter:v applies a video filter to the input video while setpts=0.5PTS makes the output video play 2x faster than the original and atempo=2.0 doubles the speed of the audio to match the speed of the output video. setpts=2.0PTS makes the output video play 2x slower than (half the speed of) the original video, and atempo=0.5 makes the audio twice as slow as the original audio . -vf applies a video filter while -af applies the audio filter.

customize your video

To Change the Resolution of FFmpeg Videos Made from Images

To scale/resize/change video resolution, use this command prompt's scale filter.

ffmpeg -i input.mp4 -vf scale=$w:$h < encoding-parameters> output.mp4

$w and $h are the intended video width and height. For example, the—vf scale=640:480 command changes your video resolution to 480p.

Bonus: A Non-Technical Alternative to FFmpeg

While FFmpeg is a powerful tool, its command-line editing interface can be overwhelming, especially for new users or people without technical knowledge. The various command prompts, syntax, and file directory organization can be stressful and time-consuming. In cases like this, users opt for an easier, more intuitive, and non-technical tool like Wondershare Filmora.

wondershare filmora

Filmora is video editing software that allows users to indulge their creativity without prior skill or expertise. It takes photo and video editing to a new level with easily accessible effects and a media library you can work with. Filmora combines photos seamlessly to create beautiful videos you can edit and customize further to your preference.

Here is how to convert your images to a video using Filmora.

Step 1: Install Filmora from the Google Play or Apple Store. Then, launch the application on your mobile device.

Get Started for Free
Get Started for Free

Step 2: Open the Image to Video tool on the Filmora home screen.

launch image to video tool

Step 3: Upload the image from which you want to generate a video. Describe the kind of video you want and hit Generate.

adjust duration

Save your video. If you want to explore more of Filmora’s features, click Edit.

add music

You can customize the video by clicking Audio on the toolbar to add sound effects and voiceovers or use Filmora’s AI Audio feature.

select music

You can generate music with Filmora’s AI Audio by selecting your preferred tone, theme, and duration. Once you’re done, hit Generate. Then, export the finished video to your mobile device.

filmora’s ai audio

Conclusion

Whether you’re an experienced editor or not, converting images with photos is a breeze, especially if you have the right tools. FFmpeg is an excellent tool for achieving this, with command-line prompts for every action, including further edits like adding audio clips and overlays and resizing the video/changing its resolution.

However, Filmora is a great choice for users who find FFmpeg image-to-video conversion too technical or those who need more customization options with less processing time. You can explore Filmora’s array of tools by installing the app on your mobile phone. You can create videos from photos, add effects and background music, and export your edited video in your preferred resolution.

Get Started for Free
Get Started for Free
James Hogan
James Hogan Dec 30, 24
Share article: