shaka-project / shaka-packager

A media packaging and development framework for VOD and Live DASH and HLS applications, supporting Common Encryption for Widevine and other DRM Systems.
https://shaka-project.github.io/shaka-packager/
Other
1.91k stars 496 forks source link

Adding SUPPLEMENTAL-CODECS tag according to new HLS specs #1164

Closed XingzhaoYun closed 2 months ago

XingzhaoYun commented 1 year ago

HLS has released latest HLS specs and adding optional SUPPLEMENTAL-CODECS tag (https://datatracker.ietf.org/doc/html/draft-pantos-hls-rfc8216bis), is there any plan for supporting this tag? thanks!

joeyparrish commented 1 year ago

I was unaware of that tag, but let's add it as a feature request. I could see this being useful not only for Dolby Vision as mentioned in the spec, but perhaps also for LCEVC.

joeyparrish commented 1 year ago

PRs are always welcome!

sr1990 commented 1 year ago

Hi @XingzhaoYun , looks like there is a similar way to indicate supplemental codecs in DASH using @scte214:supplementalCodecs and @scte214:supplementalProfiles as per https://professionalsupport.dolby.com/s/article/How-to-signal-Dolby-Vision-in-MPEG-DASH?language=en_US

I think PR should support both DASH and HLS. One possible solution:
1) Add an option in MuxerOptions to enable specifying supplemental codec. Example: --enable_supplemental_codecs

2) Add supplemental codec as data member in StreamInfo In MultiCodecMuxerListener::OnMediaStart, set the supplemental_codec in StreamInfo if --enable_supplemental_codecs flag is enabled.

3) In MediaInfo’s VideoInfo, add supplemental codec.

4) HLS In HlsNotifyMuxerListener::OnMediaStart, set the supplemental codec value while creating MediaInfo. Update MediaPlaylist to have supplemental_codec and initialize supplemental_codec if present in media info in https://github.com/shaka-project/shaka-packager/blob/d5ca6e84e6ccd543dc9a79ccc8d07b702010f491/packager/hls/base/media_playlist.cc#L373

While writing the master playlist MasterPlaylist::WriteMasterPlaylist, in BuildStreamInfTag, add SUPPLEMENTAL-CODECS to the playlist if available.

5) For DASH Add supplemental codec as data member in Adaptation Set and Representation. In AdaptationSet::AddRepresentation, create a new representation with supplemental codecs if present. In Representation::GetXml, add @scte214:supplementalCodecs and @scte214:supplementalProfiles if supplemental codecs are present.

cosmin commented 2 months ago

This is now implemented in 3.2 when running with --use_dovi_supplemental_codecs as changing the default behavior woudl be a breaking change.

joeyparrish commented 2 months ago

@cosmin, I'm curious, what part of it would be a breaking change?

cosmin commented 2 months ago

Currently when given an input with DolbyVision packager outputs a manifest/playlist with 2 entries, one with DolbyVision as the codec and one with the base codec. Switching to supplemental codecs would replace that with a single entry using supplemental codecs tagging, which may or may not be supported in all the players yet.