How to Use FFmpeg: Beginner's Guide to Video & Audio Conversion
Learn FFmpeg from scratch with this beginner-friendly guide. Covers installation, basic commands, video conversion, audio extraction, compression, trimming, and batch processing with practical examples.
FFmpeg is the Swiss Army knife of multimedia. It is a free, open-source command-line tool that can convert, compress, trim, merge, split, and manipulate virtually any audio or video format in existence. Every major tech company uses it -- YouTube, Netflix, Spotify, VLC, OBS, and thousands of other applications are built on FFmpeg's libraries.
Learning FFmpeg gives you complete control over your media files. No subscription fees, no upload limits, no waiting for cloud processing. Everything happens on your machine, at full speed, with pixel-perfect control over every parameter. A single FFmpeg command can replace an entire desktop application.
The learning curve can feel steep at first, but the core concepts are simple. This guide will take you from zero to confidently converting, compressing, and processing media files with FFmpeg.
Terminal window showing FFmpeg version output and supported formats
Installing FFmpeg
macOS
The easiest method is Homebrew:
# Install Homebrew if you don't have it
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install FFmpeg
brew install ffmpeg
You should see version information and a list of enabled features. If you see "command not found," the installation did not complete correctly or FFmpeg is not in your PATH.
output_file -- The output filename (FFmpeg infers the format from the extension)
Here is the simplest possible conversion:
ffmpeg -i input.mov output.mp4
FFmpeg automatically selects appropriate codecs based on the output format. But you will almost always want to specify settings explicitly for predictable results.
Essential Conversions
Convert Video Formats
The most common task -- converting between video container formats:
# MOV to MP4 (re-encode with H.264)
ffmpeg -i input.mov -c:v libx264 -c:a aac output.mp4
# MKV to MP4 (stream copy -- no re-encoding, instant)
ffmpeg -i input.mkv -c copy output.mp4
# AVI to MP4
ffmpeg -i input.avi -c:v libx264 -c:a aac output.mp4
# WebM to MP4
ffmpeg -i input.webm -c:v libx264 -c:a aac output.mp4
The difference between -c copy (stream copy) and -c:v libx264 (re-encode) is critical:
The -vn flag means "no video" -- essential when extracting audio from video files. For more audio extraction techniques, see how to extract audio from video.
Controlling Quality: CRF, Bitrate, and Presets
CRF (Constant Rate Factor) -- The Recommended Method
CRF lets you set a target quality level. FFmpeg adjusts the bitrate automatically to maintain consistent quality throughout the video:
Available presets (fastest to slowest): ultrafast, superfast, veryfast, faster, fast, medium (default), slow, slower, veryslow.
For most use cases, medium or slow is the sweet spot. The difference between slow and veryslow is typically only 2-5% file size reduction for 2-4x longer encoding time.
Pro Tip: The CRF value has a much bigger impact on file size than the preset. Changing CRF by 6 roughly doubles or halves the file size. Changing from medium to slow preset only saves about 5-10% at the same CRF. Adjust CRF first, then fine-tune with the preset.
Using -c copy is fast but may have keyframe alignment issues (cut might start a few frames early). Re-encoding with -c:v libx264 gives precise cuts. For GUI-based trimming, use the video trimmer.
Extract Audio from Video
# Extract to MP3
ffmpeg -i video.mp4 -vn -c:a libmp3lame -b:a 192k audio.mp3
# Extract to WAV (uncompressed)
ffmpeg -i video.mp4 -vn -c:a pcm_s16le audio.wav
# Extract to AAC (copy without re-encoding, if source is AAC)
ffmpeg -i video.mp4 -vn -c:a copy audio.aac
The extract audio tool provides a drag-and-drop interface for this task.
# Convert all MOV files to MP4 (macOS/Linux)
for f in *.mov; do
ffmpeg -i "$f" -c:v libx264 -crf 23 -preset medium -c:a aac "${f%.mov}.mp4"
done
# Convert all WAV files to MP3
for f in *.wav; do
ffmpeg -i "$f" -c:a libmp3lame -b:a 192k "${f%.wav}.mp3"
done
For more batch processing techniques, the batch processing guide covers advanced workflows.
Pro Tip: You do not have to choose one or the other. Many professionals use FFmpeg for heavy lifting and online tools for quick conversions. Having both in your toolkit makes you more productive.
FFmpeg is the most powerful media conversion tool available, and its basic usage is surprisingly straightforward. The core pattern -- ffmpeg -i input [options] output -- covers 90% of what you need. Start with simple conversions, learn the CRF quality system, and gradually explore filters and batch processing as you grow more comfortable. The investment in learning FFmpeg pays off every time you need to convert, compress, trim, or manipulate a media file without uploading it to a third-party service.