finds.dev← search

// the find

sonysuqin/WasmVideoPlayer

★ 1,390 · JavaScript · GPL-3.0 · updated Feb 2020

Play file/stream with wasm & webgl & web audio api, using ffmpeg for multi codec support, especially for h265,support http, websocket, http-flv stream.

A proof-of-concept H.265 web player that runs FFmpeg compiled to WebAssembly, using WebGL for YUV rendering and Web Audio API for PCM playback. It targets the specific problem of playing H.265 video in browsers that have no native support, which in 2019 was basically all of them. Aimed at developers who need HEVC playback in a browser environment and can't wait for native support.

The threading model is well-considered: download, decode, and render are split across Web Workers with Transferable Objects to avoid copying large frame buffers across worker boundaries. YUV-to-RGB conversion is offloaded to a WebGL shader rather than done in JS or via libswscale, which is the right call for performance. Buffer control is explicitly designed around WASM's lack of blocking I/O — the player won't call into FFmpeg unless enough data is already buffered, avoiding the class of hangs you'd otherwise get. The build scripts are self-contained and the FFmpeg version is pinned, so the WASM artifact is reproducible.

Abandoned since February 2020 — FFmpeg 3.3 is ancient, Emscripten 1.39.x is ancient, and the WASM threading situation it worked around has since improved significantly. Seek is not implemented and is noted as such; for anything other than linear playback this is a dealbreaker. The repo ships compiled binary artifacts (libffmpeg.js, libffmpeg.wasm, the static libs in dist/) alongside source, which means you're trusting prebuilt binaries from a stranger's machine. The WebSocket streaming path exists but the server-side is a minimal Node.js script with no real protocol — you'd have to build the actual streaming infrastructure yourself.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →