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

HLS - Live stream with fMP4 - infinite loading #1191

Closed
avelad opened this issue Dec 14, 2017 · 16 comments
Closed

HLS - Live stream with fMP4 - infinite loading #1191

avelad opened this issue Dec 14, 2017 · 16 comments
Assignees
Labels
component: HLS The issue involves Apple's HLS manifest format status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Milestone

Comments

@avelad
Copy link
Collaborator

avelad commented Dec 14, 2017

Have you read the FAQ and checked for duplicate issues: Yes

What version of Shaka Player are you using: Master branch

Can you reproduce the issue with the latest code from master: Yes

Are you using the demo app or your own custom app: Demo

What browser and OS are you using: Chrome 63 / Firefox 57 in Ubuntu 17.10

What are the manifest and license server URIs:
(you can send the URIs to shaka-player-issues@google.com instead, but please use GitHub and the template for the rest)
https://cdn.demo.anevia.com/live/eds/dvb_txt/HLS-MP4/dvb_txt.m3u8 (HLS - Live stream with fMP4)

What did you do?
Load the stream

What did you expect to happen?
The video is reproduced

What actually happened?
The video is on infinite loading

hls-live-not-start

The same stream in hls.js works: http://video-dev.github.io/hls.js/demo/

image

@vaage
Copy link
Contributor

vaage commented Dec 18, 2017

@avelad based on your screenshot, it appears your content has not been set up for CORS. If you enable CORS on your server, what happens?

@vaage vaage added the status: waiting on response Waiting on a response from the reporter(s) of the issue label Dec 18, 2017
@avelad
Copy link
Collaborator Author

avelad commented Dec 20, 2017

@vaage , I just tested and I see the same behaviour.

@vaage vaage removed the status: waiting on response Waiting on a response from the reporter(s) of the issue label Dec 21, 2017
@vaage
Copy link
Contributor

vaage commented Dec 21, 2017

@avelad When I try to run your content, I get errors about no access control allow origin. Unless CORS is set-up correctly on the server us to test with, we won't be able to look into this issue.

@vaage vaage added the status: waiting on response Waiting on a response from the reporter(s) of the issue label Dec 21, 2017
@joeyparrish
Copy link
Member

@vaage, you can use --disable-web-security in Chrome to work around CORS for the sake of debugging.

@vaage
Copy link
Contributor

vaage commented Dec 22, 2017

Thanks @joeyparrish.

When I run your content what I see is:

Updating manifest...
hls_parser.js:1182 First segment dvb_txt-video=499712.track_id=10000-9383262.m4s starts at 26304.347555555567
hls_parser.js:1182 First segment dvb_txt-audio_20000=160000.track_id=20000-9383262.m4s starts at 50044175.87422225
hls_parser.js:1182 First segment dvb_txt-video=599040.track_id=10001-9383262.m4s starts at 26304.347555555567
hls_parser.js:1182 First segment dvb_txt-DVBTXT_TTML_fra_5888=10000.track_id=30002-9383262.webvtt starts at 11436.54077777778
streaming_engine.js:1305 (audio:2) looking up segment: presentationTime=11511.904177904129 currentPeriod.startTime=0
streaming_engine.js:1305 (video:8) looking up segment: presentationTime=11511.931177854538 currentPeriod.startTime=0

Which is similar to what your screenshot showed, however it looks like to me (and maybe @joeyparrish) can comment on this too, is that your content times do not line-up with the presentation, so the player is stuck waiting for your content to start. @joeyparrish is that accurate?

@avelad
Copy link
Collaborator Author

avelad commented Dec 22, 2017

@vaage, I tested the same stream in Safari, AVPlayer (iOS), ExoPlayer (Android), hls.js and in all it works

@joeyparrish joeyparrish removed the status: waiting on response Waiting on a response from the reporter(s) of the issue label Dec 22, 2017
@joeyparrish
Copy link
Member

From the log posted by @vaage, it seems that the video and audio timestamps (as understood by our parser) are very different. (26304s for video and 50044175s for audio) Probably, our parser is doing something wrong. We'll take a look. Thanks!

@joeyparrish joeyparrish added type: bug Something isn't working correctly and removed needs triage labels Dec 22, 2017
@joeyparrish joeyparrish added this to the v2.4.0 milestone Dec 22, 2017
@joeyparrish joeyparrish self-assigned this Dec 22, 2017
@joeyparrish
Copy link
Member

In the video stream:

  • moov->mvhd has timescale of 1
  • moov->trak->mdia->mdhd has timescale of 25

In the audio stream:

  • moov->mvhd has timescale of 1
  • moov->trak->mdia->mdhd has timescale of 48000

Our HLS parser makes a bad assumption that the timescale is 90000, which is only true for TS content.

@joeyparrish
Copy link
Member

I've been able to fix the parser locally with regard to timescale, but I still have an issue with your content. It seems that the WebVTT segments have some bad timestamp info in them.

For example:

WEBVTT
X-TIMESTAMP-MAP=MPEGTS:8070850976,LOCAL:00:00:00.000

TS timestamp of 8070850976 is 89676.12s, but the corresponding audio & video segments have timestamps of 93910850.6s. For these to align, the MPEGTS timestamp in the vtt file would need to be "8451976554000".

If we take these apart in hex, it becomes apparent that the timestamp has rolled over at 33 bits:

8070850976    => 0x  1e10f69a0
8451976554000 => 0x7afe10f6610

The bottom 33 bits are very very close, and a quick google search shows that this seems to be a thing in MPEG that libraries have to deal with.

We'll fix the MP4 parsing first, then come back to the rollover issue.

@avelad
Copy link
Collaborator Author

avelad commented Jan 17, 2018

@joeyparrish , do you have any update? We want use fmp4 with HLS, but this issue is limiting us.

@joeyparrish
Copy link
Member

No, I'm sorry. Not yet.

@joeyparrish joeyparrish added the component: HLS The issue involves Apple's HLS manifest format label Jan 18, 2018
@joeyparrish
Copy link
Member

I just pushed the first fix, which fixes assumptions about the timescale in MP4 HLS content.

After that, we need to deal with rollover on load.

After that, ideally, we should also deal with rollover which occurs during playback. Given that this happens every 1.1 days in TS or HLS+VTT, end-users will definitely encounter this in live streams.

shaka-bot pushed a commit that referenced this issue Jan 18, 2018
We can now parse the MP4 timescale from the MP4 init segment.

Issue #1191

Change-Id: Ideaace6e1d5bfb5192a269b91601030b9b4ac53c
@avelad
Copy link
Collaborator Author

avelad commented Jan 19, 2018

Thanks @joeyparrish . I just tested the fix for MP4 timescale and it works!. Can you migrate this fix to 2.3.x?

@joeyparrish
Copy link
Member

Yes, this will be in v2.3.1. I hope to land rollover fixes in v2.3.1 as well.

shaka-bot pushed a commit that referenced this issue Jan 19, 2018
If we see that the timestamps of any HLS live stream are over the
rollover limit, we will offset other streams by that limit until they
and in the same range as the non-rollover streams.

For example, an MP4 stream has no rollover, but an associated
segmented VTT text stream will be mapped to MPEGTS timestamps which do
rollover.  So we offset the VTT timestamps until they are in the same
range as the rest of the content.

This does not handle the case where timestamps roll over during
playback.

Issue #1191

Change-Id: I53bd0c5925601f3a432d653ddfa8a2652db84d71
@joeyparrish
Copy link
Member

All of the rollover-related fixes are now in.

joeyparrish added a commit that referenced this issue Jan 19, 2018
We can now parse the MP4 timescale from the MP4 init segment.

Issue #1191

Change-Id: Ideaace6e1d5bfb5192a269b91601030b9b4ac53c
joeyparrish added a commit that referenced this issue Jan 19, 2018
If we see that the timestamps of any HLS live stream are over the
rollover limit, we will offset other streams by that limit until they
and in the same range as the non-rollover streams.

For example, an MP4 stream has no rollover, but an associated
segmented VTT text stream will be mapped to MPEGTS timestamps which do
rollover.  So we offset the VTT timestamps until they are in the same
range as the rest of the content.

This does not handle the case where timestamps roll over during
playback.

Issue #1191

Change-Id: I53bd0c5925601f3a432d653ddfa8a2652db84d71
joeyparrish added a commit that referenced this issue Jan 19, 2018
When the MPEGTS field rolls over in HLS live WebVTT, we need to avoid
our parsed cue timestamps rolling over as well.  To achieve this, we
simply ignore the X-TIMESTAMP-MAP tag once the segment index is built.

Rollover in TS video and audio segments is handled by mux.js already.

Closes #1191

Change-Id: Ie52734509921973ff47517fab34367ec413a6ca6
@joeyparrish
Copy link
Member

Cherry-picked to v2.3.1.

@shaka-project shaka-project locked and limited conversation to collaborators Mar 22, 2018
@shaka-bot shaka-bot added the status: archived Archived and locked; will not be updated label Apr 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
component: HLS The issue involves Apple's HLS manifest format status: archived Archived and locked; will not be updated type: bug Something isn't working correctly
Projects
None yet
Development

No branches or pull requests

4 participants