Hi, new mpv-user here evaluating the player for some project of mine.
I'm having trouble playing encrypted-mp4 with mpv. Is there anything wrong (usage or misinterpretation of functionality) or is this a bug?
Let's assume we got a sample-video: SampleVideo_1280x720_1mb.mp4 (actual video does not matter).
ffplay SampleVideo_1280x720_1mb.mp4
-> OK
mpv SampleVideo_1280x720_1mb.mp4
-> OK
Let's encrypt it using ffmpeg and cenc-aes-ctr:
ffmpeg -i SampleVideo_1280x720_1mb.mp4 -vcodec copy -acodec copy -encryption_scheme cenc-aes-ctr -encryption_key 76a6c65c5ea762046bd749a2e632ccbb -encryption_kid a7e61c373e219033c21091fa607bf3b8 SampleVideo_1280x720_1mb_encrypted.mp4
ffplay SampleVideo_1280x720_1mb_encrypted.mp4 -decryption_key 76a6c65c5ea762046bd749a2e632ccbb
-> OK
mpv --demuxer-lavf-cryptokey=76a6c65c5ea762046bd749a2e632ccbb SampleVideo_1280x720_1mb_encrypted.mp4
mpv --demuxer-lavf-cryptokey=76A6C65C5EA762046BD749A2E632CCBB SampleVideo_1280x720_1mb_encrypted.mp4 (just to be sure)
-> No -> looks it's beeing interpreted as unencrypted-stream or decryption is broken
-> tons of bitstream errors
mpv --demuxer-lavf-cryptokey=76a6c65c5ea762046bd749a2e632ccbb SampleVideo_1280x720_1mb_encrypted.mp4
mpv --demuxer-lavf-cryptokey=76A6C65C5EA762046BD749A2E632CCBB SampleVideo_1280x720_1mb_encrypted.mp4 (just to be sure)
-> No -> looks it's beeing interpreted as unencrypted-stream or decryption is broken
-> tons of bitstream errors
Everything tested on windows:
Edit:
mpv 0.25.0-7bfeb8b-amended (C) 2000-2017 mpv/MPlayer/mplayer2 projects built on Sun Jun 25 04:29:14 UTC 2017 installed through (non-Vapoursynth-PPA)Checking ffplay --help and searching for crypto-stuff, there are various entries and maybe this is the core of these problems.
Entries:
I suppose my ffplay-command is using case 3, while mpv is using case 1. As the command i used for mpv is the only one i can imagine (only crypto-related) it's the only thing i tried.
I'm not that familiar with ffmpeg/ffplay (at this module-level), but i can imagine, that internally AVFormat and AVOptions are treated very differently.
Because you first need to read mpv manual to figure how to correctly set ffmpeg avoptions.
Fair enough. I can understand the frustration with lazy users, but for us it's not quite as simple as for you developers (the whole AVOptions vs. AVFormatContext vs. ... was realized later). So while i'm thankful for the hint, you could have also add a one-liner to show me what to do.
Nonetheless:
Working (and maybe correct usage):
mpv --demuxer-lavf-o=decryption_key=76a6c65c5ea762046bd749a2e632ccbb SampleVideo_1280x720_1mb_encrypted.mp4
Actually this option exists: https://mpv.io/manual/master/#options-demuxer-lavf-cryptokey
It's from ancient MPlayer times, and apparently it doesn't work.
@wm4 might as well remove it, to prevent confusion.
Thanks for the follow-up remarks!
Actually replaced it with different code.
So what's this about multiple options? cryptokey and decryption_key? Maybe we should set both?
Actually I think only cryptokey works. I used the option named @sschnug claimed to use though.
I can't follow your discussion, but the source of my usage of decryption_key (opposed to cryptokey) comes from this old commit to ffmpeg here.
Oh, so it's a private mp4 option. Better to remove the mpv option then.
And it's gone.