MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.3k stars 21.48k forks source link

Wat about DRM download scenario? #49017

Closed mc0re closed 4 years ago

mc0re commented 4 years ago

All examples talk about streaming. How can I create a DRM-protected file to be able to fetch it locally (and distribute)? The license is still to be retrieved online.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

DashleenBhandari-MSFT-zz commented 4 years ago

@mc0re , I will investigate and update you. Thanks for raising this issue.

DashleenBhandari-MSFT-zz commented 4 years ago

@mc0re , If offline DRM is what you’re looking for then there’s https://docs.microsoft.com/en-us/azure/media-services/previous/offline-playready-streaming-windows-10 and the other links are for Widevine and FairPlay.

mc0re commented 4 years ago

Thank you, but this is the player. I was looking for a way to produce such contents - an MP4 file, which can be downloaded but cannot be played without a license.

johndeu commented 4 years ago

There is currently no DRM bindings for just static MP4 files. Playready, Widevine and Fairplay never provided any DRM binding for standard MP4 files. The only specification is the Common Encryption spec, which defines how to encrypt a fragmented Mp4 file.
It is still possible to download the fragmented MP4 file and use offline DRM from the major vendors to do what you want - which would be the feature above that explains the Offline DRM options available in our service.

Nobody currently in the market has any plans to add DRM to standard, non-fragmented MP4 files. You would be best to stop searching for such a solution in that space and just work with the fragmented MP4 file versions.

mc0re commented 4 years ago

So you're saying that while the player is capable of playing offline DRM-protected files, there is no way to actually create such one? How did they test it, then?..

Anyway, I'd appreciate some more technical explanation of what a fragmented MP4 file is (related to the CENC / HSL / whatever other Locator one can create in Media Services), and how I can go about it :-) If I understand you right, it is basically dumping the stream onto the disk. But then, I didn't see anything like CencStream - how can I do it? And how do I feed the player with those bits afterwards?

In addition, there is an option to use progressive download, but I couldn't figure out how I can create an "OnDemandOrigin" locator, let alone how to obtain the download link from it.

johndeu commented 4 years ago

No. Players are only capable of playing back fragmented MP4 content that complies with the CMAF specification. IOS supports only CMAF via HLS with Fairplay DRM. Android uses the EXOPLAYER framework and only supports Widevine DRM with CMAF content. Everyone tests with HLS and DASH based content and fragmented MP4 that is packaged for compliance with CMAF and Common Encryption. In that scenario it all works perfectly fine, so it is quite easy to test it.

As far as background on MP4, CMAF and Common Encryption there are lots of sources out there. But it takes some time to learn the details - so i will just cut to the chase to help you move ahead. Basically, you need to use one of the formats supported by the DRM systems. Which means you cannot use progressive download or standard MP4 files.
Did you follow the article above already? https://docs.microsoft.com/en-us/azure/media-services/previous/offline-playready-streaming-windows-10

Some good articles on CMAF https://bitmovin.com/what-is-cmaf-threat-opportunity/ https://www.wowza.com/blog/what-is-cmaf

mc0re commented 4 years ago

I will rush answering you before you disappear :-)

I did go through that article, but now after your explanation it's somewhat more clear :-) Those this phrase put me back on square one: "There are two options for hosting the PlayReady protected MP4 for progressive download".

Otherwise, as I understand, I need to:

The second item is most questionable for me now, as the streaming client is embedded into the player...

mc0re commented 4 years ago

And then, there is ContentKeyPolicyPlayReadyContentType.UltraVioletDownload content type, what does that do?

willzhan commented 4 years ago

On one hand, we wish for downloading a file which is PlayReady protected (for Windows), ideally it is MP4 file. On the other hand, there is no binding between MP4 file and DRM. To overcome this, suppose we have a smooth streaming content (containing multiple bitrates, each bitrate maps to a .ismv file). Suppose you could use a commercial encoder to perform PlayReady encryption on smooth streaming content. After such encryption, you still have the set of .ismv file, now under PlayReady encryption. Each .ismv file is actually a (GOP-aligned) MP4 file. You can just pick anyone of them (say, the highest bitrate one) rename it from .ismv to .mp4. Now you get a PlayReady encrypted MP4 file.

In fact if all you need is offline mode, you can have encoder to output only a single bitrate, with fixed GOP size, MP4. This single bitrate MP4 can be treated as a GOP aligned MP4 or smooth streaming content if you add .ism file.

The remaining question is where you host this PlayReady encrypted content: you can host in Azure Media Services or else.

If you host in Azure Media Services, you can do either online streaming or (progressive) download as a file. Windows 10 player will handle license acquisition in either mode.

If you host on a web server or cloud storage, you can only do download which also meet your needs of PlayReady protected offline mode.

This doc should contain this info: https://docs.microsoft.com/en-us/azure/media-services/previous/offline-playready-streaming-windows-10

johndeu commented 4 years ago

Let us know if there is any feedback on documentation improvements we can make

mc0re commented 4 years ago

Thank you very much for guiding. It was really confusing for me to see the "progressive download" mode, DownloadOnly locator, UltraVioletDownload content type - but still been said that downloading is not what I need... It is somewhat clearer now, though took quite some time to wrap my head around this topic.

As for the documentation, probably explaining somewhere (tagged as "download" and "drm"), what that actually requires:

I'd really appreciate someone answering some more detailed questions.

  1. Downloading the .ismv file is possible after parsing and understanding the .imsc manifest. But this manifest provides separated [chunk] links for video and audio. Is it possible to get a link to a mixed contents? Otherwise I don't know how I feed it to the player...

  2. Is it correct to assume, that even if I delete the asset containing the encrypted output after downloading, I can still request the DRM license for playback?

johndeu commented 4 years ago

Thanks for the feedback! @willzhan and @Juliako - can you incorporate this back into the article and then close the issue?

DashleenBhandari-MSFT-zz commented 4 years ago

Thanks for the help. I will work with @Juliako to update the content. I will go ahead and close this issue. Please feel free to reopen in case you need further assistance.

mc0re commented 4 years ago

Can you answer my questions?