FFmpeg Cheatsheet

This cheatsheet provides a comprehensive and practical reference for common FFmpeg commands. It covers conversion, transcoding, filters, cutting, merging, screenshots, GIFs, subtitles, streaming, and more. Use it to boost your productivity in video/audio processing and automation.

Basic Info & Help

ffmpeg -version
Show FFmpeg version info
ffmpeg -h
Show help for FFmpeg
ffmpeg -codecs
List all supported codecs
ffmpeg -formats
List all supported formats
ffmpeg -filters
List all available filters
ffmpeg -protocols
List all supported protocols

Convert & Transcode

ffmpeg -i input.mp4 output.avi
Convert MP4 to AVI
ffmpeg -i input.mov -c:v libx264 -c:a aac output.mp4
Convert MOV to MP4 (H.264 + AAC)
ffmpeg -i input.avi -c:v libvpx -c:a libvorbis output.webm
Convert AVI to WebM
ffmpeg -i input.mp4 -c:v copy -c:a copy output.mkv
Remux MP4 to MKV without re-encoding
ffmpeg -i input.mp4 -an output.mp4
Remove audio from video
ffmpeg -i input.mp4 -vn output.mp3
Extract audio as MP3
ffmpeg -i input.mp3 output.wav
Convert MP3 to WAV

Video & Audio Filters

ffmpeg -i input.mp4 -vf scale=1280:720 output.mp4
Resize video to 720p
ffmpeg -i input.mp4 -vf 'crop=640:480:0:0' output.mp4
Crop video to 640x480 from top-left
ffmpeg -i input.mp4 -vf 'transpose=1' output.mp4
Rotate video 90 degrees clockwise
ffmpeg -i input.mp4 -vf 'hue=s=0' output.mp4
Convert video to grayscale
ffmpeg -i input.mp4 -af 'volume=2.0' output.mp4
Double audio volume
ffmpeg -i input.mp4 -af 'atempo=2.0' output.mp4
Double audio speed

Cut, Trim & Merge

ffmpeg -ss 00:00:10 -to 00:00:20 -i input.mp4 -c copy output.mp4
Cut 10s-20s from video (fast, no re-encode)
ffmpeg -i input.mp4 -ss 00:01:00 -t 30 -c copy output.mp4
Extract 30s from 1:00 (fast, no re-encode)
ffmpeg -i input1.mp4 -i input2.mp4 -filter_complex '[0:v][0:a][1:v][1:a]concat=n=2:v=1:a=1[outv][outa]' -map '[outv]' -map '[outa]' output.mp4
Merge two videos (with audio)
ffmpeg -f concat -safe 0 -i files.txt -c copy output.mp4
Merge multiple files using concat demuxer

Screenshots & GIFs

ffmpeg -i input.mp4 -ss 00:00:10 -vframes 1 output.png
Extract a frame as PNG at 10s
ffmpeg -i input.mp4 -vf fps=10,scale=320:-1 output.gif
Convert video to GIF (10 fps, 320px wide)
ffmpeg -i input.mp4 -t 5 -vf 'fps=15,scale=320:-1:flags=lanczos' output.gif
Create a 5s GIF at 15 fps

Subtitles & Metadata

ffmpeg -i input.mkv -map 0:s:0 subs.srt
Extract subtitles from MKV to SRT
ffmpeg -i input.mp4 -vf subtitles=subs.srt output.mp4
Burn subtitles into video
ffmpeg -i input.mp4 -metadata title='My Video' output.mp4
Set video title metadata
ffmpeg -i input.mp4 -map_metadata -1 -c copy output.mp4
Remove all metadata

Streaming & Capture

ffmpeg -f v4l2 -i /dev/video0 output.mp4
Capture video from webcam (Linux)
ffmpeg -f avfoundation -i '0' output.mp4
Capture video from webcam (macOS)
ffmpeg -f gdigrab -i desktop output.mp4
Capture desktop screen (Windows)
ffmpeg -i input.mp4 -f flv rtmp://server/live/stream
Stream video to RTMP server

Command Combos

ffmpeg -i input.mp4 -vf 'scale=1280:720,fps=30' -c:v libx264 -preset fast -crf 23 output.mp4
Resize, set FPS, encode to H.264 in one step
ffmpeg -i input.mp4 -vf 'crop=640:480,transpose=1' output.mp4
Crop and rotate video in one command
ffmpeg -i input.mp4 -ss 00:00:10 -t 5 -vf 'fps=15,scale=320:-1' output.gif
Cut, scale, and convert to GIF in one step
ffmpeg -i input.mp4 -vf 'drawtext=text=Hello:fontcolor=white:fontsize=24:x=10:y=10' output.mp4
Add text overlay to video

Categories

  • Basic Info & Help

    Show version, help, codecs, formats, filters, and protocols.

  • Convert & Transcode

    Convert between formats, remux, extract audio, and more.

  • Video & Audio Filters

    Resize, crop, rotate, grayscale, adjust volume, and more.

  • Cut, Trim & Merge

    Cut, trim, and merge video/audio files.

  • Screenshots & GIFs

    Extract frames, create GIFs from video.

  • Subtitles & Metadata

    Extract, burn subtitles, and edit metadata.

  • Streaming & Capture

    Capture webcam, desktop, and stream to server.

  • Command Combos

    Powerful multi-step workflows and advanced usage patterns for real-world scenarios.

Features

  • Quick search functionality
  • Organized by categories
  • Clear command descriptions
  • Common and advanced use cases covered
  • Easy to copy commands
  • Responsive design
  • Perfect for quick reference