Shaka-player: Tool used for segmenting & encrypting

Created on 12 Dec 2016  路  8Comments  路  Source: google/shaka-player

Hi, i'm reproducing all demos in https://github.com/google/shaka-player; i have two question:

  1. which tool is used for "dash process" (the segmentation process of multimedia files) for .mp4 e .webm files?
  2. Which tool is used for encryption process?

Thanks a lot.

archived question

All 8 comments

For the Shaka Player test content, we use another Google project, Shaka Packager (https://github.com/google/shaka-packager). This is able to handle both segmenting media and encrypting the segments.

Thanks for the response, @TheModMaker.
I've another question:

I'm trying to studying shaka-player and so also shaka-packager... in particular on demand-streaming of encrypted video, using DRM.

In particular, here i've seen this streaming of encrypted file (using Widevine CDM)


{
 name: 'Sintel 4k (multicodec, Widevine)',
 manifestUri: '//storage.googleapis.com/shaka-demo-assets/sintel-widevine/dash.mpd', // gjslint: disable=110

 encoder: shakaAssets.Encoder.SHAKA_PACKAGER,
 source: shakaAssets.Source.SHAKA,
 drm: [shakaAssets.KeySystem.WIDEVINE],
 features: [
 shakaAssets.Feature.HIGH_DEFINITION,
 shakaAssets.Feature.MP4,
 shakaAssets.Feature.PSSH,
 shakaAssets.Feature.SEGMENT_BASE,
 shakaAssets.Feature.SUBTITLES,
 shakaAssets.Feature.ULTRA_HIGH_DEFINITION,
 shakaAssets.Feature.WEBM,
 shakaAssets.Feature.WEBVTT
 ],

 licenseServers: {
 'com.widevine.alpha': '//widevine-proxy.appspot.com/proxy'
 }
 },

and here:

{
 name: 'Tears of Steel (Widevine)',
 manifestUri: '//demo.unified-streaming.com/video/tears-of-steel/tears-of-steel-dash-widevine.ism/.mpd', // gjslint: disable=110

 encoder: shakaAssets.Encoder.UNIFIED_STREAMING,
 source: shakaAssets.Source.UNIFIED_STREAMING,
 drm: [
 shakaAssets.KeySystem.WIDEVINE
 ],
 features: [
 shakaAssets.Feature.EMBEDDED_TEXT,
 shakaAssets.Feature.HIGH_DEFINITION,
 shakaAssets.Feature.MP4,
 shakaAssets.Feature.SEGMENT_TEMPLATE_TIMELINE,
 shakaAssets.Feature.SUBTITLES,
 shakaAssets.Feature.TTML,
 shakaAssets.Feature.ULTRA_HIGH_DEFINITION
 ],

 licenseServers: {
 'com.widevine.alpha': '//widevine-proxy.appspot.com/proxy'
 }
 },

Now, my question is: how do exacly create this type of content? How could i exactly that .mpd, using that licenseServers?
Which flag could i use? What about KID and PSSH?

Sorry for my large number of questions!

For testing content, you can use the widevine_test keys. However, these are public so don't offer much protection. If you want to privately protect content, you will need to contact Widevine directly: http://www.widevine.com/contact.html.

To encrypt content using the test keys, use the following flags, as described in the packager README section Driver Program Sample Usage:

--enable_widevine_encryption \
--key_server_url "https://license.uat.widevine.com/cenc/getcontentkey/widevine_test" \
--content_id "3031323334353637" \
--signer "widevine_test" \
--aes_signing_key "1ae8ccd0e7985cc0b6203a55855a1034afc252980e970ca90e5202689f947ab9" \
--aes_signing_iv "d58ce954203b7c9a9a9d467f59839249"

If you pass --mpd_output [filename] it will generate the MPD for you. That will be playable directly so long as you give the Player the license server. It can be entered in the demo player in the text box, or using player.configure:

player.configure({
  drm: {
    servers: {
      'com.widevine.alpha': '//widevine-proxy.appspot.com/proxy'
    }
  }
});

Thanks for the answer, @TheModMaker. So if i use


--enable_widevine_encryption \
--key_server_url "https://license.uat.widevine.com/cenc/getcontentkey/widevine_test" \
--content_id "3031323334353637" \
--signer "widevine_test" \
--aes_signing_key "1ae8ccd0e7985cc0b6203a55855a1034afc252980e970ca90e5202689f947ab9" \
--aes_signing_iv "d58ce954203b7c9a9a9d467f59839249"
--mpd_output example.mpd

Which part of code that i have written before could i use in the javascript code?
I mean something like:


{
 name: 'Tears of Steel (Widevine)',
 manifestUri: '/http://localhost/my/path/example.mpd', // gjslint: disable=110

 encoder: shakaAssets.Encoder.UNIFIED_STREAMING,
 source: shakaAssets.Source.UNIFIED_STREAMING,
 drm: [
 shakaAssets.KeySystem.WIDEVINE
 ],
 features: [
 shakaAssets.Feature.EMBEDDED_TEXT,
 shakaAssets.Feature.HIGH_DEFINITION,
 shakaAssets.Feature.MP4,
 shakaAssets.Feature.SEGMENT_TEMPLATE_TIMELINE,
 shakaAssets.Feature.SUBTITLES,
 shakaAssets.Feature.TTML,
 shakaAssets.Feature.ULTRA_HIGH_DEFINITION
 ],

 licenseServers: {
 'com.widevine.alpha': '//widevine-proxy.appspot.com/proxy'
 }
 },

It should works, right?

Ok, i answer myself to my question above :)
Its works!
Another question: i have an mp4 file (audio&video) and i would to segment and encrypt both track, and reproduce the entire file in an unique .mpd. How could i do?
I've tried to do this:

First:

packager input=file.mp4,stream=audio,output=file_audio.mp4 \
--profile on-demand \
--enable_widevine_encryption \
--key_server_url "https://license.uat.widevine.com/cenc/getcontentkey/widevine_test" \
--content_id "3031323334353637" \
--signer "widevine_test" \
--aes_signing_key "1ae8ccd0e7985cc0b6203a55855a1034afc252980e970ca90e5202689f947ab9" \
--aes_signing_iv "d58ce954203b7c9a9a9d467f59839249"
--mpd_output example-audio.mpd

Then:


packager input=file.mp4,stream=video,output=file_video.mp4 \
--profile on-demand \
--enable_widevine_encryption \
--key_server_url "https://license.uat.widevine.com/cenc/getcontentkey/widevine_test" \
--content_id "3031323334353637" \
--signer "widevine_test" \
--aes_signing_key "1ae8ccd0e7985cc0b6203a55855a1034afc252980e970ca90e5202689f947ab9" \
--aes_signing_iv "d58ce954203b7c9a9a9d467f59839249"
--mpd_output example-video.mpd

Then i think i should merge these two .mpd in terms of attaching

{
 name: 'Sintel 4k (multicodec, Widevine)',
 manifestUri: '//storage.googleapis.com/shaka-demo-assets/sintel-widevine/dash.mpd', // gjslint: disable=110

 encoder: shakaAssets.Encoder.SHAKA_PACKAGER,
 source: shakaAssets.Source.SHAKA,
 drm: [shakaAssets.KeySystem.WIDEVINE],
 features: [
 shakaAssets.Feature.HIGH_DEFINITION,
 shakaAssets.Feature.MP4,
 shakaAssets.Feature.PSSH,
 shakaAssets.Feature.SEGMENT_BASE,
 shakaAssets.Feature.SUBTITLES,
 shakaAssets.Feature.ULTRA_HIGH_DEFINITION,
 shakaAssets.Feature.WEBM,
 shakaAssets.Feature.WEBVTT
 ],

 licenseServers: {
 'com.widevine.alpha': '//widevine-proxy.appspot.com/proxy'
 }
 },

I only listen audio, not see video.
How could i do? @TheModMaker
Thanks again!

I attach my "new" mpd (insert as .txt instead of .mpd)
example-audio-video.txt

Ok, solved. I should segment&encrypt both tracks with one command:

packager input=LynyrdSkynyrdFreebird.mp4,stream=audio,output=LynyrdSkynyrdFreebirdAudio.mp4 input=LynyrdSkynyrdFreebird.mp4,stream=video,output=LynyrdSkynyrdFreebirdVideo.mp4 --profile on-demand --enable_widevine_encryption --key_server_url "https://license.uat.widevine.com/cenc/getcontentkey/widevine_test" --content_id "3031323334353637" --signer "widevine_test" --aes_signing_key "1ae8ccd0e7985cc0b6203a55855a1034afc252980e970ca90e5202689f947ab9" --aes_signing_iv "d58ce954203b7c9a9a9d467f59839249" --mpd_output example-av.mpd

I should note that you don't need that asset info to play your MPD. That is only used by the demo app to disable assets that aren't supported (e.g. if your browser doesn't support WebM). If you use your own app you only need the URL to the MPD file (and the license server since it's encrypted). See the tutorials.

Also, for further help with packaging, segmented, and encrypting content, you should visit our sister project, Shaka Packager. Here are links to their issue tracker and users list.

If you haven't tried our tutorials yet, please check them out: http://shaka-player-demo.appspot.com/docs/api/tutorial-basic-usage.html

After that, if you have any further questions about playback or configuring the player, please let us know. We'll be happy to help.

Was this page helpful?
0 / 5 - 0 ratings