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.
Table of Contents
Core Video Transcoding Commands
Standard conversion commands with optimal compression flags.
| Operation | Command Syntax | Description |
|---|---|---|
| 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 Resolution | Filter Parameter | Notes |
|---|---|---|
| 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. |
Interactive Client-Side Tools for this Guide
Test and run these patterns directly inside your browser with zero server uploads:
Image Resizer (Passport & Custom Dimensions)
Quickly resize photos for passport applications, visa forms, resume uploads, or social media with aspect ratio lock.
HEIC to JPG / PNG Converter (iPhone Photo Fix)
Fix unopenable Apple .HEIC and .HEIF images on Windows, Linux, and Android. Fast, private WebAssembly conversion in your browser.
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.