FFmpeg
FFmpeg is a free, open-source set of libraries and command-line tools for recording, converting, editing and streaming audio and video. Fabrice Bellard started it in 2000; today it is developed by a community of contributors and is built into many media applications.
Key facts
| Type | Multimedia framework: libraries and command-line tools |
| Started by | Fabrice Bellard, 2000 |
| Developed by | The FFmpeg developer community |
| Written in | C (C11) and assembly |
| License | LGPL 2.1 or later; optional parts under GPL 2 or later |
| Tools | ffmpeg, ffprobe, ffplay |
| Libraries | libavcodec, libavformat, libavfilter, libavdevice, libavutil, libswscale, libswresample |
| Platforms | Linux, macOS, Windows, BSD and others |
| Latest stable release | FFmpeg 9.1 “Gauss”, November 20, 2026 (as of November 2026) |
| Website | ffmpeg.org |
History
Fabrice Bellard writes that he launched FFmpeg in 2000 and led it for several years; the first commit in the repository is dated December 20, 2000. Michael Niedermayer later led the project until his resignation, announced on August 1, 2015. Today changes are reviewed on the ffmpeg-devel mailing list or on the project’s Forgejo instance, code.ffmpeg.org.
What FFmpeg is used for
The project describes FFmpeg as “a complete, cross-platform solution to record, convert and stream audio and video.” Typical tasks:
- converting between formats: MOV to MP4, WAV to MP3, video to GIF;
- compressing by re-encoding with another codec, bitrate or resolution;
- cutting, joining, scaling and cropping without a video editor;
- extracting, replacing and mixing audio tracks;
- burning in subtitles;
- recording from devices and streaming over RTMP or SRT, packaging HLS and DASH;
- inspecting files with
ffprobe.
Other software builds on FFmpeg. The HandBrake transcoder uses libavformat and libavcodec to open files, and Remotion, a framework for making videos with React, has shipped its own FFmpeg binary since version 4.0. Because each operation is one command, FFmpeg is easy to call from scripts or, for example, from Node.js through child_process.
How it works
Containers and codecs
A file such as video.mp4 is a container: it holds streams (video, audio, sometimes subtitles) and metadata. Each stream is compressed with a codec: H.264, H.265, VP9 or AV1 for video; AAC, MP3 or Opus for audio. MP4, MKV, MOV and WebM are containers, not codecs.
So “convert MKV to MP4” can mean two things: repackaging the same streams into a new container, which is fast and lossless, or re-encoding them, which is slower but changes size and quality.
The pipeline
input.mov → demuxer → decoder → filters → encoder → muxer → output.mp4
The demuxer splits the input into encoded packets; decoders turn packets into raw frames; filters scale, crop, draw text or change the volume; encoders compress frames back into packets; the muxer interleaves them and writes the file. With stream copy (-c copy), packets go straight from demuxer to muxer: fast and without quality loss, but filters cannot be applied and cuts are accurate only to a keyframe.
These stages map to libraries: libavformat (demuxers and muxers), libavcodec (decoders and encoders), libavfilter (filters), libswscale and libswresample (image scaling and audio resampling). ffmpeg converts, ffprobe analyzes, and ffplay is a simple player.
Essential commands
The commands are for bash or zsh; a trailing backslash continues the line. In the Windows command prompt, write each command on one line. Options before -i apply to that input, options before the output name apply to the output.
Inspect a file
ffprobe -hide_banner video.mp4
ffprobe -v error -show_format -show_streams -of json video.mp4
The first prints the container, duration, bitrate and each stream’s codec, resolution and frame rate. The second prints every field as JSON for scripts.
Convert to H.264 MP4
ffmpeg -i input.mov -c:v libx264 -crf 23 -preset medium -pix_fmt yuv420p \
-c:a aac -b:a 192k -movflags +faststart output.mp4
-c:v libx264encodes H.264 with the x264 library;-crf 23sets constant quality (lower means better and larger; 23 is the x264 default).-presettrades speed for compression: slower presets give smaller files at the same quality.-pix_fmt yuv420pkeeps the widely supported 4:2:0 format; otherwise x264 may keep 4:2:2 or 4:4:4 from the source, which many players cannot decode.-c:a aac -b:a 192kuses the built-in AAC encoder at 192 kbit/s.-movflags +faststartmoves the index to the start, so browser playback begins before the download ends.
Cut a fragment without re-encoding
ffmpeg -ss 00:01:30 -to 00:02:45 -i input.mp4 -c copy clip.mp4
The clip runs from 1:30 to 2:45 and is cut instantly, but the start snaps to the preceding keyframe, so some players show a few extra seconds or a frozen frame. For a frame-accurate cut, replace -c copy with -c:v libx264 -c:a aac.
Replace the audio with a voiceover
ffmpeg -i video.mp4 -i voiceover.mp3 -map 0:v -map 1:a -c:v copy -c:a aac -shortest output.mp4
Inputs are numbered from zero: video comes from the first file, audio from the second, and the original sound is dropped (add -map 0:a to keep it as a second track). -shortest ends the output with the shortest stream; with copied video the end is approximate.
Mix a voiceover with quieter music
ffmpeg -i video.mp4 -i voiceover.mp3 -i music.mp3 \
-filter_complex "[2:a]volume=0.2[music];[1:a][music]amix=inputs=2:duration=longest:normalize=0[mix]" \
-map 0:v -map "[mix]" -c:v copy -c:a aac -shortest final.mp4
volume=0.2 lowers the music to 20% (about −14 dB). By default amix scales its inputs down; normalize=0 keeps the voice at full level, though loud inputs may then clip. -shortest trims the mix at the end of the video.
Burn in subtitles from an .srt file
ffmpeg -i video.mp4 -vf subtitles=subs.srt -c:v libx264 -crf 23 -c:a copy subtitled.mp4
The subtitles filter draws text onto the frames with libass, so the video is re-encoded. It exists only in builds configured with --enable-libass; ffmpeg -filters lists what a build has, and the force_style option changes the font and colors.
Extract the audio
ffmpeg -i video.mp4 -vn -c:a copy audio.m4a
ffmpeg -i video.mp4 -vn -c:a libmp3lame -q:a 2 audio.mp3
-vn drops the video. The first command copies an AAC track as is; the second converts to variable-bitrate MP3 (-q:a 2 equals LAME’s -V 2).
Join clips
printf "file 'part1.mp4'\nfile 'part2.mp4'\n" > list.txt
ffmpeg -f concat -safe 0 -i list.txt -c copy joined.mp4
The concat demuxer plays the listed files one after another without re-encoding; they must have the same codecs and parameters. -safe 0 allows absolute paths and any file names.
Installation
The project publishes only source code; its download page links to third-party builds.
brew install ffmpeg # macOS, Homebrew
winget install ffmpeg # Windows, gyan.dev build
sudo apt install ffmpeg # Debian, Ubuntu
ffmpeg -version
- macOS: Homebrew or static builds from evermeet.cx. Homebrew’s standard formula lacks libass and the
subtitlesfilter;ffmpeg-fullincludes it but is not added toPATHautomatically. - Windows: builds from gyan.dev and BtbN.
- Linux: Debian and Ubuntu packages, RPM Fusion for Fedora and RHEL, static builds from BtbN.
Distribution packages may lag behind the latest release; ffmpeg -version shows the installed version and its configure flags.
Licensing and patents
According to its license file, most of FFmpeg is under the LGPL 2.1 or later. Optional GPL parts are enabled with --enable-gpl, and the whole build then becomes GPL; this also applies to builds with the libx264 or libx265 encoders. The gyan.dev builds, for example, are GPLv3. --enable-nonfree allows libraries with incompatible licenses, such as Fraunhofer FDK AAC in a GPL build, and makes the binaries non-redistributable.
To ship FFmpeg inside a product under the LGPL, the legal page advises building without --enable-gpl and --enable-nonfree, linking dynamically, distributing the source code, crediting FFmpeg and avoiding GPL libraries such as libx264.
On patents, the project says it cannot judge a given use (“we are not lawyers”). Standards such as H.264 and MPEG-4 may involve patent rights, laws differ between countries, and commercial products carry more risk than private use. This is general information; check a commercial product with a lawyer.
Pros and cons
Pros:
- According to the project, it handles almost any media format, from obscure old ones to the newest.
- Free, open source and cross-platform.
- Commands run the same on a laptop and a server and are easy to automate.
- Stream copy makes many operations fast and lossless.
Cons:
- No graphical interface; option order and filtergraph syntax take time to learn.
- Builds differ: a filter or encoder, such as
subtitlesor libx264, may be missing. - A build’s license depends on its configuration, and some codecs raise patent questions.
- Frame-accurate edits need re-encoding; timeline editing with transitions is easier in a video editor.
How to get started
- Install a build and run
ffmpeg -version. - Run
ffprobeon one of your own files. - Use the built-in help:
ffmpeg -h encoder=libx264,ffmpeg -h filter=amix. - Read the official ffmpeg documentation and filters reference.
Sources
- About FFmpeg — FFmpeg (accessed 29 November 2026)
- Download FFmpeg — FFmpeg (accessed 29 November 2026)
- FFmpeg news: FFmpeg 9.1 “Gauss” and earlier announcements — FFmpeg (accessed 29 November 2026)
- FFmpeg License and Legal Considerations — FFmpeg (accessed 29 November 2026)
- ffmpeg Documentation — FFmpeg (accessed 29 November 2026)
- FFmpeg Filters Documentation — FFmpeg (accessed 29 November 2026)
- FFmpeg Developer Documentation — FFmpeg (accessed 29 November 2026)
- Fabrice Bellard's Home Page — Fabrice Bellard (accessed 29 November 2026)