Repository navigation
hevc.js — an hls.js plugin for HEVC playback on browsers without an HEVC decoder #8033
privaloops
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
@hevcjs/hlsjs-plugin adds HEVC playback to hls.js where the browser has no HEVC decoder — Chrome on Windows without a supported GPU, Edge/Firefox without the Microsoft Store extension, most Linux setups.
It doesn't modify or wrap hls.js. It patches MediaSource before the player is constructed: hls.js asks for an hvc1/hev1 SourceBuffer and gets a proxy that accepts HEVC and appends H.264 to the real one. The pipeline is demux → HEVC decoded by a C++17 decoder compiled to WASM → WebCodecs VideoEncoder → fMP4 re-mux, off the main thread for video-only and demuxed-audio renditions (muxed A/V runs it on the main thread for now — two-track muxing isn't in the worker protocol yet). hls.js runs unmodified.
That last call is the part specific to software transcoding: bandwidth-based ABR can't see CPU cost, so on a weak machine the player holds the top level while the buffer drains. The plugin measures per-segment transcode speed and narrows
hls.autoLevelCapping— hls.js still picks, from a shorter list.Works today: fMP4 with video-only, demuxed-audio or muxed audio+video renditions (AAC passed through untouched). Exercised against hls.js 1.7.x — 1.6.6 changed how hls.js drives
SourceBuffer.timestampOffset, so older versions in the declared peer range aren't really covered.Doesn't, yet: HEVC-in-MPEG-TS is unvalidated, out-of-buffer seeks on muxed streams are untested.
Costs: the first segment has to be transcoded before playback starts, plus real CPU while it runs. On iPhone Safari nothing is transcoded — the intercept patches classic MediaSource, which isn't there — playback falls back to native HEVC. When native HEVC is available anywhere else the plugin detects it and does nothing.
Demo, with a force-transcoding toggle: https://hevcjs.dev/demo/hls.html
Source: https://github.com/lid-labs/hevc.js — MIT
Bug reports from real streams are what I need most, TS-based ones especially.
All reactions