Guides

MP4, MKV or WEBM: Which to Pick

MP4, MKV and WEBM are containers, not quality levels. What H.264, VP9 and AV1 mean, what plays on which device, and when to remux instead of re-encode.

A container is not a codec

The letters after the dot in a file name describe the container: the wrapper that holds a video stream, one or more audio streams, and extras such as subtitles and chapters. MP4, MKV and WEBM are all containers. None of them is a quality level, and none of them is, strictly, a video format.

The picture itself is stored with a codec — the method used to compress it. The three you will meet when downloading are H.264, VP9 and AV1. The sound has its own codecs, usually AAC or Opus. What decides whether a file plays on your television is mostly the codec inside, not the wrapper around it.

So “MP4 or MKV?” is really two questions. Which codec do I want, and which wrapper suits where the file is going? Once those are separate, the choice gets much easier.

H.264, VP9 and AV1

Three video codecs cover nearly everything you will download. They differ in two ways that pull against each other: how small they make the file, and how many devices can play it. For sound, AAC is the universal codec and Opus the more efficient one; AAC is at home in MP4, Opus in WEBM and MKV.

  • H.264, also written AVC — the oldest of the three and the one everything plays. Phones, televisions, consoles, car screens and editing software from the last fifteen years all handle it. It needs the most data for a given picture quality.
  • VP9 — Google’s royalty-free codec and the workhorse of YouTube. It reaches the same quality as H.264 with noticeably less data. Most devices from the last several years decode it in hardware; older ones may not.
  • AV1 — the newest. It is more efficient again than VP9, so files are smaller at the same quality. Hardware decoding exists only on fairly recent chips. Without it a PC can still play AV1 in software, at the cost of more processor work and more battery.

The three containers compared

  • MP4 — the most widely supported wrapper. Its natural contents are H.264 video with AAC audio, and that pairing plays almost anywhere. It can also hold AV1.
  • WEBM — an open format built for the web. It is limited by design to VP8, VP9 or AV1 video with Vorbis or Opus audio. Browsers and modern players handle it well; older televisions and many editing programs do not.
  • MKV, or Matroska — the wrapper that accepts nearly any combination of codecs, several audio and subtitle tracks, and chapters. Desktop players such as VLC and mpv read it without complaint. Support on phones, televisions and in editors is less consistent.
  • MOV — Apple’s QuickTime container, a close relative of MP4. It is mainly of interest if your editing software prefers it.

Why 4K rarely comes as H.264

People often ask for “the 4K MP4” and are surprised by what they get. On YouTube, H.264 usually stops at 1080p. The 1440p, 4K and 8K versions are offered as VP9 or AV1, because those codecs make very large pictures practical to stream.

That has a consequence for the container. When yt-dlp merges a video stream and an audio stream, it picks the wrapper from the codecs involved: H.264 with AAC goes into MP4, VP9 or AV1 with Opus goes into WEBM, and a mixed pair that fits neither goes into MKV. The file extension you end up with is a result of the codecs, not a setting that was ignored.

You can ask for MP4 anyway with --merge-output-format mp4. That changes the wrapper only. A 4K file made this way is still VP9 or AV1 inside, and a device that cannot decode those will refuse it just as it would refuse the WEBM. If the goal is a file that plays everywhere, the reliable request is H.264 specifically, accepting that it tops out at 1080p. yt-dlp has a preset for exactly that.

See which codecs a video offers
yt-dlp -F "URL"
Best quality, whatever the codec
yt-dlp "URL"
The most compatible MP4: prefer H.264 and AAC
yt-dlp -t mp4 "URL"
Best quality, always wrapped as MKV
yt-dlp --merge-output-format mkv "URL"

What plays where

  • Windows PC with VLC or mpv — everything on this page. Pick for quality and stop worrying.
  • Phones and tablets — H.264 in MP4 is the safe choice. Recent devices play VP9 and often AV1, but the built-in gallery and file apps are stricter than a dedicated player app.
  • Smart TVs and USB playback — H.264 in MP4 for anything a few years old. Newer sets usually accept VP9 and MKV; check the manual before filling a drive.
  • Video editors — H.264 in MP4 or MOV imports nearly everywhere. Support for MKV, WEBM, VP9 and AV1 varies from one editor to the next, so test a short clip first.
  • Sending a file to someone else — MP4 with H.264. You do not know what they will open it with.

Remux or re-encode

There are two very different ways to change a file’s format. Remuxing lifts the existing video and audio streams out of one container and places them in another. Nothing is recompressed, so it takes seconds and the quality is untouched. Re-encoding decodes the video and compresses it again with a different codec. That takes minutes or hours, and because both codecs are lossy, a little quality is lost each time.

Remux whenever the codecs already suit the destination: an MKV holding H.264 and AAC becomes a perfectly good MP4 with no loss. Re-encode only when the codec itself is the obstacle, such as VP9 footage bound for a device that reads nothing but H.264 — and consider downloading the H.264 version in the first place.

yt-dlp exposes both. --remux-video changes the container and fails if the target cannot hold the codecs, which is a useful safeguard. --recode-video re-encodes when needed. FFmpeg can do the same to a file you already have.

Change the container without re-encoding
yt-dlp --remux-video mp4 "URL"
Re-encode to MP4 when a remux is not possible
yt-dlp --recode-video mp4 "URL"
Remux a file you already have
ffmpeg -i "input.mkv" -c copy "output.mp4"

Which one to pick

  • It has to play on anything — MP4 with H.264, at up to 1080p.
  • You want the highest resolution and will watch on a PC — take the best quality and let it be WEBM or MKV.
  • You want several subtitle or audio tracks in one file — MKV.
  • You are going to edit it — H.264 in MP4 or MOV, unless you have checked that your editor imports VP9 or AV1.
  • You are short of disk space — VP9 or AV1 at the resolution you need; they are smaller than H.264 at the same quality.

Choosing in the app

In GetVideosLocally, the Windows app this site is about, the container is a menu choice: MP4 at up to 8K, MKV, WEBM or MOV, with Quality set separately and defaulting to Best available (up to 8K). yt-dlp and FFmpeg are bundled, so merging and wrapping happen without any setup. The reasoning on this page applies there too: pick the container for where the file is going to be played.

I do not think one format is the right answer for everyone, which is why the app offers four. Whatever you choose and whichever tool you use, download only what you are allowed to save: your own uploads, public-domain and Creative Commons material, and content you have permission for.

FAQ

Is MKV better quality than MP4?

No. Both are containers. Quality comes from the video stream inside and its resolution and bitrate. The same stream placed in an MKV or an MP4 looks identical.

Why did my download come out as WEBM instead of MP4?

Because the best available streams were VP9 or AV1 video with Opus audio, and WEBM is the container for those. Ask for H.264 if you need a conventional MP4, or remux to MKV if you only dislike the extension.

Can I convert MKV to MP4 without losing quality?

Yes, if the codecs inside are ones MP4 holds well, such as H.264 with AAC. Remuxing copies the streams into the new container without recompressing them, so nothing is lost.

Which format is best for a smart TV?

MP4 with H.264 video and AAC audio is the safest. Newer sets often play VP9 and MKV too, but support differs by brand and year.

Is AV1 better than H.264?

It is more efficient: the same picture quality in a smaller file. It is also harder to play, because only fairly recent hardware decodes it. H.264 remains the choice for compatibility.

Download GetVideosLocally for Windows. Free and open source.

Home · Guides · Changelog · Privacy · GitHub · Donate