Opened 7 years ago

Closed 6 years ago

Last modified 20 months ago

#6451 closed defect (fixed)

ffmpeg not able to decrypt mp4 fragment files

Reported by: jero3000 Owned by:
Priority: normal Component: avformat
Version: git-master Keywords: mov
Cc: Blocked By:
Blocking: Reproduced by developer: yes
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 7 years ago.
MP4 fragment sample file
ffplay-20170608-155526.log (200.6 KB ) - added by jero3000 7 years ago.
ffplay log file

Download all attachments as: .zip

Change History (7)

by jero3000, 7 years ago

Attachment: cenc.mp4 added

MP4 fragment sample file

by jero3000, 7 years ago

Attachment: ffplay-20170608-155526.log added

ffplay log file

comment:1 by Carl Eugen Hoyos, 7 years ago

Priority: criticalnormal

comment:2 by jero3000, 7 years ago

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

./ffplay ~/Descargas/cenc.mp4 -decryption_key "00112233445566778899AABBCCDDEEFF"

comment:3 by Carl Eugen Hoyos, 6 years ago

Keywords: mov added
Reproduced by developer: set
Status: newopen

comment:4 by Carl Eugen Hoyos, 6 years ago

Resolution: fixed
Status: openclosed

Fixed by Jacob Trimble in f7221d8e670ec05471a16cc4cc1cc8e0040b5b5f (4.0).
Seeking backwards breaks playback with ffplay.

comment:5 by Balling, 20 months ago

Seeking backwards breaks playback with ffplay.

Not if you play -c copied file.

Last edited 20 months ago by Balling (previous) (diff)
Note: See TracTickets for help on using tickets.