Catalog / FFmpeg Cheatsheet
FFmpeg Cheatsheet
A comprehensive FFmpeg cheat sheet covering essential commands, options, and use cases for audio and video manipulation.
Basic Commands and Options
Basic Information
|
Display FFmpeg version information. |
|
List all available formats (containers, codecs, protocols). |
|
List all available codecs. |
|
List all available decoders. |
|
List all available encoders. |
|
List available devices (e.g., cameras, microphones). |
Basic Syntax
|
Example: |
Global Options
|
Overwrite output files without asking. |
|
Do not overwrite output files. Exit if specified output file exists. |
|
Specify input file. |
|
Specify codec. |
|
Disable video recording. |
|
Disable audio recording. |
Video Processing
Basic Video Encoding
|
Encode video to H.264 (libx264). |
|
Encode video to VP9 (libvpx-vp9) with Opus audio. |
|
Copy video and audio streams (re-mux). |
|
Encode video to H.265 (libx265) with CRF (Constant Rate Factor) for quality. |
Video Resizing and Cropping
|
Resize video to 640x480. |
|
Resize video to 720p (1280x720). |
|
Crop video to 320x240 starting at coordinates (100, 50). |
|
Scale the video to half of the original width and height. |
Frame Rate and Aspect Ratio
|
Set frame rate to 30 fps. |
|
Set aspect ratio to 16:9. |
|
Change both frame rate and aspect ratio. |
Audio Processing
Basic Audio Encoding
|
Encode audio to MP3 (libmp3lame). |
|
Encode audio to AAC with a bitrate of 128kbps. |
|
Copy audio stream (re-mux). |
Audio Conversion and Manipulation
|
Change audio sample rate to 44100 Hz. |
|
Change audio channels to stereo. |
|
Reduce audio volume to 50%. |
|
Extract audio snippet from 10 to 20 seconds. |
Extracting Audio from Video
|
Extract audio as AAC. |
|
Extract audio as MP3. |
Advanced Techniques
Concatenating Media Files
Create a text file
Then run:
|
Note: The files must have the same encoding and properties for seamless concatenation. |
Adding Subtitles
|
Add subtitles to a video file. |
|
Another way to add subtitles (may require specific codecs). |
Creating GIFs
|
Create a GIF from a video, limiting to the first 3 seconds, setting frame rate, scaling and using palette optimization. |
|
Convert specific part of the video to gif. |