shaka-project / shaka-player

JavaScript player library / DASH & HLS client / MSE-EME player
Apache License 2.0
7.14k stars 1.34k forks source link

HLS VoD fMP4 displays Wrong Duration #4507

Closed JC-OS-dev closed 1 year ago

JC-OS-dev commented 2 years ago

Have you read the FAQ and checked for duplicate open issues? Yes.

What version of Shaka Player are you using? v4.2.1-main-9-ge826eb8e AND 3.0.5

Can you reproduce the issue with our latest release version? Yes

Can you reproduce the issue with the latest code from main? Yes

Are you using the demo app or your own custom app? Both

If custom app, can you reproduce the issue using our demo app? Yes

What browser and OS are you using? Chrome 105 and Mac OS 12 Monterey

For embedded devices (smart TVs, etc.), what model and firmware version are you using? Does not Apply

What are the manifest and license server URIs? Sent through email.

What configuration are you using? What is the output of player.getConfiguration()? Sent through email.

What did you do? I created a 1 minute 3 seconds long HLS VOD constructed from fragmented MP4 originating from a larger video. I played the manifest in Shaka Demo. I repeated this with other videos. I repeated this with VLC player and Safari's player, but the bug did not occur there.

What did you expect to happen? I expected the duration of the VOD stream to be 1 minute 3 seconds and for it to be displayed as such throughout the video.

What actually happened? The duration displayed quickly changed from 1 minute 3 seconds to 5 minutes after the first m4s file chunk was downloaded. It then changed back to 1 minute 3 seconds after the last m4s file chunk was downloaded.

JC-OS-dev commented 1 year ago

Hi Shaka team! Any idea where I could start to debug this? Thanks!

joeyparrish commented 1 year ago

I would check the durations of your segments. I tend to use either mp4info from bento4 or Thumbcoil (https://thumb.co.il/) to parse and analyze media segments.

The way duration works in a web browser (with MediaSource APIs) is like this:

  1. The player computes a duration from the playlist metadata
  2. The player sets the duration via MediaSource APIs
  3. When the player appends segments, the duration may be automatically updated by the browser based on the contents of the segment (increasing duration if more data is appended)
  4. When the player has appended the final segment, it informs MediaSource that this is the end of the stream, and the browser may truncate duration to whatever is currently buffered

So you might want to look at chrome:media-internals to get more details on what the browser is doing with the media internally. There may be useful logs, warnings, etc to give you a clue.

JC-OS-dev commented 1 year ago

Thanks for the tips, will look into this!

avelad commented 1 year ago

Can you test with v4.3.3 and main branch? Thanks!

github-actions[bot] commented 1 year ago

Closing due to inactivity. If this is still an issue for you or if you have further questions, the OP can ask shaka-bot to reopen it by including @shaka-bot reopen in a comment.