Convert a video file with ffmpeg
Transcode any input video to MP4 (H.264 + AAC) with sensible quality settings for sharing and playback everywhere.
01Command
$ ffmpeg -i input.mov -c:v libx264 -crf 20 -c:a aac output.mp402What it does
ffmpeg infers formats from file extensions; the example re-encodes video to H.264 and audio to AAC, which every browser and phone plays. -crf sets constant quality: lower is better and larger (18 near-lossless, 23 default, 28 much smaller). To copy without re-encoding (fast, no quality loss, only works if codecs already fit the container) use ffmpeg -i input.mov -c copy output.mp4. Check what a file actually contains first with ffprobe input.mov, and scale with -vf scale=1280:-2. Use -y to overwrite an existing output without prompting.
03Risk
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- FFmpeg DocumentationEvidence: The FFmpeg documentation describes -i for the input file, -c:v / -c:a codec selection, and CRF-based quality for x264 encoding.
Last verified: 2026-09-17 · Category: Media
06Related solutions
Dump a video's audio into a standalone MP3 (or WAV/FLAC/AAC) file without touching the video itself.
Refresh the package index from all configured repositories, then install newer versions of every upgradable package.
Find every occurrence of a pattern across all files in a tree, printed as file:line:number matches.