To make a video from numbered images, FFmpeg reads the files in order and shows each one for a set time. The frame rate is the number of video frames shown each second. One FFmpeg command creates a basic MP4 slideshow. Other options set how long each image appears, the video dimensions, and the audio.
For a narrated explainer, explainroo uses a coding agent and FFmpeg to turn a description into an MP4 with narration and drawn scenes. The commands below show how to make a video from image files.
Make a video from numbered images
Put the images in one folder and name them with consecutive numbers, adding zeros at the start to keep the names the same length. For example: img001.png, img002.png, and img003.png. Then run:
ffmpeg -framerate INPUT_FPS -i img%03d.png -c:v libx264 -pix_fmt yuv420p output.mp4
The pattern %03d tells FFmpeg to look for a three-digit number in each filename. Replace INPUT_FPS with the input frame rate you want. The number of images and the frame rate determine the video duration. The -pix_fmt yuv420p setting uses a pixel format supported by many video players. This image-sequence command pattern is a common starting point.
Make the filename pattern match your files. For files named frame0001.jpg, use frame%04d.jpg. If the sequence starts at a number other than 1, specify that number:
ffmpeg -framerate INPUT_FPS -start_number 1 -i frame%04d.jpg -c:v libx264 -pix_fmt yuv420p output.mp4
If needed, change 1 to the first number in your sequence. When you omit -framerate, FFmpeg uses 25 frames per second. Set the frame rate to control the video duration. The image-sequence naming examples show why the number of digits matters.
Set image duration and video size
The input frame rate sets how long each still image appears. To show each image for two seconds, set the rate to one image every two seconds:
ffmpeg -framerate 1/2 -i img%03d.jpg -vf "scale=WIDTH:HEIGHT:force_original_aspect_ratio=decrease,pad=WIDTH:HEIGHT:(ow-iw)/2:(oh-ih)/2" -r OUTPUT_FPS -c:v libx264 -pix_fmt yuv420p output.mp4
Here, -framerate 1/2 sets the image sequence to half a frame per second, so each image appears for two seconds. Replace WIDTH, HEIGHT, and OUTPUT_FPS with your output dimensions and frame rate. The scale and pad filters fit each image inside the frame without changing its proportions. Padding fills any remaining space.
Use FFmpeg’s concat demuxer to give each image a different display time. It reads a text file listing the images and how long to show each one. FFmpeg ignores the last duration in the list unless you repeat the final image. The concat duration example shows this workaround.
Add audio to the slideshow
Add the audio file as a second input. This example shows each image for two seconds and ends the video when either input ends:
ffmpeg -framerate 1/2 -i img%03d.jpg -i music.mp3 \
-vf "scale=WIDTH:HEIGHT:force_original_aspect_ratio=decrease,pad=WIDTH:HEIGHT:(ow-iw)/2:(oh-ih)/2" \
-r OUTPUT_FPS -c:v libx264 -pix_fmt yuv420p -c:a aac -shortest output.mp4
-shortest stops encoding when the image sequence or audio ends first. To set a fixed output length, use -t with the desired duration. Each FFmpeg option applies to the next input or output file. Put input options before the input file and output options before the output filename, as described in the FFmpeg command documentation.
For a video with one still image and audio, add -loop 1 before the image input. This makes FFmpeg display the image until the audio ends. Without looping, the image produces only one video frame.
Make a narrated explainer with explainroo
For a narrated explainer or product demo, explainroo makes a better fit than a plain slideshow. It is a free, open-source kit under the MIT license. A coding agent writes the narration and scene instructions. explainroo then renders the video on your computer and uses FFmpeg to create the MP4.
To try explainroo, open a coding agent that can run shell commands. Options include Claude Code, Codex, Pi, OpenCode, and Gemini CLI. Paste this prompt and replace the bracketed text with your topic:
Make me a short explainer video about [your topic]. Use explainroo for it: set it up, read its AGENTS.md, and follow the steps.
The agent sets up explainroo, creates and checks the video, then provides the MP4. It writes script.md for the narration and scenes.js for drawings and other visuals. The narration uses the open Kokoro voice model. Whisper marks when each word is spoken, so scenes appear at the right time. The agent also checks scene stills, text layout, and speech for errors.
To make a product demo, tell the agent which product to show and where to find its code or website. explainroo rebuilds the screens from that source and adds a pointer that clicks and types along with the narration. See the explainroo documentation for setup and project details.