gpac / mp4box.js

JavaScript version of GPAC's MP4Box tool
https://gpac.github.io/mp4box.js/
BSD 3-Clause "New" or "Revised" License
1.98k stars 333 forks source link

Feature Request: decrypt a mp4box encrypted dash mp4 , then download it #246

Open fastfading opened 3 years ago

fastfading commented 3 years ago

drm.xml

<GPACDRM type="CENC AES-CTR">
  <DRMInfo type="pssh" version="1">
    <BS ID128="1077efecc0b24d02ace33c1e52e2fb4b"/>
    <BS bits="32" value="1"/>
    <BS ID128="cd7eb9ff88f34caeb06185b00024e4c2"/>
  </DRMInfo>
  <CrypTrack IV_size="8" first_IV="0xbb5738fe08f11341" isEncrypted="1" saiSavedBox="senc" trackID="1">
    <key KID="0xcd7eb9ff88f34caeb06185b00024e4c2" value="0x63cb5f7184dd4b689a5c5ff11ee6a328"/>
  </CrypTrack>
  <CrypTrack IV_size="8" first_IV="0xbb5738fe08f11341" isEncrypted="1" saiSavedBox="senc" trackID="2">
    <key KID="0xcd7eb9ff88f34caeb06185b00024e4c2" value="0x63cb5f7184dd4b689a5c5ff11ee6a328"/>
  </CrypTrack>
</GPACDRM>

MP4Box -crypt drm.xml output.mp4 -out output_enc.mp4 MP4Box -dash 5000 -url-template -bs-switching no -out output.mpd -rap output_enc.mp4 this could only be used for playback

we wish it could be decrypted by mp4box.js , then download like below MP4Box -decrypt drm.xml output_enc_dashinit.mp4 -out output_dec.mp4