FFmpeg Cheatsheet - Media Processing

All essential FFmpeg commands organized by use case, with 39+ entries you can copy and run directly. Find the right command fast when you need it.

SysOps·39 commands·Last updated 2026-07-21
Back to SysOps

Format Conversion 6

ffmpeg -i input.mp4 output.avi
Convert container; auto-select encoder
ffmpeg -i input.mp4 -c:v libx264 output.mp4
Re-encode with H.264
ffmpeg -i input.mp4 -c:v libx265 output.mp4
Encode to H.265 (smaller)
ffmpeg -i input.wav -c:a libmp3lame -q:a 2 output.mp3
WAV to MP3, -q:a 2 ~190kbps
ffmpeg -i input.mp4 -c:v copy -c:a copy output.mkv
Stream copy into MKV, very fast
ffmpeg -i input.gif -movflags faststart output.mp4
GIF to MP4, faststart for web

Trim & Crop 5

ffmpeg -i input.mp4 -ss 00:01:00 -to 00:02:00 -c copy clip.mp4
Cut 1:00-2:00, -c copy fast
ffmpeg -ss 10 -i input.mp4 -t 30 clip.mp4
Start at 10s, take 30s (-ss before -i)
ffmpeg -i input.mp4 -vf "crop=640:480:0:0" output.mp4
Crop to 640x480 at (0,0)
ffmpeg -i input.mp4 -vf "crop=iw/2:ih:0:0" output.mp4
Crop the left half
ffmpeg -i input.mp4 -vf "scale=1280:720:force_original_aspect_ratio=decrease,pad=1280:720:-1:-1:black" output.mp4
Scale and pad to 1280x720 with black bars

Extract & Separate 6

ffmpeg -i input.mp4 -vn audio.aac
Extract audio, -vn drops video
ffmpeg -i input.mp4 -an video_only.mp4
Drop audio, keep video (-an)
ffmpeg -i input.mp4 -vf "select=eq(pict_type\,I)" -vsync vfr thumb_%03d.png
Extract keyframes as images
ffmpeg -i input.mp4 -r 1 frame_%03d.png
Extract one frame per second
ffmpeg -i input.mp4 -map 0:s:0 subtitle.srt
Extract subtitle track to SRT
ffmpeg -i "image_%03d.png" -r 30 video.mp4
Images to video

Compression & Quality 6

ffmpeg -i input.mp4 -c:v libx264 -crf 23 output.mp4
CRF compress; higher = lower quality (18-28)
ffmpeg -i input.mp4 -c:v libx264 -crf 18 -preset slow output.mp4
High quality; slow preset = smaller
ffmpeg -i input.mp4 -c:v libx264 -b:v 1M output.mp4
Cap video bitrate at 1Mbps
ffmpeg -i input.mp4 -vf "scale=1280:-1" output.mp4
Scale width to 1280px
ffmpeg -i input.mp4 -c:a aac -b:a 128k output.mp4
Audio to AAC at 128kbps
ffmpeg -i input.mp4 -c:v libx264 -preset fast -tune zerolatency output.mp4
Low-latency encode for live streaming

Watermark & Subtitle 5

ffmpeg -i input.mp4 -i logo.png -filter_complex "overlay=10:10" output.mp4
Image watermark at top-left
ffmpeg -i input.mp4 -i logo.png -filter_complex "overlay=W-w-10:H-h-10" output.mp4
Watermark at bottom-right
ffmpeg -i input.mp4 -vf "subtitles=sub.srt" output.mp4
Burn SRT subtitles into video
ffmpeg -i input.mp4 -vf "drawtext=text=Hello:fontcolor=white:fontsize=24:x=10:y=10" output.mp4
Add a text watermark
ffmpeg -i input.mp4 -i sub.srt -c copy -c:s mov_text output.mp4
Soft (toggleable) subtitle in MP4

Audio 5

ffmpeg -i input.mp4 -c:a libmp3lame -b:a 192k output.mp3
To MP3 at 192kbps
ffmpeg -i input.mp3 -af "volume=2.0" output.mp3
Double the volume
ffmpeg -i input.mp4 -af "atempo=2.0" output.mp4
2x audio speed (pitch preserved)
ffmpeg -i input.mp3 -af "silenceremove=stop_periods=1:stop_duration=1:stop_threshold=-50dB" output.mp3
Remove silent segments
ffmpeg -i "concat:a.mp3|b.mp3" -c copy output.mp3
Concatenate audio files

Capture & Streaming 6

ffmpeg -f avfoundation -i "0:" -r 30 -t 60 screen.mp4
macOS screen record 60s (avfoundation)
ffmpeg -f x11grab -i :0.0 -r 25 screen.mp4
Linux screen record (X11)
ffmpeg -f v4l2 -i /dev/video0 -t 10 webcam.mp4
Record webcam for 10s
ffmpeg -re -i input.mp4 -c copy -f flv rtmp://live.example.com/live
RTMP live push
ffmpeg -i http://example.com/stream.m3u8 -c copy output.mp4
Download an HLS stream locally
ffmpeg -i input.mp4 -hls_time 10 -hls_list_size 0 output.m3u8
Slice video into an HLS playlist

Tips

  • -c copy only remuxes streams without re-encoding — very fast, but no filtering.
  • Recommended CRF is 18-28: 18 near-lossless, 23 default, 28 smaller.
  • -ss before -i is fast but imprecise; after -i is precise but slower.
  • In scale, -1 means proportional; scale=1280:-1 sets width 1280, height auto.
  • Slower -preset means better compression: ultrafast … veryslow.
  • For live push, -re reads at the native rate to avoid overwhelming the server.

Official References

Commands are compiled from the official docs below. Click to verify the latest usage.

Maintained by LaoHand

Publicly updated on Jul 21, 2026, continuously proofread against official docs.

Contact Us

Wrong command or description? Send us corrections, business inquiries or product feedback by email.

Contact Us