nilaoda / N_m3u8DL-RE

Cross-Platform, modern and powerful stream downloader for MPD/M3U8/ISM. English/简体中文/繁體中文.
MIT License
4.77k stars 499 forks source link

Decryption not working with .webm video for MPD with video/audio keys #372

Closed TNAS123 closed 5 months ago

TNAS123 commented 8 months ago

I came across this issue today. If you specify an MPD where source video is .webm, and audio/video encrypted with different keys - then N-m3u8DL-RE is not able to decrypt the video and mux files together. The audio is decrypting fine. It's like the tool does not know it can use a key on the video.

e.g.

If you use shaka-packager manually on the webm file, it decrypts ok. So I think the tool needs to support this format (webm) better for decryption.

whitesnakeftw commented 8 months ago

Same thing just happened to me with this:

N_m3u8DL-RE -mt --use-shaka-packager --key 63626465653765363339616330313832:61653836613537613039366561643735 "https://vcze131.cda.pl/2606897vp9/2606897.mpd"

Both video and audio are .webm and decryption seems to be skipped entirely. Using shaka packager manually on it works.

whitesnakeftw commented 7 months ago

@whitesnakeftw

Hello, excuse me. This 63626465653765363339616330313832 can be found in the mpd file, but where did the 61653836613537613039366561643735 data come from?

I used pywidevine to get the decryption key.

hyww commented 6 months ago

Root cause of this issue seems to be that key ID of .webm cannot be acquired using MP4DecryptUtil.ReadInit().

I've found a way to get key id using shaka-packager.

https://github.com/nilaoda/N_m3u8DL-RE/pull/401