Getting Started
This page covers installing FFmpeg and the command structure every invocation shares, so the examples on later pages make sense at a glance.
1. Install FFmpeg
| Platform | Command |
|---|---|
| Arch Linux | sudo pacman -S ffmpeg |
| Debian / Ubuntu | sudo apt install ffmpeg |
| Fedora | sudo dnf install ffmpeg |
| openSUSE | sudo zypper install ffmpeg |
| macOS (Homebrew) | brew install ffmpeg |
| Windows | Download a build from gyan.dev and add it to PATH |
Verify it installed correctly, and see which codecs your build supports:
ffmpeg -version
ffmpeg -codecs # long list of every encoder/decoder available
2. Anatomy of an ffmpeg command
Every invocation follows roughly the same shape:
ffmpeg [global opts] -i input [input opts] [output opts] output
A few rules that explain most confusing behavior:
- Options apply to the file that follows them.
-i in.mp4 -c:v libx264 out.mp4applies-c:v libx264to the output, because it comes after the output is named — not to the input. - Order matters for timing flags.
-ssbefore-iseeks quickly by jumping to the nearest keyframe;-ssafter-iseeks frame-accurately but slower, by decoding from the start. -cmeans codec,:v/:a/:spick the stream type.-c:vsets the video codec,-c:athe audio codec,-c copymeans "copy every stream without re-encoding."
3. Run your first conversion
ffmpeg -i input.mov output.mp4
FFmpeg picks sensible default codecs for the output container unless you
override them with -c:v/-c:a. Progress prints to stderr as it runs; add
-hide_banner -loglevel error to quiet the build/config banner and most
status noise.
4. Inspect a file before editing it
ffprobe input.mp4
ffprobe -v error -show_format -show_streams input.mp4
ffprobe ships alongside ffmpeg and prints container, codec, resolution,
duration, and bitrate without touching the file. Continue to
Common Operations for transcoding, trimming,
and extracting audio, or jump straight to the
Command Reference for a cheat sheet.