FFmpeg Command-line toolkit for recording, converting, and streaming audio and video

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

PlatformCommand
Arch Linuxsudo pacman -S ffmpeg
Debian / Ubuntusudo apt install ffmpeg
Fedorasudo dnf install ffmpeg
openSUSEsudo zypper install ffmpeg
macOS (Homebrew)brew install ffmpeg
WindowsDownload 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.mp4 applies -c:v libx264 to the output, because it comes after the output is named — not to the input.
  • Order matters for timing flags. -ss before -i seeks quickly by jumping to the nearest keyframe; -ss after -i seeks frame-accurately but slower, by decoding from the start.
  • -c means codec, :v/:a/:s pick the stream type. -c:v sets the video codec, -c:a the audio codec, -c copy means "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.