如何播放使用MP4box加密的视频

时间:2016-05-12 03:01:34

标签: xml video encryption

我正在尝试使用MP4box播放我使用这些选项进行CENC加密的视频。

  1. mp4box -crypt test.xml 1.mp4 -out clear.mp4
  2. 这是我的xml文件:

    <?xml version="1.0" encoding="UTF-8"?>
    <GPACDRM type="CENC AES-CTR">
    <!-- example for GPAC 'clear' DRM System - keys are listed after the content and UL follows -->
    <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="1" IsEncrypted="1" IV_size="16" first_IV="0x0a610676cb88f302d10ac8bc66e039ed" saiSavedBox="senc">
    <key KID="0x202122232425262728292a2b2c2d2e2f" value="0x15161718191a1b1c1d1e1f2021222324"/>
    </CrypTrack>
    <CrypTrack trackID="2" IsEncrypted="1" IV_size="16" first_IV="0x0a610676cb88f302d10ac8bc66e039ed" saiSavedBox="senc">
    <key KID="0x12131415161718191a1b1c1d1e1f2021" value="0x25262728292a2b2c2d2e2f3031323334"/>
    </CrypTrack>
    </GPACDRM>
    

    但是,如何在不解密的情况下播放它。 只是用这个xml播放它? 请帮助我,非常感谢。

1 个答案:

答案 0 :(得分:0)

GPAC撰稿人。请注意,我们希望您使用github问题。

您的XML文件错误。您提供KID&#34; 0x279926496a7f5d25da69f2b3b2799a7f&#34;和#34; 0x676cb88f302d10227992649885984045&#34;对于DRM计划。但是跟踪加密的KID是无关的。

您的案例中的正确XML是:

<?xml version="1.0" encoding="UTF-8"?>
<GPACDRM type="CENC AES-CTR">
<!-- example for GPAC 'clear' DRM System - keys are listed after the content and UL follows -->
<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="1" IsEncrypted="1" IV_size="16" first_IV="0x0a610676cb88f302d10ac8bc66e039ed" saiSavedBox="senc">
<key KID="0x279926496a7f5d25da69f2b3b2799a7f" value="0xccc0f2b3b279926496a7f5d25da692f6"/>
<key KID="0x676cb88f302d10227992649885984045" value="0xccc0f2b3b279926496a7f5d25da692d6"/>
</CrypTrack>
</GPACDRM>

然后您可以播放GPAC MP4Client播放器:

MP4Client encrypted.mp4