MuxZeroNet / ZeroMux

[DEPRECATED] Real time video transmuxing and streaming library designed for ZeroNet
39 stars 4 forks source link

I tried the mp4 and fmp4 format in slow connection, mp4 performance is better than fmp4 #2

Open cxgreat2014 opened 7 years ago

cxgreat2014 commented 7 years ago

fmp4 need 1.3Min to load data ,then start play: image But MP4,only 20sec image

MuxZeroNet commented 7 years ago

This multiplexer is experimental. I have never tested the muxer on fragmented MP4. It is designed to remux normal MP4 files. Fragmented MP4 files can be put directly into source buffer.

What's your Zite address?

MuxZeroNet commented 7 years ago

Why do we prefer fMP4?

ISO people who originally designed MP4 file format decided to allow moov box, which is the box containing codec, track and frame information, to be put at the end of a file. The only way to find the last box is to download the entire file.

When W3C tries to make MP4 work on the Internet, they have to force developers to convert their files into a smooth streaming format, known as fragmented MP4. However, not all kinds of fMP4 files are suitable for streaming, despite what they are designed for. The internal linked list of an fMP4 file can link backwards, and can even link to another file. Therefore, W3C then decided to use fMP4 files with straight forward data structure. For instance, W3C requires that:

A Movie Fragment Box uses movie-fragment relative addressing when the first Track Fragment Run(trun) box in each Track Fragment Box has the data-offset-present flag set and either of the following conditions are met:

  • Every Track Fragment Box in a Movie Fragment Box has the default-base-is-moof flag set.
  • ...

ISO made a mess for future developers, so developers have turned to use FLV, fMP4 and WebM, file formats that are much easier to deal with.

Advice for you

If you have a small video file, you don't need to use ZeroMux. You can load it directly with

<video src="path/to/video.mp4" width="170" height="85" controls>
</video>

If you have a big video file, then you need to cut it into small chunks.

cxgreat2014 commented 7 years ago

I tried to use ipfs to build a youtube on zeronet in the past, but ipfs unlike zeronet automatic seed files which people visit it, and ipfs often clear up local cache file, so if my computer offline my site will take down ..and my computer bandwidth is insufficient, with under GFW, result is when visitors in my site watching videos often need to wait for a long time to see it, and very slow, so I closed my site in last week, the project address here: https://github.com/cxgreat2014/IPFS_MovieOnline , now I'm exploring new ways to Distribute video files, more likely to zeronet native implementation

MuxZeroNet commented 7 years ago

@cxgreat2014 This commit contains new APIs and a simple video player. Download the newest master branch.

Run the new ./wizard.py and upload an MP4 video file. Then hack the source code of example-player.html so that it reflects your own settings. It should be very straight forward.