gpac / mp4box.js

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

Video playeback stops always exactly at time 198:50 (3h18m50s), regardless of video #264

Open pelnar opened 2 years ago

pelnar commented 2 years ago

Hi cconcolato et all, I have a question regarding this great tool, mp4box.js. I've been using mp4box.js to play mp4 videos streamed from a web server with HTTP partial content responses. We have large videos (>1GB) with multiple video tracks in a single MP4 and this works for playback of multi track videos in browser (it's actually the only solution we have found that would really work, great job!). I had to solve some troubles with some atoms, etc. but so far so good. So I am quite familiar with the product. I started from the example, modified the Downloader a bit and then generated or own Javascript library based on the example which uses mp4box.js library.

We have however found now, during our testing, that any video file stops exactly at time 198:50 (198 minutes from start = 3h18m50s), regardless of the file. It does not matter how many video tracks are there, it is not a problem bound to a single specific video, it is reproducible. It is not bound to exact byte position in the file, just the exact time. Also the web server works well and returns the date correctly above the time (verified also with standard HTML5 video player who can play over this time). If I seek over this time, the seeking does not occur, video stays where it currently is. During playback the video stops at that exact time (198:50)

To describe more, during seeks and playback, there are logs being generated as the buffers get downloaded with some timeouts before next buffers are fetched - like this: [Downloader] Next download scheduled in 6268 ms. This is expected and OK.

Once we get to that time 198:50 app just keeps downloading more and more immediately . It is because inside computeWaitingTimeFromBuffer method (which comes from the example), the current video playback time is not found withing the activeSourceBuffers and their buffered items . For some reason the buffer probably does not get appended? But I cannot seem to figure out why.

It's this file in the example (https://github.com/gpac/mp4box.js/blob/master/test/index.js), line 700. On line 693 the duration is 0 because both boundaries are 0. But why is the buffer not added?

Any idea would be much appreciated. Thank you!