FFmpeg is a widely used open-source tool for converting and processing video and audio. You run it from the command line, and many programs with a graphical interface use it behind the scenes.
What Is FFmpeg?
The “FF” in FFmpeg originally meant “Fast Forward”. Its founder, Fabrice Bellard, said so on the ffmpeg-devel mailing list. FFmpeg is a set of libraries and command-line tools that encode, decode, convert and stream video, audio and subtitles.
- Supported formats: MP4, MKV, WebM, MOV, AVI, GIF, and over 100 more
- Supported codecs: H.264, H.265, AV1, VP9, AAC, MP3, Opus, and more
- Platforms: Windows / macOS / Linux
Installation
Windows
ffmpeg.org does not offer Windows builds itself. Download one from a provider linked on the official download page, such as gyan.dev, and extract it to a folder such as C:\ffmpeg\. Then add the bin folder that contains ffmpeg.exe to the PATH environment variable. PATH is the list of folders Windows searches when you type a command, so once bin is on it, ffmpeg works from any folder. bin is usually inside a folder named after the version (such as ffmpeg-8.1-full_build), so check where it is before you add it.
Open a new Command Prompt and run this. If it prints a version number, FFmpeg is installed.
# Verify installation
ffmpeg -version
macOS (Homebrew)
Homebrew is a package manager for macOS. Once it is installed, run:
brew install ffmpeg
Ubuntu / Debian
sudo apt update && sudo apt install ffmpeg
Basic Command Syntax
An FFmpeg command is written in the order input → processing → output:
ffmpeg -i input_file [options] output_file
| Element | Description |
|---|---|
-i |
Marks the input file |
| Options | Encoding settings, filters and so on |
| Output file | Its extension decides the output format |
Common Commands
Convert video format
# Convert to MP4 (codecs auto-selected)
ffmpeg -i input.mov output.mp4
# Reliable conversion with H.264 + AAC
ffmpeg -i input.mkv -c:v libx264 -pix_fmt yuv420p -c:a aac output.mp4
Compress a video
# CRF mode (23 is standard; higher means more compression)
ffmpeg -i input.mp4 -c:v libx264 -crf 23 -preset fast output.mp4
Try it in your browser: video compression tool. For the options, see the compression guide.
Extract audio
# Extract as MP3
ffmpeg -i input.mp4 -vn -c:a libmp3lame -b:a 192k output.mp3
# Extract as AAC
ffmpeg -i input.mp4 -vn -c:a aac -b:a 128k output.aac
Try it in your browser: audio extraction tool.
Convert to GIF
# High-quality GIF (using palettegen)
ffmpeg -ss 0 -t 5 -i input.mp4 -vf "fps=15,scale=480:-1:flags=lanczos,palettegen" palette.png
ffmpeg -i input.mp4 -i palette.png -ss 0 -t 5 -lavfi "fps=15,scale=480:-1:flags=lanczos[x];[x][1:v]paletteuse" output.gif
Try it in your browser: GIF conversion tool.
Extract a thumbnail
# Save a single frame at a given timestamp
ffmpeg -i input.mp4 -ss 00:00:05 -vframes 1 thumbnail.jpg
Try it in your browser: thumbnail extraction tool.
Normalize loudness
# Normalize to -14 LUFS (video is copied; without -ar 48000 the audio comes out at 96 kHz)
ffmpeg -i input.mp4 -af loudnorm=I=-14:TP=-1.5:LRA=11 -ar 48000 -c:v copy output.mp4
Try it in your browser: volume adjustment tool.
Try It in Your Browser Right Now
These free tools run FFmpeg in your browser, so there is nothing to install.
| Task | Tool |
|---|---|
| Make videos smaller | Video compression tool |
| Convert to GIF | GIF conversion tool |
| Extract audio | Audio extraction tool |
| Grab a thumbnail | Thumbnail extraction tool |
| Adjust loudness | Volume adjustment tool |
FAQ
Q. I get “ffmpeg command not found”
If ffmpeg -version gives an error, FFmpeg is not installed yet or its folder is not on PATH. On Windows, add the bin folder to PATH as described above, then open a new Command Prompt and try again.
Q. The converted file won’t play
Check the output file’s extension. An .mp4 file with H.264 video and AAC audio plays on the most devices. This command converts to that combination (-pix_fmt yuv420p picks the color format that almost every player supports, and -movflags +faststart lets playback start before the whole file has loaded):
ffmpeg -i input.avi -c:v libx264 -pix_fmt yuv420p -c:a aac -movflags +faststart output.mp4
Q. Processing is too slow
Try -preset ultrafast, or encode on the GPU. At the same -crf, ultrafast makes a much larger file: about 5× the medium size in the compression test. For GPU encoding, see the hardware encoding guide.