gpac / mp4box.js

JavaScript version of GPAC's MP4Box tool
https://gpac.github.io/mp4box.js/
BSD 3-Clause "New" or "Revised" License
1.97k stars 332 forks source link

Figure out best parameters to use #24

Closed guypaskar closed 3 years ago

guypaskar commented 9 years ago

There is significant performance changes when using different parameters (mainly different chunk size and different segment duration) - By performance I mean load time of the video and seek durations.

i.e when reducing the segment duration the video loads faster but can be stuck very fast. when increasing it, it takes time for the video to load but when it starts playing it should be Ok.

What would be a good way to decide the optimum for a specific video?

rbouqueau commented 9 years ago

I assume you are talking about DASH.

The DASH standard has a minBufferTime attribute ('-min-buffer' option in MP4Box) which precises the duration of data that needs to be loaded by the player before decoding. Theorically, the segmentation/fragmentation shouldn't have any impact.

However most players do not respect the indications in the MPD. And most generators hardcode this value.

For your information, HLS uses 10s segments, and the Apple player implementation have 20 to 30s buffering to ensure it will never underflow. Live Smooth Streaming has 2s segments but I can't tell about the buffering size/duration.

The buffering depends on the variation of bitrate of your stream. With CBR, you can have a minimum value. This value depends on the content itself and the client's connectivity (you need to buffer more in mobility than when at home with a stable connection).

I hope it helps. Please don't forget to close the issue when you"re done.

guypaskar commented 9 years ago

I'm actually talking about a regular mp4 that is played via media source. no mpd and no DASH.

Also, How do I control the duration of a segment? I can only control the frames per segment, and then it really depends on the bitrate of the video.

Still , I want to figure out, per video, what would be the best parameters such that the video will load and seek the fastest.

Thanks

guypaskar commented 9 years ago

For example, If I was for a very high quality video a high segment duration the results are not so good since each segment is very large (since the frames are high quality)

So i'm trying to figure out good benchmarks for the video to play the best depending on the video quality , size and so on...

cconcolato commented 9 years ago

@guypaskar That's an interesting question indeed. I had noticed that Chrome was not behaving properly if I set a short segment duration. Also, note that in the current version mp4box.js creates movie fragment with 1 sample per fragment. This certainly adds overhead. This is another possible setting to tweak. If you run experiments, I'll be happy to see the results.

cconcolato commented 9 years ago

I just added in 90c67b1827 bit rate information for the file and per track. This should give you an indication of the minimum chunk size and download period that is needed to avoid the video getting stuck. The segment size should not have impact (except on the processing by the browser, but in the latest test with 1 frame = 1 segment I did not notice any problem). HTH.