videojs / http-streaming

HLS, DASH, and future HTTP streaming protocols library for video.js
https://videojs-http-streaming.netlify.app/
Other
2.51k stars 424 forks source link

Really quick question onto DRM #1290

Closed ghost closed 1 year ago

ghost commented 2 years ago

Hey folks,

I dropped out the default question template as this is very general and not a bug or so.

I use FFMPEG (Version 5.0.1 - Encrypted fmp4 not yet supported \n Could not write header for output file) to generate my HLS streams, The output I generate is in fragmented mp4 format (m4s files). Now, I would also like to encrypt my segments using clearkey protection. But for some reason, FFmpeg does not support this for fragmented mp4, only for ts files ... and ts files again incompatible with HEVC, so im kinda stuck.

Now my actual question:

Is VideoJS compatible with encrypted m4s segments? Im asking because the actuall segments encryption can also be done using OpenSSL I guess.

If Icheck here: https://github.com/videojs/http-streaming/blob/main/docs/supported-features.md and read the section: HLS Missing Features. It seems that SAMPLE-AES segment encryption is not supported. Is that the same as clearkey

Thanks in advance

welcome[bot] commented 2 years ago

👋 Thanks for opening your first issue here! 👋

If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can. To help make it easier for us to investigate your issue, please follow the contributing guidelines.

gkatsev commented 2 years ago

fmp4 is supported regardless of the extension name. Though, it's worth noting that HEVC support in browsers is virtually non-existent (aside from safari).

ghost commented 2 years ago

Edge and Safari ;) Anyways, within the next years we will hopefully see more Browsers with HEVC support.

gkatsev commented 2 years ago

Didn't realize that Edge still supported HEVC. Though, their support is dependent on hardware.

Murmur commented 2 years ago

See this stackoverflow answer. You can use ffmpeg to encode non-encrypted video.mp4 and then mp4box to write encrypted segment files. This solution is fine for VOD but not so on LIVE stream.

MP4Box.exe -crypt gpacdrm.xml temp-v1.mp4 -out ./drm/temp-v1.mp4
MP4Box.exe -crypt gpacdrm.xml temp-a1.mp4 -out ./drm/temp-a1.mp4
MP4Box.exe -dash 6000 -frag 6000 -mem-frags -rap -profile dashavc264:live -profile-ext urn:hbbtv:dash:profile:isoff-live:2012 -min-buffer 3000  -bs-switching no -sample-groups-traf -single-traf -subsegs-per-sidx 1 -segment-name $RepresentationID$_$Number$$Init=i$ -segment-timeline -out manifest.mpd temp-v1.mp4#trackID=1:id=v1:period=p0 temp-a1.mp4#trackID=1:id=a1:period=p0

Please note SAMPLE(payload data only, real EME/CDM scenario) and AES128(full file encryption,easy can use OpenSSL for file encryption and decryption) are different things.