emarsden / dash-mpd-cli

Download media content from a DASH-MPEG or DASH-WebM MPD manifest
https://emarsden.github.io/dash-mpd-cli/
MIT License
302 stars 33 forks source link

native decryption #26

Closed 3052 closed 2 weeks ago

3052 commented 10 months ago

running a command like this:

dash-mpd-cli --key 21b82dc2ebb24d5aa9f8631f04726650:602a9289bfb9b1995b75ac63f123fc86 `
http://example.com/v1/dash/196861183/manifest.mpd

I get this result:

Download failed: I/O error spawning mp4decrypt

I think it would be helpful if the tool here could just do the decryption itself. have you searched for any decryption crates?

emarsden commented 10 months ago

Patches are welcome!

3052 commented 10 months ago

have you searched for any decryption crates?

emarsden commented 10 months ago

Decryption is not actually the most complicated aspect here. CENC content protection doesn't involve encrypting a full file, but rather encrypting media fragments. It requires reading and writing specific box types for MP4 containers, and specific Element types for WebM/Matroska containers. Unfortunately, there are currently no mature crates that I know of for reading and writing MP4 and WebM container formats. This is why external helper applications are used.

To simplify the process of installing a bunch of external dependencies (and for better internet hygiene!), I recommend you run dash-mpd-cli in a podman container; see

https://emarsden.github.io/dash-mpd-cli/container.html

3052 commented 2 weeks ago

FYI if it helps I have a minimal implementation here

https://github.com/3052/sofia

1649 LOC using scc -n _test.go - its a different language but might be a good start point