ffmpeg -i input.mp4 -c:v libx264 -preset medium -crf 23 -c:a aac output.mp4

Category: Media & Conversion

ffmpeg -i input.mp4 -c:v libx264 -preset medium -crf 23 -c:a aac output.mp4

Transcode video to H.264 with CRF quality

Re-encodes the video with the libx264 codec (algorithm that compresses video) and audio with AAC. The -crf 23 flag sets quality: lower numbers give better quality and bigger files, 18-28 is the usual range. -preset medium trades encoding speed against file size, since slower presets compress better at the same CRF. A solid all-purpose conversion recipe.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.