[FFmpeg-devel] Encrypt mpeg-dash contents and Explore the headers

Sify Browse sifysify.007 at gmail.com
Fri Dec 15 11:50:28 EET 2017


    I am trying to encrypt the mpeg-dash contents by passing the
encryption_scheme, encryption_key and encryption_kid to the mp4 muxer from
dash muxer. I do notice that the contents (fragmented and segmented) are
encrypted but not playable through dash players, decryption fails.

a)
Going through ffmpeg code reveals that some of the atom/box have to be
updated and added to proper atom/box (though not mandatory).
Specifications mentions that the 'senc' atom to be in the 'traf' or in
'trak' box but in the mp4 it is under the 'stbl' box. I am not sure on
which specification code was implemented. But moving 'senc' to the 'traf'
box works but for first segment as the auxiliary info's are appended and
second segment will have duplicates of first segment.So player complains
and fails to play the next chunk. Any inputs on how to segregate the 'senc'
when dash is enabled? I assume that the auxiliary information written is
for the whole file, but in the case of segmentation the 'senc' has to be
per segment and contain per segment auxiliary information. Trying to modify
auxiliary info results in the segmentation fault. Please provide some
guidance.

b) To play dash encrypted content, either we need to update the mpd file or
headers with 'pssh' atom (atom not mandatory). Do we need the 'sbgp',
'sgpd' and 'seig' boxes, inspite not mandatory? but ffmpeg is using
subsample encryption.

c) Following command generates the single file which can be playable in the
ffplay but I can not open and see the boxes through mp4 explorer. Which
tool does support to explore segmented file/s?

ffmpeg -y -loglevel info -loglevel verbose -err_detect careful
-analyzeduration 8000000 -probesize 4000000 -rtbufsize 300000
-flush_packets 0 -fflags +genpts+discardcorrupt -f mpegts -i
Sample_Input.ts -i -map 0:p:1:0 -c copy -f dash -window_size 24
-min_seg_duration 4 -use_timeline true -use_template true -single_file
true live.mpd


More information about the ffmpeg-devel mailing list