MP4Box supports Common Encryption using either CBC or CTR modes, and supports protecting a file with multiple systems.
Could you please explain what clear key encryption consists of ?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
So my questions are :
- What xml file should i have to use clear key encryption
- When i tape : MP4Box -h crypt : it only gives information on ISMACryp
does it mean there was some arguments to pass at the compilation time to be able to manage clear key ?
- I tried also to manage webm format , but it seems even ISMA crypt does not work
thanks for the feed backs
Regards
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I think that you have a problem with trackID in drm file. In case of ISMA (which it worked) your trackID is 2, while in the first case you used trackID=1. Try to change it to trackID=2 !
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It is not normal that encrypting doesn't work. Could you please post your video somewhere, we will verify that !
MP4Box supports Common Encryption using either CBC or CTR modes; you can check http://gpac.wp.mines-telecom.fr/mp4box/encryption/common-encryption/ for more information.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I've tried to encrypt your video using the lastest GPAC version (rev 497, found here: http://gpac.wp.mines-telecom.fr/downloads/gpac-nightly-builds/#Windows%2064%20bits) with drm file as you used, and the video track (trackID = 2) was encrypted (see in attachment). when I played file encrypted.mp4, there was only audio (track 1).
Command: MP4Box -crypt drm_file.xml big_buck_bunny.mp4 -out encrypted.mp4
Could you please retry ?
I don't know how the script works, so I can't tell you whether it's correct or not. Please contact an expert of EME/MSE for more information.
FYI, when I play the encrypted video using our playback (MP4Client) it works well;
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Using playreadyKeyGen.java, i got the correspondence between UUID key and needed elements for xml files:
===============================================
Content key ID =
0x20000000200020002000200000000002
0x00000020002000202000200000000002 (MS binary)
IAAAACAAIAAgACAAAAAAAg== (Base64)
AAAAIAAgACAgACAAAAAAAg== (Base64, MS binary)
Content key =
0x881494BC53A489479F267A521C9FE343
iBSUvFOkiUefJnpSHJ/jQw== (Base64)
Checksum =
0x7E6FB722F7601675
fm+3IvdgFnU= (Base64)
IV =
0x6403E7BBEBA1B785
ZAPnu+uht4U= (Base64)
===============================================
I can check the video encoded_big_buck_bunny.mp4 is crypted.
Now, the problem i have, is to decrypt it using javascript .
I tries several approaches :
- Put the key Id in hex in javascript , like it is done in http://simpl.info/eme/clearkey/
Use dash.js with a manifest file that has a syntax using
[h264 @ 000000000051acc0] illegal reordering_of_pic_nums_idc [h264 @ 000000000051acc0] decode_slice_header error [h264 @ 000000000051acc0] deblocking_filter_idc 27 out of range [h264 @ 000000000051acc0] decode_slice_header error [h264 @ 000000000051acc0] top block unavailable for requested intra mode at 3 0 [h264 @ 000000000051acc0] error while decoding MB 3 0 [h264 @ 000000000051acc0] slice type 32 too large at 3 0 [h264 @ 000000000051acc0] decode_slice_header error [h264 @ 000000000051acc0] non-existing PPS 2 referenced [h264 @ 000000000051acc0] decode_slice_header error [h264 @ 000000000051acc0] no frame! [h264 @ 000000000051acc0] SEI type 181 size 952 truncated at 142 [h264 @ 000000000051acc0] non-existing PPS 1 referenced [h264 @ 000000000051acc0] decode_slice_header error [h264 @ 000000000051acc0] non-existing PPS 3 referenced [h264 @ 000000000051acc0] decode_slice_header error [h264 @ 000000000051acc0] slice type 32 too large at 3 0 [h264 @ 000000000051acc0] decode_slice_header error [h264 @ 000000000051acc0] non-existing PPS 29 referenced [h264 @ 000000000051acc0] decode_slice_header error [h264 @ 000000000051acc0] non-existing PPS 1 referenced [h264 @ 000000000051acc0] decode_slice_header error [h264 @ 000000000051acc0] no frame! [h264 @ 000000000051acc0] SEI type 64 size 1832 truncated at 143 [h264 @ 000000000051acc0] top block unavailable for requested intra4x4 mode -1 at 11 0 [h264 @ 000000000051acc0] error while decoding MB 11 0 [h264 @ 000000000051acc0] deblocking filter parameters 98 44 out of range [h264 @ 000000000051acc0] decode_slice_header error [h264 @ 000000000051acc0] non-existing PPS 19 referenced [h264 @ 000000000051acc0] decode_slice_header error [h264 @ 000000000051acc0] non-existing PPS 2 referenced [h264 @ 000000000051acc0] decode_slice_header error [h264 @ 000000000051acc0] slice type 10 too large at 2 0 [h264 @ 000000000051acc0] decode_slice_header error [h264 @ 000000000051acc0] no frame! [h264 @ 000000000051acc0] SEI type 46 size 376 truncated at 143 [h264 @ 000000000051acc0] left block unavailable for requested intra mode at 0 0
Concerning the KID, KeyValue needed to decrypt the video,
have you already tested a MP4 video crypted with Mp4Box using clear key encoding can be decrypted using javascript (by giving the key ) ?
Hello,
You can't play the crypted video using MP4Client because you use playready as the DRM server, you need a playback which support retrieving the info from playready server (like KID, key value ...) and use it to decrypt file.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Does MP4Box support clear key encryption?
MP4Box supports Common Encryption using either CBC or CTR modes, and supports protecting a file with multiple systems.
Could you please explain what clear key encryption consists of ?
Hi,
I try to crypt a mp4 video with MP4Box that i have installed on linux, using clear key format as described here: https://html5.cablelabs.com/mse-eme/doc/creation.html,
to be able to manage EME/MSE .
For that, i pass a drm file to MP4Box that has value described in the upper page :
<GPACDRM type="CENC AES-CTR"> <DRMInfo type="pssh" version="0"> <BS ID128="9a04f07998404286ab92e65be0885f95"/> <BS bits="32" endian="little" value="762"/> <BS bits="16" endian="little" value="1"/> <BS bits="16" endian="little" value="1"/> <BS bits="16" endian="little" value="752"/> <BS data64="PABXAFIATQBIAEUAQQBEAEUAUgAgAHgAbQBsAG4AcwA9ACIAaAB0AHQAcAA6AC8ALwBzAGMAaABlAG0AYQBzAC4AbQBpAGMAcgBvAHMAbwBmAHQALgBjAG8AbQAvAEQAUgBNAC8AMgAwADAANwAvADAAMwAvAFAAbABhAHkAUgBlAGEAZAB5AEgAZQBhAGQAZQByACIAIAB2AGUAcgBzAGkAbwBuAD0AIgA0AC4AMAAuADAALgAwACIAPgA8AEQAQQBUAEEAPgA8AFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwASwBFAFkATABFAE4APgAxADYAPAAvAEsARQBZAEwARQBOAD4APABBAEwARwBJAEQAPgBBAEUAUwBDAFQAUgA8AC8AQQBMAEcASQBEAD4APAAvAFAAUgBPAFQARQBDAFQASQBOAEYATwA+ADwASwBJAEQAPgBBAEEAQQBBAEUAQQBBAFEAQQBCAEEAUQBBAEIAQQBBAEEAQQBBAEEAQQBRAD0APQA8AC8ASwBJAEQAPgA8AEMASABFAEMASwBTAFUATQA+ADUAVAB6AEkAWQBRADIAaAByAE8AWQA9ADwALwBDAEgARQBDAEsAUwBVAE0APgA8AEwAQQBfAFUAUgBMAD4AaAB0AHQAcAA6AC8ALwBwAGwAYQB5AHIAZQBhAGQAeQAuAGQAaQByAGUAYwB0AHQAYQBwAHMALgBuAGUAdAAvAHAAcgAvAHMAdgBjAC8AcgBpAGcAaAB0AHMAbQBhAG4AYQBnAGUAcgAuAGEAcwBtAHgAPwBQAGwAYQB5AFIAaQBnAGgAdAA9ADEAJgBhAG0AcAA7AFUAcwBlAFMAaQBtAHAAbABlAE4AbwBuAFAAZQByAHMAaQBzAHQAZQBuAHQATABpAGMAZQBuAHMAZQA9ADEAPAAvAEwAQQBfAFUAUgBMAD4APAAvAEQAQQBUAEEAPgA8AC8AVwBSAE0ASABFAEEARABFAFIAPgA="/> </DRMInfo> <CrypTrack IV_size="8" first_IV="0x81171442af182143" isEncrypted="1" saiSavedBox="senc" trackID="1"> <key KID="0x10000000100010001000100000000001" value="0x3a2a1b68dd2bd9b2eeb25e84c4776668"/> </CrypTrack> </GPACDRM>MP4Box -crypt drm_file.xml movie.mp4 -out movie_encrypted.mp4
What i can see (using verbose) is that crypting does not occur .
As a consequence the video is never crypted (i can play it with VLC player).
Now, if i use ISMA syntax, i can crypt the video.
<ISMACryp> <ISMACrypTrack trackID="2" key="0x2b7e151628aed2a6abf7158809cf4f3c" salt="0xf8f9fafbfcfdfeff" scheme_URI="http://schemas.microsoft.com/DRM/2007/03/PlayReadyHeader" kms_URI="http://playready.directtaps.net/pr/svc/rightsmanager.asmx?PlayRight=1&UseSimpleNonPersistentLicense=1" selectiveType="None" ipmpType="None"/> </ISMACryp>But i am not able to decrypt is using EME/MSE , for instance using a html file like this :
http://simpl.info/eme/clearkey/
So my questions are :
- What xml file should i have to use clear key encryption
- When i tape : MP4Box -h crypt : it only gives information on ISMACryp
does it mean there was some arguments to pass at the compilation time to be able to manage clear key ?
- I tried also to manage webm format , but it seems even ISMA crypt does not work
thanks for the feed backs
Regards
Hi,
I think that you have a problem with trackID in drm file. In case of ISMA (which it worked) your trackID is 2, while in the first case you used trackID=1. Try to change it to trackID=2 !
Hi,
no it is not a track Id problem.
<GPACDRM type="CENC AES-CTR"> <DRMInfo type="pssh" version="1" cypherOffset="9"> <BS ID128="6770616363656E6364726D746F6F6C31"/> <BS value="2" bits="32"/> <BS ID128="0x279926496a7f5d25da69f2b3b2799a7f"/> <BS ID128="0x676cb88f302d10227992649885984045"/> <BS bits="8" string="CID=Toto"/> <BS ID128="0xccc0f2b3b279926496a7f5d25da692f6"/> <BS ID128="0xccc0f2b3b279926496a7f5d25da692d6"/> </DRMInfo> <CrypTrack trackID="2" IsEncrypted="1" IV_size="16" first_IV="0x0a610676cb88f302d10ac8bc66e039ed" saiSavedBox="senc"> <key KID="0x279926496a7f5d25da69f2b3b2799a7f" value="0xccc0f2b3b279926496a7f5d25da692f6"/> </CrypTrack> </GPACDRM>I have also the problem with :
now looking at the video :
MP4Box -info video.mp4 , the video is not encrypted.
Does MP4Box allow to manage clear key encoding (needed for EME/MSE) ?
if yes, how ?
thanks
Regards
It is not normal that encrypting doesn't work. Could you please post your video somewhere, we will verify that !
MP4Box supports Common Encryption using either CBC or CTR modes; you can check http://gpac.wp.mines-telecom.fr/mp4box/encryption/common-encryption/ for more information.
Hi,
i have posted the video
Regards
Hi,
I've tried to encrypt your video using the lastest GPAC version (rev 497, found here: http://gpac.wp.mines-telecom.fr/downloads/gpac-nightly-builds/#Windows%2064%20bits) with drm file as you used, and the video track (trackID = 2) was encrypted (see in attachment). when I played file encrypted.mp4, there was only audio (track 1).
Command: MP4Box -crypt drm_file.xml big_buck_bunny.mp4 -out encrypted.mp4
Could you please retry ?
Last edit: Viet-Thanh-Trung NGUYEN 2015-06-12
Hi,
Previously i used version 0.4.5 on linux , after have installed binary and gpaclib.so
I get the gpac-0.5.2-DEV-rev497-gf85197f-master-x64.exe, and using cmd console from window, i can see the video is crypted :
MP4Box -crypt drm_file.xml big_buck_bunny.mp4 -out encrypted.mp4
Last edit: ljl 2015-06-12
THis is an installer, you install it and open the CommandLine (cmd) for using MP4Box. If you prefer Linux, you can also download the latest version for Linux 32/64 bits: http://gpac.wp.mines-telecom.fr/downloads/gpac-nightly-builds/
Ok, now i try to use Clear key content of microsoft play Ready, using this xml file :
<GPACDRM type="CENC AES-CTR"> <DRMInfo type="pssh" version="0"> <BS ID128="9A04F07998404286AB92E65BE0885F95"/> <BS data="application/data;base64:ACE125"/> <BS sourceFile="cenc_blob.bin"/> </DRMInfo> <DRMInfo type="pssh" version="1" cypherOffset="9" cypherKey="0x6770616363656E6364726D746F6F6C31" cypherIV="0x00000000000000000000000000000001"> <BS ID128="6770616363656E6364726D746F6F6C31"/> <BS value="2" bits="32"/> <BS ID128="0x279926496a7f5d25da69f2b3b2799a7f"/> <BS ID128="0x676cb88f302d10227992649885984045"/> <BS bits="8" string="CID=Toto"/> <BS ID128="0xccc0f2b3b279926496a7f5d25da692f6"/> <BS ID128="0xccc0f2b3b279926496a7f5d25da692d6"/> </DRMInfo> <CrypTrack trackID="2" IsEncrypted="1" IV_size="16" first_IV="0x0a610676cb88f302d10ac8bc66e039ed" saiSavedBox="senc"> <key KID="0x279926496a7f5d25da69f2b3b2799a7f" value="0xccc0f2b3b279926496a7f5d25da692f6"/> </CrypTrack> </GPACDRM>Video is correctly encrypted using : MP4Box -crypt drm_file.xml big_buck_bunny.mp4 -out encrypted.mp4
Then, i try to use EME/MSE html script to check if encrypted video can be decoded :
I use the key 0x279926496a7f5d25da69f2b3b2799a7f in the javascript, but the video is still crypted.
I can see following error in Chrome PC inspector :
main_mp4.js:38 Failed to set up MediaKeys DOMException: None of the requested configurations were supported.
Do you know if the key i have used is correct ?
and if MP4Box manages this type of encryption ?
thanks
Regards
Last edit: ljl 2015-06-12
Hello,
I don't know how the script works, so I can't tell you whether it's correct or not. Please contact an expert of EME/MSE for more information.
FYI, when I play the encrypted video using our playback (MP4Client) it works well;
Hi,
I managed following sequence :
MP4Box -v -crypt drm_file_play_ready.xml big_buck_bunny.mp4 -out encoded_big_buck_bunny.mp4
I attach different files for information.
Using playreadyKeyGen.java, i got the correspondence between UUID key and needed elements for xml files:
===============================================
Content key ID =
0x20000000200020002000200000000002
0x00000020002000202000200000000002 (MS binary)
IAAAACAAIAAgACAAAAAAAg== (Base64)
AAAAIAAgACAgACAAAAAAAg== (Base64, MS binary)
Content key =
0x881494BC53A489479F267A521C9FE343
iBSUvFOkiUefJnpSHJ/jQw== (Base64)
Checksum =
0x7E6FB722F7601675
fm+3IvdgFnU= (Base64)
IV =
0x6403E7BBEBA1B785
ZAPnu+uht4U= (Base64)
===============================================
I can check the video encoded_big_buck_bunny.mp4 is crypted.
Now, the problem i have, is to decrypt it using javascript .
I tries several approaches :
- Put the key Id in hex in javascript , like it is done in http://simpl.info/eme/clearkey/
<ContentProtection schemeIdUri="urn:mpeg:dash:mp4protection:2011" value="cenc" cenc:default_KID="20000000-2000-2000-2000-200000000002"/>
None of them can decrypt the video.
So my question is :
How to check the video is correctly encrypted with clear key ?
PS:
I use following syntax to play encrypted video using MP4Client
MP4Client -show -opt section:key=0x20000000200020002000200000000002 encoded_big_buck_bunny.mp4
Is it the correct syntax ?
I have errors :
[h264 @ 000000000051acc0] illegal reordering_of_pic_nums_idc
[h264 @ 000000000051acc0] decode_slice_header error
[h264 @ 000000000051acc0] deblocking_filter_idc 27 out of range
[h264 @ 000000000051acc0] decode_slice_header error
[h264 @ 000000000051acc0] top block unavailable for requested intra mode at 3 0
[h264 @ 000000000051acc0] error while decoding MB 3 0
[h264 @ 000000000051acc0] slice type 32 too large at 3 0
[h264 @ 000000000051acc0] decode_slice_header error
[h264 @ 000000000051acc0] non-existing PPS 2 referenced
[h264 @ 000000000051acc0] decode_slice_header error
[h264 @ 000000000051acc0] no frame!
[h264 @ 000000000051acc0] SEI type 181 size 952 truncated at 142
[h264 @ 000000000051acc0] non-existing PPS 1 referenced
[h264 @ 000000000051acc0] decode_slice_header error
[h264 @ 000000000051acc0] non-existing PPS 3 referenced
[h264 @ 000000000051acc0] decode_slice_header error
[h264 @ 000000000051acc0] slice type 32 too large at 3 0
[h264 @ 000000000051acc0] decode_slice_header error
[h264 @ 000000000051acc0] non-existing PPS 29 referenced
[h264 @ 000000000051acc0] decode_slice_header error
[h264 @ 000000000051acc0] non-existing PPS 1 referenced
[h264 @ 000000000051acc0] decode_slice_header error
[h264 @ 000000000051acc0] no frame!
[h264 @ 000000000051acc0] SEI type 64 size 1832 truncated at 143
[h264 @ 000000000051acc0] top block unavailable for requested intra4x4 mode -1 at 11 0
[h264 @ 000000000051acc0] error while decoding MB 11 0
[h264 @ 000000000051acc0] deblocking filter parameters 98 44 out of range
[h264 @ 000000000051acc0] decode_slice_header error
[h264 @ 000000000051acc0] non-existing PPS 19 referenced
[h264 @ 000000000051acc0] decode_slice_header error
[h264 @ 000000000051acc0] non-existing PPS 2 referenced
[h264 @ 000000000051acc0] decode_slice_header error
[h264 @ 000000000051acc0] slice type 10 too large at 2 0
[h264 @ 000000000051acc0] decode_slice_header error
[h264 @ 000000000051acc0] no frame!
[h264 @ 000000000051acc0] SEI type 46 size 376 truncated at 143
[h264 @ 000000000051acc0] left block unavailable for requested intra mode at 0 0
Concerning the KID, KeyValue needed to decrypt the video,
have you already tested a MP4 video crypted with Mp4Box using clear key encoding can be decrypted using javascript (by giving the key ) ?
The problem i have is :
If we look at http://simpl.info/eme/clearkey:
It uses a clear key for a webm video that can be played using javascript with the key passed, which is correct.
If i change the last byte of the key, the video is no more played, and there is an "error event" in inspector, which seems correct.
Now, if i play the video crypted by MP4Box, i have an other error which is "DOM exception: Failed to set media keys"
So my question is :
Has someone already used MP4Box to crypt and decrypt MP4 video using clear key encryption, and has decrypted it using javascript ?
Thanks
Regards
Last edit: ljl 2015-07-07
Hello,
You can't play the crypted video using MP4Client because you use playready as the DRM server, you need a playback which support retrieving the info from playready server (like KID, key value ...) and use it to decrypt file.