"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
- Container ≠ codec. An MP4 can hold H.264, H.265, or AV1.
- Remux with
-c copywhen the codec is already compatible — it's instant and lossless. - Re-encode only when the target needs a different codec (e.g. WebM/VP9).
- FFmpeg also extracts audio and exports high-quality GIFs.
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:
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:
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:
# 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
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:
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.