Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Irregular fmp4 fragment durations with "progressive" setting #6764

Open
mcassagnes opened this issue Oct 10, 2024 · 1 comment
Open

Irregular fmp4 fragment durations with "progressive" setting #6764

mcassagnes opened this issue Oct 10, 2024 · 1 comment

Comments

@mcassagnes
Copy link

mcassagnes commented Oct 10, 2024

What do you want to do with Hls.js?

Hi, given a HLS VOD with fragmented mp4s (6s fragments, 2s chunks) using byterange requests, I'm wondering why the loaded fragments are of different durations when using the fetch-loader vs xhr-loader.

Given this stream: https://hlsjs.video-dev.org/demo/?src=https%3A%2F%2Fd3bao5x7qmqzgm.cloudfront.net%2Fchunked%2Fmaster.m3u8&demoConfig=eyJlbmFibGVTdHJlYW1pbmciOnRydWUsImF1dG9SZWNvdmVyRXJyb3IiOnRydWUsInN0b3BPblN0YWxsIjpmYWxzZSwiZHVtcGZNUDQiOmZhbHNlLCJsZXZlbENhcHBpbmciOi0xLCJsaW1pdE1ldHJpY3MiOi0xfQ==

Example with xhr-loader showing consistent ~6s fragments for audio and video in the Timeline:

{
  "debug": true,
  "enableWorker": true,
  "backBufferLength": 90,
  "progressive": false
}
Screenshot 2024-10-09 at 9 36 24 PM

Example with fetch-loader showing fragments of varying durations in the Timeline:

{
  "debug": true,
  "enableWorker": true,
  "backBufferLength": 90,
  "progressive": true
}
Screenshot 2024-10-09 at 9 37 28 PM

The reason I am interested in using fetch-loader is to reduce startup time by allowing playback as soon as a chunk is downloaded rather than a full fragment. Is there a less experimental way to achieve this that you recommend?

Thank you

What have you tried so far?

  • Different chunk durations (500ms, 1s, 2s)
  • A custom fetch-loader, but the magic comes from more than just using fetch it is actually appending the chunks as they come which I have not re-implemented

I wanted to try next:

  • fmp4 fragments of equal length as the chunk (6s fragments, 6s chunk with single moof+mdat)
@mcassagnes mcassagnes added Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. Question labels Oct 10, 2024
@mcassagnes mcassagnes changed the title Irregular fmp4 segment durations with "progressive" setting Irregular fmp4 fragment durations with "progressive" setting Oct 10, 2024
@robwalch
Copy link
Collaborator

robwalch commented Oct 17, 2024

I'm guessing this is an issue with parseSegmentIndex or getDuration in mp4-tools and/or the progressive pipeline expecting only one moof in each segment such that it can always get the complete duration of a segment on first usable chunk.

HLS.js updates the parsed playlist model to reflect the duration of parsed media. We don't want to change that, but we do want to represent the duration of segments correctly whether or not they are loaded and parsed in "progressive" mode.

Let me know if this specific bug is something you'd be willing to debug further and provide a fix for. If so I can help root-cause to point you in the right direction.

@robwalch robwalch added Bug Needs contributor and removed Needs Triage If there is a suspected stream issue, apply this label to triage if it is something we should fix. Question labels Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants