>FFmpegLab Start free
FFmpeg Guide

How to convert video formats with FFmpeg

MP4, WebM, MOV, MKV, AVI — and when you can skip re-encoding entirely. A practical guide to containers, codecs, remuxing, extracting audio, and exporting GIFs.

"Convert video" hides two very different operations. Changing the container (the .mp4/.mov/.mkv wrapper) can often be done losslessly in seconds. Changing the codec (H.264, VP9, AV1) requires re-encoding and takes real time. Knowing which you need is the whole game.

Key takeaways

MOV to MP4 (usually lossless)

iPhone and camera .mov files are typically already H.264/HEVC, so you can just rewrap into MP4 with no quality loss and no wait:

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
ffmpeg -i input.mov -c copy output.mp4

If a player rejects it, the codec wasn't MP4-compatible — re-encode with -c:v libx264 -c:a aac.

MP4 to WebM (re-encode required)

WebM uses VP9 (or AV1) + Opus, so this always re-encodes. Great for open, royalty-free web delivery:

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
ffmpeg -i input.mp4 \
  -c:v libvpx-vp9 -crf 32 -b:v 0 \
  -c:a libopus -b:a 96k \
  output.webm

MKV / AVI to MP4

MKV often holds MP4-friendly streams, so try a remux first; fall back to re-encoding if a stream isn't supported:

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
# try lossless first
ffmpeg -i input.mkv -c copy output.mp4
# fallback: re-encode
ffmpeg -i input.mkv -c:v libx264 -crf 21 -c:a aac output.mp4

Extract audio to MP3

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
ffmpeg -i video.mp4 -vn -c:a libmp3lame -q:a 2 audio.mp3

Working with the audio afterwards? See the amix audio mixing guide.

Video to a high-quality GIF

Naive GIF exports look terrible. Use a two-step palette for clean colors:

ShareRenders{ } CodeConfig
Generated CodeLogsCustomize
ffmpeg -i in.mp4 -vf "fps=15,scale=480:-1:flags=lanczos,palettegen" palette.png
ffmpeg -i in.mp4 -i palette.png -lavfi "fps=15,scale=480:-1:flags=lanczos[x];[x][1:v]paletteuse" out.gif

Convert visually, keep the control

FFmpegLab picks sensible codecs for your target format and shows the exact command it runs, so you can convert with a dropdown or drop into the script. It runs offline in the browser — convert sensitive footage without uploading it anywhere. Need to shrink the result too? See the compression guide.

✦  Fresh from the render queue

Better FFmpeg workflows, delivered.

Get practical commands, new templates, and deep-dive guides for the edits that are usually hardest to get right.

✓  Copy-pasteable commands    ✓  Editor templates    ✓  No noise
One useful email at a time.

Convert any format — privately, in your browser.

Free in your browser — nothing to install, nothing uploaded.