Menu

#352 Wrong encryption / decryption of HEVC encoded video

v1.0 (example)
closed-fixed
nobody
None
5
2015-08-19
2015-04-30
No

Hi,

I have made the following observation:

When encrypting and decrypting an HEVC encoded video, which I packaged with MP4Box to an .mp4-file, the decrypted video file is not played correctly by VLC nor by MP4Client. It seems that only parts of the video - more precise only deltas of the image from one frame to another - are correctly played or decrypted. If I apply the same procedure to AVC encoded video, it works correctly.

I used the following procedure and installation to prepare the content:

OS: Windows 7, 64bit
The MP4Box version output looks like:

MP4Box - GPAC version 0.5.2-DEV-rev322-gf6fed6c-master
GPAC Copyright (c) Telecom ParisTech 2000-2012
GPAC Configuration: (static configuration file)
Features: GPAC_64_BITS GPAC_HAS_SSL GPAC_HAS_SPIDERMONKEY GPAC_HAS_JPEG GPAC_HAS_PNG

As Sample drm-file.xml I use (according to http://gpac.wp.mines-telecom.fr/mp4box/encryption/common-encryption/):

<gpacdrm type="CENC AES-CTR"></gpacdrm>

<drminfo type="pssh" version="0">
<bs id128="9A04F07998404286AB92E65BE0885F95">
<bs data="application/data;base64:ACE125">
<bs sourcefile="cenc_blob.bin">
</bs></bs></bs></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">
</bs></bs></bs></bs></bs></bs></bs></drminfo>
<cryptrack trackid="1" isencrypted="1" iv_size="16" first_iv="0x0a610676cb88f302d10ac8bc66e039ed" saisavedbox="senc">
<key kid="0x279926496a7f5d25da69f2b3b2799a7f" value="0xccc0f2b3b279926496a7f5d25da692f6">
</key></cryptrack>

The video is encoded with the following command line:

x265-64bit-latest.exe --threads 3 --input sample.yuv --input-depth 8 --input-res 1280x720 --input-csp i420 --fps 25 --bitrate 4700 --output sample-hevc.265

And then I use to package the encoded video by using MP4Box with the command:

mp4box -add sample-hevc.265 -new sample-hevc.mp4

Now I encrypt and decrypt the video file with the following command lines:

MP4Box -crypt drm_file.xml sample-hevc.mp4 -out sample-hevc-enc.mp4
MP4Box -decrypt drm_file.xml sample-hevc-enc.mp4 -out sample-hevc-dec.mp4

Now, when I play the decrypted video by using VLC sample-hevc-dec.mp4 (2.1.5 Rincewind) or mp4client sample-hevc-dec.mp4 (version 0.5.2-DEV-rev322-gf6fed6c-master), the video looks "incomplete" - it seem that only the delta between frames is shown, but not the initial frame.

Discussion

  • Urs-Viktor Marti

    I have downloaded a newer version of the GPAC tools (MP4Box -version = MP4Box - GPAC version 0.5.2-DEV-rev517-g3f59868-master) and did the test again.

    Now the encryption with HEVC works in my setup!

    Thanks for your help and support!

     
  • Romain Bouqueau

    Romain Bouqueau - 2015-08-19
    • status: open --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB