Tools

FFmpeg Cheatsheet

Essential FFmpeg commands for video and audio processing, conversion, and streaming

Useful FFmpeg Resources

FFmpeg Official Documentation

Official documentation with comprehensive guides and command references

Learn More →

FFmpeg Wiki

Community-maintained knowledge base with examples and use cases

Learn More →

FFmpeg Filters Documentation

Detailed explanations of FFmpeg's powerful filters system

Learn More →

FFmpeg Encoding Guide

Guide for encoding video with various codecs and parameters

Learn More →

Basic Commands

ffmpeg -i input.mp4 output.mp4

Basic conversion from one format to another

ffmpeg -h

Display help information and available options

ffmpeg -formats

Show available formats (muxers and demuxers)

ffmpeg -codecs

Show available codecs

ffmpeg -encoders

List all available encoders

ffmpeg -decoders

List all available decoders

ffmpeg -filters

Show available filters

Video Manipulation

ffmpeg -i input.mp4 -c:v libx264 -crf 23 output.mp4

Convert video using H.264 codec with quality setting

ffmpeg -i input.mp4 -vf "scale=1280:720" output.mp4

Resize video to 720p resolution

ffmpeg -i input.mp4 -vf "crop=w:h:x:y" output.mp4

Crop video with width, height, and starting position

ffmpeg -i input.mp4 -vf "fps=30" output.mp4

Change frame rate to 30 fps

ffmpeg -i input.mp4 -vf "setpts=0.5*PTS" output.mp4

Speed up video (2x)

ffmpeg -i input.mp4 -vf "setpts=2.0*PTS" output.mp4

Slow down video (0.5x)

ffmpeg -i input.mp4 -vf "rotate=90*PI/180" output.mp4

Rotate video 90 degrees clockwise

Audio Manipulation

ffmpeg -i input.mp4 -c:a aac -b:a 192k output.mp4

Convert audio to AAC codec with 192k bitrate

ffmpeg -i input.mp4 -an output.mp4

Remove audio from video

ffmpeg -i video.mp4 -i audio.mp3 -c:v copy -c:a aac -map 0:v:0 -map 1:a:0 output.mp4

Replace audio in a video

ffmpeg -i input.wav -ar 44100 output.wav

Change audio sample rate to 44.1 kHz

ffmpeg -i input.mp3 -af "volume=2.0" output.mp3

Increase audio volume by 2x

ffmpeg -i input.mp3 -af "highpass=f=200,lowpass=f=3000" output.mp3

Apply highpass and lowpass filters

ffmpeg -i input.mp3 -af "atempo=0.5" output.mp3

Slow down audio speed (0.5x)

Format Conversion

ffmpeg -i input.mov -c:v libx264 -c:a aac output.mp4

Convert MOV to MP4

ffmpeg -i input.mp4 -c:v libvpx-vp9 -crf 30 -b:v 0 output.webm

Convert to WebM with VP9 codec

ffmpeg -i input.mp4 output.gif

Convert video to GIF

ffmpeg -i input.mp4 -c:v libx265 -crf 28 output.mp4

Convert to H.265/HEVC codec

ffmpeg -i input.mp4 -vn -c:a libmp3lame -q:a 4 output.mp3

Extract audio from video to MP3

ffmpeg -i input.mp4 -r 1 -f image2 image-%3d.jpg

Extract frames as JPG images

ffmpeg -i input.mp4 -ss 00:00:10 -t 00:00:05 -c:v copy -c:a copy output.mp4

Cut 5 seconds starting at 10 seconds

Streaming and Recording

ffmpeg -i input.mp4 -c:v libx264 -preset fast -g 60 -c:a aac -b:a 128k -f flv rtmp://server/live/stream

Stream to RTMP server

ffmpeg -i rtmp://server/live/stream -c copy output.mp4

Record RTMP stream to file

ffmpeg -i input.mp4 -c:v libx264 -preset veryfast -g 25 -c:a aac -b:a 128k -f dash manifest.mpd

Generate DASH streaming format

ffmpeg -i input.mp4 -c:v libx264 -c:a aac -hls_time 10 -hls_list_size 0 playlist.m3u8

Create HLS playlist for streaming

ffmpeg -f gdigrab -framerate 30 -i desktop output.mp4

Record desktop screen (Windows)

ffmpeg -f x11grab -framerate 30 -i :0.0 output.mp4

Record desktop screen (Linux)

ffmpeg -f avfoundation -i "0:0" output.mp4

Record screen on macOS

Advanced Options

ffmpeg -i input.mp4 -c:v libx264 -tune film -c:a copy output.mp4

Tune encoder for specific content type

ffmpeg -i input.mp4 -c:v libx264 -preset slower -crf 18 output.mp4

High-quality video with slower encoding

ffmpeg -i input1.mp4 -i input2.mp4 -filter_complex "[0:v][1:v]hstack=inputs=2[v]" -map "[v]" output.mp4

Horizontally stack two videos

ffmpeg -i input.mp4 -vf "drawtext=text='Hello World':fontcolor=white:fontsize=24:x=10:y=10" output.mp4

Add text overlay to video

ffmpeg -i "concat:input1.mp4|input2.mp4" -c copy output.mp4

Concatenate videos (simple)

ffmpeg -f lavfi -i color=c=black:s=1280x720:d=5 -c:v libx264 blackscreen.mp4

Generate black video of 5 seconds

ffmpeg -i input.mp4 -c:v copy -c:a copy -ss 00:01:00 -to 00:02:00 output.mp4

Extract specific time segment

Thumbnails and Screenshots

ffmpeg -i input.mp4 -ss 00:00:15 -frames:v 1 thumbnail.jpg

Create thumbnail at 15 seconds

ffmpeg -i input.mp4 -vf "thumbnail,scale=640:360" -frames:v 1 thumbnail.jpg

Create thumbnail with the most representative frame

ffmpeg -i input.mp4 -vf "fps=1/10,scale=320:-1" output_%03d.jpg

Create thumbnails every 10 seconds

ffmpeg -ss 00:00:10 -i input.mp4 -frames:v 1 -q:v 2 screenshot.jpg

High-quality screenshot at 10 seconds

ffmpeg -i input.mp4 -vf "select=gt(scene\,0.4)" -frames:v 5 -vsync vfr scene_%03d.jpg

Extract frames at scene changes

ffmpeg -i input.mp4 -filter_complex "select=eq(pict_type\,I)" -vsync 0 frame_%03d.jpg

Extract I-frames only

ffmpeg -i input.mp4 -vf "scale=320:-1:flags=lanczos,tile=3x4" -frames:v 1 contact_sheet.jpg

Create contact sheet of frames