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

Missing frames in TS causes hls.js to create unnecessary gaps in buffered MP4 #409

Closed
bikegriffith opened this issue Apr 26, 2016 · 4 comments

Comments

@bikegriffith
Copy link
Contributor

We know we have some missing frames inside some TS files, but the PTS/DTS values contained within should allow the media source to play through consecutive segments at the segment boundaries without skipping.

Sample Problem M3U8:
M3U8 Link | Demo Link

Symptoms:

  • the buffered timeline shows a small gap in between segments 0-1 and a large gap in between segments 1-2.
  • hls.js tries to compensate for the small gap by seeking over the buffer hole at the end of segment 0, which keeps playback moving but adds an unnecessary "skip"
  • hls.js is unable to play over the large (5s) gap

What we suspect is:

  • the mp4-remuxer is shifting frames that occur after a gap earlier rather than delaying them until the proper presentation timestamp.
  • this left-shifting of frames creates a sometimes large gap at the end of buffered range, causing MSE to abort playback.
  • we know there are some missing frames inside the .ts files, but this should be OK (ffmpeg can properly stitch together an MP4 that plays through without issue).
@JHartman5
Copy link
Contributor

In inspecting an mp4 file that ffmpeg stitched together from the same TS files, I notice that ffmpeg inserts the stts atom for both tracks which contains frame timing information. It seems that hls.js inserts an empty version of this atom. Would adding actual values in this atom help?

@JHartman5
Copy link
Contributor

I had some success by detecting missing audio frames in the TSDemuxer and pushing duplicate or "silent" frames into the gaps. However, this doesn't feel right to me -- I would expect the mp4 container to be able to accurately represent individual frame timing (including gaps), but I don't know enough about the mp4 format to know if this is the case.

@mangui
Copy link
Member

mangui commented May 4, 2016

regarding missing audio frames, the only solution seems to be the injection of silent frames as you do in #412

@mangui
Copy link
Member

mangui commented May 4, 2016

closing this ticket, remaining to be tracked under #412

@mangui mangui closed this as completed May 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants