Choose a codec and encoder
Pick the codec your playback targets can decode, then the best encoder for that codec. Better compression is worthless if the device that has to play the file cannot decode it in hardware or software.
Quick recommendations
Section titled “Quick recommendations”| Goal | Video | Audio | Container |
|---|---|---|---|
| Efficient personal library or lossy archive | AV1 (SVT-AV1), 10-bit | Opus, or copy the source | MKV |
| Plays on practically anything | H.264 (x264), 8-bit 4:2:0 | AAC-LC | MP4 |
| TVs, set-top boxes and Apple devices; HDR | HEVC (x265), 10-bit | AAC, or copy AC-3/E-AC-3 | MP4 or MKV |
| Web video | AV1 or VP9, with an H.264 fallback | Opus (WebM) or AAC (MP4) | WebM or MP4 |
| Editing intermediate | ProRes, DNxHR, or lossless UT Video | PCM | MOV or MKV |
| Lossless archive | FFV1 | FLAC | MKV |
Video codecs
Section titled “Video codecs”AV1 gives the best compression of the widely supported codecs, and the encoders are free. Use it for your own library and for modern delivery. Its limitation is hardware decoding on older devices: Android has had an AV1 decoder since Android 10 and requires AV1 on Android 14 devices, and Safari only plays AV1 on devices with a hardware decoder (iPhone 15 Pro, M3 Macs and later). Software decoding with dav1d is fast on desktop CPUs, but an old TV or streaming stick without AV1 hardware may not play it at all. AV1’s Main profile includes 10-bit, so 10-bit output costs no compatibility.
HEVC (H.265) compresses better than H.264 and has hardware decoding on most TVs, phones and GPUs made in the last several years. It is the usual choice for HDR10, HDR10+ and Dolby Vision delivery to TVs. Browser support depends on hardware decoding and is uneven.
H.264 (AVC) is the compatibility choice: it plays on essentially every device and browser. Stick to 8-bit 4:2:0 (High profile); most hardware decoders and browsers cannot play the 10-bit and 4:2:2 profiles.
VP9 sits between H.264 and AV1 in efficiency. It is still useful as a web fallback where AV1 is unavailable, but for new encodes AV1 is usually the better choice.
VVC (H.266) compresses better again, but player and hardware support is still thin. Use it only when you know the target can decode it.
Audio codecs
Section titled “Audio codecs”- Opus is the best general-purpose lossy codec: around 128 kbit/s is close to transparent for stereo music, and it stays usable for speech at very low bitrates. Use it in MKV, WebM and Ogg.
- AAC-LC is the compatibility choice for MP4, Apple software and older hardware.
- FLAC is the standard lossless format. Use it for archives and when you want to re-encode later without stacking losses.
- Copy the source track (
-c:a copy) when it already plays on your targets. Converting one lossy format to another always costs some quality.
Lossless and archival video
Section titled “Lossless and archival video”FFV1 is the usual archival codec. It is standardized (RFC 9043), stores
per-slice CRCs so damage can be detected, and is used by memory institutions. x264 and x265 also
have lossless modes (-qp 0 for x264, -x265-params lossless=1), which are smaller but slower to
decode and edit. Lossless only means what you think if the pixel format stays the same: converting
4:2:2 10-bit to yuv420p throws data away before the lossless encoder sees it.
ProRes and DNxHR are high-bitrate intermediates for editing. They are lossy, though visually very close to the source at their higher profiles.
Containers
Section titled “Containers”- MKV holds practically any codec, any number of audio and subtitle tracks, chapters and font attachments. It is the best container for a personal library.
- MP4 has the widest playback support (phones, browsers, TVs, Apple software). It officially
supports AV1, HEVC, H.264 and VP9 video and AAC, Opus and FLAC audio, but its subtitle support is
limited to timed-text formats such as
mov_text. - WebM is a restricted Matroska profile for the web: VP8, VP9 or AV1 video, Vorbis or Opus audio, and WebVTT subtitles.
See video codec support and browser support for device and browser details, and quality controls once you have chosen an encoder.