LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

ffmpeg

multimedia conversion and processing tool

TLDR

Convert video format (auto-detected from extension)
$ ffmpeg -i [input.mp4] [output.avi]
copy
Extract audio without re-encoding
$ ffmpeg -i [video.mp4] -vn -c:a copy [audio.m4a]
copy
Resize video to 1280x720
$ ffmpeg -i [input.mp4] -vf scale=[1280]:[720] [output.mp4]
copy
Compress video with x264 CRF (lower = better)
$ ffmpeg -i [input.mp4] -c:v libx264 -crf [23] -c:a copy [output.mp4]
copy
Trim from 00:01:00 for 30 seconds
$ ffmpeg -ss [00:01:00] -i [input.mp4] -t [30] -c copy [output.mp4]
copy
Create GIF from video
$ ffmpeg -i [input.mp4] -vf "fps=10,scale=320:-1" [output.gif]
copy
Concatenate files listed in files.txt
$ ffmpeg -f concat -safe 0 -i [files.txt] -c copy [output.mp4]
copy

SYNOPSIS

ffmpeg [global-options] [input-options] -i input [output-options] output

DESCRIPTION

ffmpeg is the swiss army knife of multimedia processing. It converts, records, streams, and processes audio and video in virtually any format through an extensive codec library.The tool uses a powerful filter system for transformations like scaling, cropping, color correction, and effects. It handles everything from simple format conversion to complex streaming setups.ffmpeg forms the foundation of many video applications and is the de facto standard for command-line multimedia processing.

PARAMETERS

-i FILE

Input file (may be specified multiple times).
-c:v CODEC
Video codec (e.g. libx264, libx265, libvpx-vp9, copy).
-c:a CODEC
Audio codec (e.g. aac, libmp3lame, libopus, copy).
-c CODEC
Shorthand for setting the codec of all streams (often used as `-c copy`).
-crf N
Constant Rate Factor for x264/x265 (0-51, lower is better quality, 23 is the default).
-b:v BITRATE
Target video bitrate (e.g. 2M).
-b:a BITRATE
Target audio bitrate (e.g. 128k).
-r FPS
Output frame rate.
-s WxH
Set output frame size (e.g. 1280x720).
-vf FILTER
Video filter graph (scale, crop, fps, etc.).
-af FILTER
Audio filter graph.
-ss TIME
Seek to start position. Used before `-i` for a fast seek, after `-i` for accurate seek.
-to TIME
Stop writing at the given absolute time.
-t DURATION
Limit output to the given duration.
-vn
Disable video output.
-an
Disable audio output.
-map SPEC
Explicit stream mapping from inputs to outputs.
-f FORMAT
Force container format.
-y
Overwrite output files without asking.
-n
Never overwrite output files.
-loglevel LEVEL
Logging verbosity (quiet, panic, fatal, error, warning, info, verbose, debug, trace).
-h [topic]
Display help; use `-h long` or `-h full` for more options.

INSTALL

sudo apt install ffmpeg
copy
sudo pacman -S ffmpeg
copy
sudo apk add ffmpeg
copy
brew install ffmpeg
copy
nix profile install nixpkgs#ffmpeg
copy

CAVEATS

Complex syntax requires learning. Quality vs size tradeoffs vary by content. Some codecs have licensing considerations. Processing is CPU-intensive.

HISTORY

ffmpeg was started by Fabrice Bellard in 2000 and has become the most widely-used multimedia framework. It powers countless applications from VLC to YouTube's video processing pipeline.

SEE ALSO

ffprobe(1), ffplay(1), sox(1), handbrake(1), mencoder(1)

Braincup
Open source brain training for math, memory and focus
Braincup mini-games
41 mini-games · Apache-2.0
No ads · No tracking
Play in browser
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid
276 stars
From the maker of Linux Command Library
Copied to clipboard
Braincup
Open source brain training for math, memory and focus. 41 mini-games, from mental arithmetic to Sudoku, N-Back and Solo Chess.
Apache-2.0 licensed · No ads · No tracking · No account
From the maker of Linux Command Library
Download Braincup on the App StoreGet Braincup on Google PlayGet Braincup on F-Droid