How to Create a Video from Images and Audio using FFmpeg (Step-by-Step Guide)

Learn how to easily create a video from images and add audio using FFmpeg. This step-by-step tutorial covers the exact commands you need to combine multiple images with background audio, making it perfect for slideshows, presentations, and content creation.

What You’ll Need

  • FFmpeg installed on your system (Windows, macOS, or Linux).
  • A set of images you want to turn into a video (e.g., image1.jpg, image2.jpg …).
  • An audio file (e.g., music.mp3) for background sound.

FFmpeg Command to Create a Video from Images + Audio

ffmpeg -framerate 1/5 -pattern_type glob -i "*.png" -i music.mp3 -c:v libx264 -vf "fps=25,format=yuv420p" -c:a aac -b:a 192k -movflags +faststart yourVideo.mp4

Explanation:

  • -framerate 1/5 → each image stays on screen for 5 seconds.
  • -pattern_type glob -i "*.png" → loads all .png images in the folder.
  • -i music.mp3 → adds background audio.
  • -c:v libx264 → uses H.264 video codec.
  • -vf "fps=25,format=yuv420p" → sets smooth playback at 25 fps and ensures compatibility with most players.
  • -c:a aac -b:a 192k → encodes audio in AAC with good quality.
  • -movflags +faststart → makes the video ready for fast web streaming.
  • yourVideo.mp4 → final video file name.

Tips & Variations

  • Change 1/5 to 1/2 if you want each image to display for 2 seconds.
  • Replace "*.png" with "*.jpg" if your images are JPEG.
  • Swap music.mp3 with narration.wav or any audio file you prefer.
  • Export to other formats like .mkv or .mov if needed.

Final Thoughts

With just a single FFmpeg command, you can quickly transform a folder of images into a video and sync it with background music or narration. This method is lightweight, flexible, and works across all major operating systems.

Experiment with frame rates, audio tracks, and output settings to match your project needs — whether it’s a slideshow, presentation, or content for social media. Once you get comfortable, FFmpeg can become your go-to tool for fast and powerful video creation.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *