C.W.K.
Stream
Lesson 01 of 10 · published

Format Conversion — The First One-Liner

~10 min · convert, format, transcoding

Level 0Viewer
0 XP0/73 lessons0/15 achievements
0/100 XP to next level100 XP to go0% complete

The world's shortest FFmpeg command

Format conversion is so common that FFmpeg has an absurdly forgiving default behavior: hand it an input and an output, and it'll guess sensible codecs based on the output extension. ffmpeg -i input.mov output.mp4 just works. The output extension drives container choice; the container drives default codec choice.

What FFmpeg picks when you don't specify

For an .mp4 output, default video is H.264 (libx264) and default audio is AAC. For .webm, defaults are VP9 + Opus. For .mkv, FFmpeg copies whatever the source had if compatible, otherwise re-encodes to the same defaults as MP4. The defaults are reasonable. They are not optimal. If you care about file size or quality, pass explicit codec/quality flags — Track 3 covers all of them.

Common conversions that come up weekly

MOV → MP4 (Final Cut export to web-safe), MKV → MP4 (Plex source to phone), WebM → MP4 (yt-dlp output to a file your editor opens), AVI → MP4 (decade-old footage to modern container). All of these are one line.

Code

Just convert (let FFmpeg pick defaults)·bash
# MOV → MP4 (libx264 + AAC defaults)
ffmpeg -i input.mov output.mp4

# MKV → MP4
ffmpeg -i input.mkv output.mp4

# WebM → MP4
ffmpeg -i input.webm output.mp4

# Old AVI → MP4
ffmpeg -i ancient.avi modern.mp4
Specify quality so the defaults don't bite you·bash
# Same conversion, but with explicit quality
# -crf 23 is the libx264 default; lower = better quality, larger file
ffmpeg -i input.mov \
  -c:v libx264 -crf 20 -preset slow \
  -c:a aac -b:a 192k \
  output.mp4

# Why -preset slow: ~2x slower than 'medium' but ~10% smaller file at the
# same quality. For one-off conversions, slow is almost always worth it.

External links

Exercise

Take any non-MP4 video on your machine. Run two conversions: ffmpeg -i src out_default.mp4 and ffmpeg -i src -c:v libx264 -crf 18 -preset slow -c:a aac -b:a 192k out_quality.mp4. Compare file sizes and play both back. Can you see a quality difference at full screen?

Progress

Progress is local-only — sign in to sync across devices.
Spotted a bug or have feedback on this page?Report an Issue

Comments 0

🔔 Reply notifications (sign in)
Sign inPlease sign in to comment.

No comments yet — be the first.