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

Infer CODECS and other missing information in HLS #805

Closed
jamescahall opened this issue May 16, 2017 · 18 comments
Closed

Infer CODECS and other missing information in HLS #805

jamescahall opened this issue May 16, 2017 · 18 comments
Assignees
Labels
component: HLS The issue involves Apple's HLS manifest format status: archived Archived and locked; will not be updated type: enhancement New feature or request
Milestone

Comments

@jamescahall
Copy link

  • What version of Shaka Player are you using?

2.1.1

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

Yes

  • Can you reproduce the issue with the latest code from master?

Yes

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

Either

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

Yes

  • What browser and OS are you using?

Any

  • What did you do?

Latest code says it supports unprotected HLS. Trying to load standard m3u8.

  • What did you expect to happen?

Playback HLS file playable by standard HTML5 video tag.

  • What actually happened?

Throws 4023 error asking for CODECS in video track attributes. When using standard H264 codecs, this should not be required and is not a requirement to include in HLS manifests. Should default to trying to use H264 decoders.

@jamescahall
Copy link
Author

adding manually to each flavor:
,CODECS="avc1.42E01E"

Doesn't appear to solve the issue.
Example flavor m3u8 it links to has:
#EXTM3U
#EXT-X-TARGETDURATION:10
#EXT-X-ALLOW-CACHE:YES
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:1
#EXTINF:2.000,
LINK_TO_TS_FILE HERE

@joeyparrish
Copy link
Member

Codec information is required in HLS because we've always been able to expect manifests to provide that information. It seems reasonable to make some basic assumptions about HLS, though, if the information is often omitted.

You said "trying to load standard m3u8". Can you provide a link? It will be much easier to diagnose if we can see the manifest and reproduce the error.

I also noticed that you wrote LINK_TO_TS_FILE_HERE in your sample manifest. Keep in mind that for MediaSource-based playback, the browser has to support both the codecs and the container format. Last time I checked, only Safari, Edge, and Chromecast support TS.

@joeyparrish joeyparrish added the type: question A question from the community label May 16, 2017
@jamescahall
Copy link
Author

I can't provide a link here for security reasons. I can send you one if you have a private method to do so. As for your comment on TS, it is supported by those you listed but also by Chrome and nearly every TV that runs an HTML5 based browser (including Opera and Firefox OS). It is the most common format used for HLS delivery so if HLS is supported, TS should be as well.

As for the CODECs information, the HLS specification lists it as a SHOULD include not a MUST include. See here:

https://tools.ietf.org/html/draft-pantos-http-live-streaming-22

Every EXT-X-STREAM-INF tag SHOULD include a CODECS attribute

I've been working on HLS streams for 6+ years now and frequently they do not contain the CODEC value for video streams using the standard avc1.42E01E encoding.

@joeyparrish
Copy link
Member

You can find my email address in the CONTRIBUTORS file to send me a link privately.

Contrary to what you are saying about TS, it is not supported in Chrome. You can see the results of a MediaSource probe by visiting https://shaka-player-demo.appspot.com/support.html in the browser of your choice. In Chrome, for example, you'll see this line:

 "video/mp2t; codecs=\"avc1.42E01E\"": false,

When queried for MPEG 2 TS support, Chrome reports that it is not supported.

While MP4 is supported by every major browser (Chrome, Firefox, Edge, IE11, Safari, Opera, Chromecast), you will find that TS support is much more limited (Edge, IE11, Safari, Chromecast). I do not have any data on TV platforms.

@jamescahall
Copy link
Author

jamescahall commented May 16, 2017 via email

@jamescahall
Copy link
Author

jamescahall commented May 16, 2017 via email

@jamescahall
Copy link
Author

jamescahall commented May 16, 2017 via email

@joeyparrish
Copy link
Member

HLS with TS should work in Shaka Player in browsers (or TVs) that support TS via MediaSource. The code to recognize TS in HLS is already in Shaka Player. We don't transmux it to mp4 on platforms that don't support it, so you should not expect TS to be supported on Chrome, Firefox, or Opera.

I will look at the manifest you sent me and we can add sensible defaults for codecs.

@jamescahall
Copy link
Author

jamescahall commented May 17, 2017 via email

@joeyparrish
Copy link
Member

Does it work in Microsoft Edge?

@jamescahall
Copy link
Author

Sorry but I am unable to confirm that as I do not have a windows computer to test on.

@joeyparrish
Copy link
Member

You may be running into this: #743

@joeyparrish joeyparrish added type: enhancement New feature or request and removed type: question A question from the community labels May 19, 2017
@joeyparrish joeyparrish self-assigned this May 19, 2017
@joeyparrish joeyparrish added this to the v2.2.0 milestone May 19, 2017
@joeyparrish
Copy link
Member

I have looked at the HLS manifest you sent, and there are several issues preventing playback. Here's a sanitized version of what's in the manifest, for the sake of documenting what we're doing:

#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=479232,RESOLUTION=480x256
http://foo.bar/1/index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=154624,RESOLUTION=480x256
http://foo.bar/2/index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=248832,RESOLUTION=480x256
http://foo.bar/3/index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=674816,RESOLUTION=480x256
http://foo.bar/4/index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1011712,RESOLUTION=640x352
http://foo.bar/5/index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=1317888,RESOLUTION=848x480
http://foo.bar/6/index.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=56320,CODECS="mp4a.40.2"
http://foo.bar/7/index.m3u8

These are the main issues with this in today's Shaka Player:

  1. No CODECS attribute in most EXT-X-STREAM-INF tags
  2. Video+Audio variants use multiplexed streams (which we do not currently assume)
  3. Audio-only variant is not multiplexed (so assuming multiplexed everywhere would be a mistake)

The manifest appears to come from Kaltura, so I will also reach out to them and ask if they can add more information to these playlists in a future version of their product. From the HLS spec:

Every EXT-X-STREAM-INF tag SHOULD include a CODECS attribute.

In the mean time, there are a few things we can do to better infer the content characteristics:

  1. If there is an AUDIO attribute pointing to audio streams, assume the stream contains video only.
  2. If there is a VIDEO attribute pointing to video streams, assume the stream contains audio only.
  3. If there is a RESOLUTION attribute, assume the streams contains at least video. If there is no AUDIO attribute, it may also contain audio muxed in.

The spec also states:

If an EXT-X-STREAM-INF tag or EXT-X-I-FRAME-STREAM-INF tag contains the CODECS attribute, the attribute value MUST include every media format [RFC6381] present in any Media Segment in any of the Renditions specified by the Variant Stream.

So we will assume that a single codec string means the content is not multiplexed.

@jamescahall
Copy link
Author

jamescahall commented May 19, 2017 via email

@joeyparrish
Copy link
Member

@itaykinnrot, can you point me in the right direction to file a feature request on Kaltura? See my comment above for context.

@joeyparrish joeyparrish added the component: HLS The issue involves Apple's HLS manifest format label May 19, 2017
@joeyparrish joeyparrish changed the title Why is CODECS required in HLS Manifest? Infer CODECS and other missing information in HLS May 19, 2017
joeyparrish added a commit that referenced this issue May 23, 2017
 - Default CODECS attribute to 'avc1.42E01E,mp4a.40.2'
 - Infer stream type and multiplexed status from number of codecs,
   associated groups, and video-specific attributes.
 - Recombine codec strings when we detect multiplexed content

Closes #805

Change-Id: Ib1298033360b52091b7d871fed0eca047a00ad22
@joeyparrish
Copy link
Member

This fix was just released in v2.1.2.

@jamescahall
Copy link
Author

Confirmed the error is gone. Unfortunately typical HLS is till not running in Safari due to the TS bug.

@joeyparrish
Copy link
Member

Thank you for confirming. We can discuss Safari TS issues further on #743.

@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: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants