mp4box.js icon indicating copy to clipboard operation
mp4box.js copied to clipboard

Streaming a MP4 to Browser

Open sassyn opened this issue 9 years ago • 3 comments
trafficstars

Hi,

I have being working on a project to build a live streaming solution without the use of HLS or DASH mpeg due to latency issues and cross platform solution.

The Idea was to make the browser decode a H264 video frames and also AAC audio frames.

I manage to do so by using two websocket to stream one video and once audio from FFMPEG.

However I have issues with Syncing the audio/video.

I wanted to know if mp4box.js has the option to demux a live stream mp4 container. If so, I would use only 1 websocket and demux the stream to play the h264/aac. Thanks Sassy

sassyn avatar May 27 '16 07:05 sassyn

I wanted to know if mp4box.js has the option to demux a live stream mp4 container.

Demuxing audio/video from an mp4 container (fragmented or not) is supported, you can check the demo. When you say live, I assume your input is a long-running fragmented mp4, right? That should work as there is no difference between a live fragmented stream and non-live fragmented stream. From the point of view of mp4box, fragmented data keeps being appended. If you are pushing several mp4 files, you'd have to reset mp4box after each end of file or use several mp4box.

cconcolato avatar May 27 '16 08:05 cconcolato

Well,

I have a RTSP stream which being transcoded with FFMPEG to be H264 baseline API. NAL unit send over a TCP RAW socket to nodejs application, which then transported via websocket to the client browser.

The same RTSP stream is being transcoded to a AAC format over a different TCP Raw socket to a different nodejs application. with them transported via second websocket to the client browser.

Magic or not - it being working, all decoding done via the Browser javascipt engine, tested on Iphone/Android/Safari/Chrome/Firefox.

The problem is the leg and audio sync. The idea is to stream via one websocket a long-running fragmented mp4, demux it on the client side via javascript and decode it with the same javascipt engine I'm using now.

What do you think? Thank You!

sassyn avatar May 27 '16 09:05 sassyn

That's an interesting use case for MP4Box.js! This is currently not supported but could be added.

cconcolato avatar Jun 17 '16 16:06 cconcolato