Opened 6 months ago

Last modified 5 months ago

#6451 new defect

ffmpeg not able to decrypt mp4 fragment files

Reported by: jero3000 Owned by:
Priority: normal Component: avformat
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

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:

  1. Start the playback with "ffplay" specifying the decryption key:
    % ./ffplay  ~/Descargas/cenc.mp4 -decryption_key "00112233445566778899AABBCDEEFF"
    
  1. 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"

Attachments (2)

cenc.mp4 (748.6 KB) - added by jero3000 6 months ago.
MP4 fragment sample file
ffplay-20170608-155526.log (200.6 KB) - added by jero3000 6 months ago.
ffplay log file

Download all attachments as: .zip

Change History (4)

Changed 6 months ago by jero3000

MP4 fragment sample file

Changed 6 months ago by jero3000

ffplay log file

comment:1 Changed 6 months ago by cehoyos

  • Priority changed from critical to normal

comment:2 Changed 5 months ago by jero3000

The decryption key was wrong. This is the correct one:

./ffplay ~/Descargas/cenc.mp4 -decryption_key "00112233445566778899AABBCCDDEEFF"
Note: See TracTickets for help on using tickets.