“I’ve heard of FFmpeg, but what can it actually do?” — If you work with video or audio in any capacity, FFmpeg is relevant to you. FFmpeg is a free, open-source multimedia processing engine that handles conversion, compression, trimming, audio extraction, GIF creation, and nearly everything else you’d ever need — all in a single command. This article gives you the full picture in 10 minutes.

Tested with: FFmpeg 6.1 (ubuntu-latest / GitHub Actions CI-validated)


What You Will Learn

  1. What FFmpeg is (official definition and key traits)
  2. The codec vs. container distinction (critical prerequisite knowledge)
  3. What FFmpeg can do (use cases with real command examples)
  4. What FFmpeg cannot do
  5. The roles of ffmpeg, ffprobe, and ffplay
  6. Developer library structure (libav*)
  7. Five frequently asked questions

What Is FFmpeg

FFmpeg is an open-source framework for all audio and video processing. The official site defines it as:

A complete, cross-platform solution to record, convert and stream audio and video.

Key traits:

  • Free and open-source (LGPL/GPL)
  • Cross-platform (Windows, macOS, Linux, BSD, and more)
  • Command-line tool (no GUI — easy to script and automate)
  • Massive format support (hundreds of codecs and containers)
  • The backend behind YouTube, Netflix, VLC, and HandBrake

Most software you already use — VLC, HandBrake, OBS, Adobe Premiere, DaVinci Resolve — uses FFmpeg’s libraries (libav*) internally.


Codec vs. Container (Critical Background Knowledge)

This is the most commonly confused concept when learning FFmpeg.

ConceptDescriptionExamples
Container (file format)The “wrapper” that holds video, audio, and subtitle data. Identified by file extension..mp4, .mkv, .avi, .mov, .webm
Codec (encoding method)The algorithm used to compress and decompress data.H.264, H.265, AV1, AAC, MP3, Opus

Common combinations:

FilenameContainerVideo CodecAudio Codec
video.mp4MP4H.264AAC
video.mkvMatroskaH.264 or H.265AAC or FLAC
video.webmWebMVP9 or AV1Vorbis or Opus
video.movQuickTimeProRes or H.264AAC

“Converting MP4 to MKV” = changing only the container (codec stays the same). This is called a stream copy and requires no re-encoding.


What FFmpeg Can Do (With Command Examples)

1. Format Conversion (Container Swap)

Change the container without re-encoding. Extremely fast, zero quality loss.

# MKV → MP4 (codec stays the same)
ffmpeg -i input.mkv -c copy output.mp4

2. Encoding and Compression

Reduce file size while preserving quality.

# H.264 compression (most compatible)
ffmpeg -i input.mp4 -c:v libx264 -crf 23 -c:a aac output.mp4

# H.265 for ~40% smaller files at the same quality
ffmpeg -i input.mp4 -c:v libx265 -crf 28 -c:a aac output.mp4

3. Trimming and Cutting

# Cut from 1:00 to 2:00 (fast stream copy)
ffmpeg -ss 00:01:00 -i input.mp4 -to 00:02:00 -c copy output.mp4

4. Audio Extraction

# Extract MP3 from video
ffmpeg -i input.mp4 -vn -c:a libmp3lame -q:a 2 output.mp3

# Lossless AAC extraction
ffmpeg -i input.mp4 -vn -c:a copy output.aac

5. GIF Creation

# Convert part of a video to an animated GIF
ffmpeg -i input.mp4 -vf "fps=15,scale=480:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" output.gif

6. Resize / Scale

# 1080p → 720p
ffmpeg -i input_1080p.mp4 -vf scale=1280:-2 -c:v libx264 -crf 23 output_720p.mp4

7. Live Streaming (RTMP)

# Stream to YouTube Live
ffmpeg -re -i input.mp4 -c:v libx264 -b:v 4000k -c:a aac -f flv rtmp://a.rtmp.youtube.com/live2/YOUR_KEY

What FFmpeg Cannot Do

LimitationReason / Alternative
Bypass DRM-protected contentDRM is legally protected. Not within FFmpeg’s scope.
Visual GUI editingFFmpeg is command-line only. Use HandBrake, OpenShot, etc. for a GUI.
Timeline / non-linear editingUse Adobe Premiere, DaVinci Resolve, or similar NLE software.
AI-based upscalingRequires dedicated tools like Real-ESRGAN.

The Roles of ffmpeg, ffprobe, and ffplay

ToolRoleWhen to Use
ffmpegConversion, encoding, filtering, streamingVirtually all video processing
ffprobeFile analysis, metadata inspectionChecking codec, resolution, frame rate
ffplayPlayback (SDL) — testing onlyQuick preview of filter output
# Check version
ffmpeg -version

# Inspect file info
ffprobe -v quiet -show_streams -print_format json input.mp4

# Play a video
ffplay input.mp4

Developer Library Structure (libav*)

LibraryRole
libavcodecCollection of encoders and decoders
libavformatContainer mux/demux processing
libavdeviceDevice I/O (cameras, microphones, etc.)
libavfilterFilter graph processing
libavutilCommon utilities
libswscaleVideo scaling and pixel format conversion
libswresampleAudio resampling and format conversion

FAQ

Q1. Is FFmpeg free? A. Yes. It is free, open-source software licensed under LGPL v2.1+ (or optionally GPL v2+). Commercial use is permitted under certain conditions — see FFmpeg Legal for details.

Q2. Do I need programming knowledge to use it? A. No. Basic command-line skills (opening a terminal and typing commands) are all you need. Every command in this article can be copied and pasted directly.

Q3. Does it work on Windows, macOS, and Linux? A. Yes. FFmpeg is cross-platform. Installation steps differ, but the commands are nearly identical across all platforms (minor differences like path separators aside).

Q4. How do I check which formats my FFmpeg build supports?

# List supported formats
ffmpeg -formats

# List supported codecs
ffmpeg -codecs

# List available encoders
ffmpeg -encoders

Q5. What is the difference between FFmpeg and HandBrake? A. HandBrake is a GUI application that uses FFmpeg’s libraries internally. FFmpeg itself is a command-line tool that offers far greater flexibility and can be scripted and automated. HandBrake is more approachable for beginners; FFmpeg provides complete control.



Tested with: ffmpeg 6.1.1 / Ubuntu 24.04 (GitHub Actions runner) Primary sources: ffmpeg.org/about.html / ffmpeg.org/ffmpeg.html