ffmpeg not able to decrypt mp4 fragment files
|Reported by:||jero3000||Owned by:|
|Blocking:||Reproduced by developer:||yes|
|Analyzed by developer:||no|
I am trying to decrypt a mp4 fragment file with ffmpeg.
The mp4 fragment file (attached) has the first three segments unencrypted ('senc' box is not present in the first three segments).
Ffmpeg only parses the first 'senc' box and assumes that has the enough information to decrypt the entire content. When the first 'senc' box (owned by the fourth segment) is parsed, the subsample info is correctly added to the "cenc" structure (MOVStreamContext), but when the reader tries to get the first packet from the forth segment, it assumes that the current segment is the forth encypted, however it is just first one. As a result, the offsets accessing the "cenc" structure are incorrect and these errors are showed in the output:
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f82c00015a0] auxiliary info offset 4800 greater than auxiliary info size 1600 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f82c00015a0] auxiliary info offset 4816 greater than auxiliary info size 1600 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7f82c00015a0] auxiliary info offset 4832 greater than auxiliary info size 1600 ...
How to reproduce:
- Start the playback with "ffplay" specifying the decryption key:
% ./ffplay ~/Descargas/cenc.mp4 -decryption_key "00112233445566778899AABBCDEEFF"
- Wait for the fourth segment (10 seconds aprox).
The problem was reproduced in the last stable version (3.3.1), but also in git-master SHA1 id: "35c76f2e138b713928a77a8aa5734bf5c8f9368f"