Introduction
FFmpeg is one of the most powerful open-source tools for handling multimedia files. Whether you need to convert, compress, record, or stream audio and video, FFmpeg is the go-to command-line utility trusted by developers, content creators, and even large companies.
It supports almost every audio and video format, making it an essential tool in video editing, streaming, and automation pipelines.
Brief History
The name FFmpeg comes from:
Since its release, FFmpeg has become a backbone for many popular software and platforms including VLC Media Player, YouTube, and OBS Studio.
Why Use FFmpeg?
Convert videos between formats (MP4, MKV, AVI, MOV, etc.)
Extract or convert audio (MP3, WAV, AAC, etc.)
Compress media without losing much quality
Capture screenshots from videos
Stream audio/video over networks
Automate video/audio processing in scripts
Installation
On Linux (Fedora/Ubuntu):
sudo dnf install ffmpeg # Fedora
sudo apt install ffmpeg # Ubuntu/Debian
On macOS (with Homebrew):
brew install ffmpeg
On Windows:
Download builds from ffmpeg.org
Add ffmpeg/bin to your PATH
Basic Commands to get started
1. Video-based Commands
Convert a video to another format
ffmpeg -i input.mp4 output.mkv
It converts an MP4 file into MKV format.
Extract audio from a video
ffmpeg -i video.mp4 -q:a 0 -map a audio.mp3
Takes the audio from a video and saves it as MP3.
ffmpeg -i input.mp4 -vcodec libx265 -crf 28 output.mp4
Uses the H.265 codec with CRF (quality factor) for compression.
Capture a frame (screenshot) from a video
ffmpeg -i video.mp4 -ss 00:00:05 -vframes 1 screenshot.png
Takes a screenshot at the 5-second mark.
Record screen (Linux example)
ffmpeg -video_size 1920x1080 -framerate 30 -f x11grab -i :0.0 output.mp4
Records the desktop screen.
2. Image-based Commands
ffmpeg -i input.png output.jpg
In the same way we can convert to other types too.
Convert multiple images into a video
ffmpeg -framerate 24 -i img%03d.png output.mp4
If you have files like img001.png, img002.png..., this creates a video at 24 fps.
Extract all frames from a video as images
ffmpeg -i video.mp4 frame_%04d.png
It saves every frame as an image: frame_0001.png, frame_0002.png...
ffmpeg -i input.png -vf scale=800:600 resized.png
It resizes an image to 800×600 pixels.
Convert image format batch (all PNG → JPG)
for f in *.png; do ffmpeg -i "$f" "${f%.png}.jpg"; done
Converts all .png files in a folder into .jpg. (Linux/Mac shell loop)
Conclusion
FFmpeg may seem intimidating at first because it’s command-line based, but once you learn a few commands, you can convert, compress, and manipulate media effortlessly.
It’s free, fast, and reliable, so no wonder it powers some of the biggest platforms in the world.