Cheatsheet: ffmpeg
Last updated 2026-06-21
Inspect media
List streams, codecs, duration, bitrate, and container metadata with ffprobe.
Show machine-readable stream information as JSON.
Print only the video resolution.
Convert and encode
Convert from .mov to .mp4 using H.264 video and AAC audio for broad compatibility.
Change only the container when streams are already compatible; this is fast because it does not re-encode.
Encode H.265/HEVC video with AAC audio.
Control video quality with CRF; lower values are larger and higher quality, commonly 18-28 for H.264.
Change video bitrate and audio bitrate explicitly.
Use two-pass encoding for a target average bitrate.
Use NVIDIA hardware encoding when available.
Use Apple VideoToolbox hardware encoding on macOS when available.
Resize, crop, and frame rate
Resize to an exact width and height.
Resize to 720p while preserving aspect ratio; -2 chooses an even width required by many codecs.
Crop to a centered 1080x1080 square.
Change output frame rate to 30 fps.
Pad video to 1920x1080 with black bars while preserving the original aspect ratio.
Trim, concatenate, and images
Trim a clip from 00:01:00 for 30 seconds, re-encoding for accurate cuts.
Fast trim without re-encoding; cuts may align to nearest keyframe.
Concat file format for the concat demuxer.
Concatenate videos from a text file without re-encoding when codecs, time bases, and dimensions match.
Concatenate videos from a list but re-encode to avoid codec mismatch glitches.
Create a GIF from a video segment with palette generation for better colors.
Extract one image frame every second.
Extract a screenshot at a specific timestamp.
Convert one image into a 30 second video.
Add N seconds to the end of the video by cloning the last frame.
Audio and subtitles
Combine a video-only file and an audio file, copying streams when compatible.
Extract audio as MP3.
Extract the original audio stream without re-encoding.
Remove all audio from a video.
Replace a video's audio with a separate audio file and stop at the shorter input.
Adjust audio volume to 50 percent.
Generate a silent audio file.
Burn subtitles into the video frames using an SRT file.
Add soft subtitles as a selectable track without burning them into the picture.
See also: