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.9k stars 496 forks source link

[DASH] Add content steering support. #1403

Open sr1990 opened 1 month ago

sr1990 commented 1 month ago

Summary from proposal at : https://dashif.org/docs/DASH-IF-CTS-00XX-Content-Steering-Community-Review.pdf Content distributors often use multiple Content Delivery Networks (CDNs) to distribute their content to the end-users. They may upload a copy of their catalogue to each CDN, or more commonly have all CDNs pull the content from a common origin. Alternate URLs are generated, one for each CDN, that point at identical content. DASH players may access alternate URLs in the event of delivery problems. Content steering describes a deterministic capability for a content distributor to switch the content source that a player uses either at start-up or midstream, by means of a remote steering service. The DASH implementation of Content Steering also supports the notion of a proxy steering server which can switch a mobile client between broadcast and unicast sources.

dash-if content steering example is at https://reference.dashif.org/dash.js/latest/samples/advanced/content-steering.html Example MPD used above: https://www.content-steering.com/bbb/playlist_steering_cloudfront_https.mpd

POC that I worked on using shaka packager and Expoplayer is mentioned in the issue at: https://github.com/Dash-Industry-Forum/Content-Steering/issues/17 Shaka packager branch: https://github.com/sr1990/shaka-packager/tree/content_steering1

As per above branch, the following command

 input=udp://[127.0.0.1:1234?interface=0.0.0.0,stream=video,init_segment=live-video1.mp4,segment_template=live-video1-$Number$.mp4](http://127.0.0.1:1234/?interface=0.0.0.0,stream=video,init_segment=live-video1.mp4,segment_template=live-video1-$Number$.mp4)' \
input=udp://[127.0.0.1:1234?interface=0.0.0.0,stream=video,init_segment=live-video2.mp4,segment_template=live-video2-$Number$.mp4](http://127.0.0.1:1234/?interface=0.0.0.0,stream=video,init_segment=live-video2.mp4,segment_template=live-video2-$Number$.mp4)' \
 --mpd_output live.mpd \
 --content_steering_default_service_location "alpha,1234" \
 --content_steering_url "http://10.0.0.221:3000/ContentSteering" \
 --content_steering_base_urls "alpha=http://10.0.0.221:3000/A/,beta=http://10.0.0.221:3000/B/" \
 --segment_duration 4 \
 --content_steering_locations "1234=http://10.0.0.221:3000/locationA/live.mpd,5678=http://10.0.0.221:3000/locationB/live.mpd"

will create mpd that contains the following elements

Location

  <Location serviceLocation="5678">http://10.0.0.221:3000/locationB/live.mpd</Location>

BaseUrls

  <BaseURL serviceLocation="beta">http://10.0.0.221:3000/B/</BaseURL>

Content Steering

<ContentSteering defaultServiceLocation="alpha,1234">http://10.0.0.221:3000/ContentSteering</ContentSteering>

Shaka packager needs to add the following a. baseurl support along with attributes Content steering base urls are added using --content_steering_base_urls above but base url implementation needs to be extended to specify the following attributes:

BaseUrlAttributes

Currently baseurl/s is added using --base_urls and does not support any of the above attributes. I think support for only serviceLocation attribute should be added for now as --base_urls , same as --content_steering_base_urls mentioned above. Rest attributes can be added as needed.

b. Location Right now there is no way to specify the mpd Location. Option similar to --content_steering_locations mentioned above should be added to specify Location.

c. ContentSteering element As per the proposal above ContentSteering element = A URL that can be used to access the Content Steering server. The URL points to a DASH Content Steering Manifest (DCSM) and has multiple attributes. In the POC, I have added --content_steering_url : which points to content steering server and --content_steering_default_service_location : specifies attribute DefaultServiceLocation --content_steering_query_before_start : specifies attribute queryBeforeStart.

I do not like the command line arguments that I have added but do not have a better idea.

Players supporting content steering:

  1. Shaka player: https://github.com/shaka-project/shaka-player/pull/5710
  2. Dash.js player: https://github.com/Dash-Industry-Forum/dash.js/issues/4030

Exoplayer: (not implemented yet) https://github.com/google/ExoPlayer/issues/11203

Useful links:

  1. https://dashif.org/docs/DASH-IF-CTS-00XX-Content-Steering-Community-Review.pdf
  2. https://github.com/Dash-Industry-Forum/Content-Steering/issues/17
  3. MPD: https://www.content-steering.com/bbb/playlist_steering_cloudfront_https.mpd
  4. Example with dash.js: https://reference.dashif.org/dash.js/latest/samples/advanced/content-steering.html

Unfortunately, I do not have time to work on this but can help with testing.