GyeongHoKim
GyeongHoKim

Reputation: 21

Is there any way to decode NALu in browser?

Environment

I am developing a product for a highly restricted environment (e.g., military, casinos) where installing my media server(for transcoding) is not allowed. As a result, I need to handle video decoding entirely in the browser. Specifically, Their system sends me(CEF embedded browser) H264 or H265 NAL units, and I need to decode them into YUV frames within a browser environment.

WebRTC cannot be used. Internet or External Network or something server that placed on outside of their network cannot be used.

Main Question

Here are my main questions:

  1. Are there any alternative methods or APIs to decode H264/H265 NAL units into YUV frames in the browser
  2. Are there any reliable and licensed JavaScript libraries or WebAssembly-based solutions for H264/H265 decoding that can be used in a commercial product?

Thankyou

Already Tried

I have already tried using the WebCodecs API for decoding, but due to compatibility issues(CEF embedded chromium is not available for WebCodecs API), it is not a valid solution for this project.

Additionally, I have looked into WebAssembly-based decoders like Broadway.js (for H264) and H265Player and I already implemented a player using these decoders and deployed some projects. However, I have concerns about the legitimacy of their licensing claims. It seems that the original source code for their WebAssembly implementation is not applied to their projects' license.

Upvotes: 1

Views: 124

Answers (1)

Markus Schumann
Markus Schumann

Reputation: 8264

I would wrap your NAL unit stream into fragmented MP4 chunks and then hand it to the video tag.

For example - start looking here: https://github.com/Vanilagy/mp4-muxer

This will cause latency measured in seconds but you can keep the fragment size small.

Upvotes: 1

Related Questions