Skip to content

Play HEVC / H.265 in the browser โ€‹

HEVC is where the native <video> tag is least reliable: some browsers have no H.265 decoder at all, others decode it only on certain hardware or only inside MP4. movi-player reads the file itself and decodes HEVC through WebCodecs โ€” on the GPU when the device offers it, and in software with FFmpeg compiled to WebAssembly when it does not.

Quick start โ€‹

html
<script type="module" src="https://cdn.jsdelivr.net/npm/movi-player/dist/element.js"></script>

<movi-player src="https://example.com/clip-hevc.mkv" controls></movi-player>

The container does not matter: HEVC in MKV, MP4 or MPEG-TS plays the same way.

Hardware first, software when needed โ€‹

html
<!-- hardware where available, silent software fallback if it fails -->
<movi-player src="clip-hevc.mp4" sw="auto" controls></movi-player>

<!-- always software (useful for testing) -->
<movi-player src="clip-hevc.mp4" sw controls></movi-player>

Software decoding runs on the CPU: 1080p is comfortable on most machines, while 4K HEVC in software needs a fast one. For phones, serve an H.264 rendition alongside HEVC.

10-bit and HDR โ€‹

10-bit HEVC and HDR10 / HLG sources are detected from the stream's colour metadata. On a browser and display that can present HDR the picture is shown in HDR; elsewhere it is tone-mapped to SDR. See HDR Support.

Check what a file contains โ€‹

js
import { Demuxer, HttpSource } from "movi-player/demuxer";

const demuxer = new Demuxer(new HttpSource("https://example.com/clip-hevc.mkv"));
await demuxer.open();
console.log(demuxer.getMediaInfo()); // codecs, resolution, colour metadata, tracks

Try it โ€‹

Open an HEVC file of your own on moviplayer.com โ€” it is read on your device, not uploaded โ€” or see the examples page for more setups.

FAQ โ€‹

Why won't my HEVC video play in the browser? โ€‹

Many browsers ship without an H.265 decoder for the <video> tag, and the ones that have one often accept HEVC only inside MP4. movi-player reads the file itself and decodes HEVC through WebCodecs, with a software decoder when the hardware path is not available.

Does it use hardware decoding? โ€‹

Yes, where the browser and device offer a hardware HEVC decoder through WebCodecs. Otherwise it decodes in software with FFmpeg compiled to WebAssembly.

Does it play 10-bit and HDR HEVC? โ€‹

Yes. 10-bit HEVC and HDR10/HLG sources are supported; HDR is shown as HDR on displays and browsers that can present it and tone-mapped elsewhere.

Can I force software decoding? โ€‹

Yes, with the sw attribute. sw="auto" falls back to software silently only when hardware decoding fails.