Media EngineeringUpdated: 2026-11-06

The Complete FFmpeg Video, Audio & Transcoding Command Reference

Quick reference for converting video formats, extracting audio tracks, resizing resolutions, and optimizing media for the web.

FFmpeg is the universal Swiss Army knife of audio and video processing. From simple format transcoding to multi-pass WebM compression and client-side WebAssembly pipelines, this cheat sheet provides battle-tested production command strings.

Core Video Transcoding Commands

Standard conversion commands with optimal compression flags.

OperationCommand SyntaxDescription
MP4 to WebP Animation`ffmpeg -i input.mp4 -vcodec libwebp -filter:v fps=15 -lossless 0 -compression_level 6 output.webp`Creates smooth web animation with half the file size of legacy GIFs.
Convert to Web H.264`ffmpeg -i input.mov -c:v libx264 -crf 23 -preset slow -c:a aac -b:a 128k output.mp4`Universal web compatibility with balanced CRF compression.
Strip Audio from Video`ffmpeg -i input.mp4 -an -c:v copy silent.mp4`Eliminates audio tracks without re-encoding video streams.
Extract Audio to MP3`ffmpeg -i input.mp4 -vn -c:a libmp3lame -q:a 2 audio.mp3`Extracts high-fidelity variable bitrate MP3 audio track.

Scaling & Resolution Filters

Resize video dimensions while preserving aspect ratios.

Target ResolutionFilter ParameterNotes
Scale to 1080p`-vf "scale=1920:-2"`Calculates proportional height and rounds to an even number required by H.264.
Scale to 720p`-vf "scale=1280:-2"`Optimal for mobile delivery and bandwidth conservation.
Crop Centered Square (1:1)`-vf "crop=in_h:in_h"`Crops 16:9 widescreen to 1:1 square for Instagram or avatar videos.

Frequently Asked Questions

What is CRF (Constant Rate Factor) in FFmpeg?

CRF controls video quality for x264/x265. A value of 0 is lossless, 18 is visually lossless, 23 is default, and 28 is high compression. Lower values mean higher quality.

Does FFmpeg run in web browsers?

Yes! Projects like @ffmpeg/ffmpeg compile the C codebase to WebAssembly (WASM), enabling in-browser video manipulation without server uploads.