[FFmpeg-devel] mov: support for multiple edits and cenc decryption

Eran Kornblau eran.kornblau at kaltura.com
Mon Jan 30 12:51:02 EET 2017


> -----Original Message-----
> From: ffmpeg-devel [mailto:ffmpeg-devel-bounces at ffmpeg.org] On Behalf Of Sasi Inguva
> Sent: Wednesday, January 18, 2017 3:30 AM
> To: FFmpeg development discussions and patches <ffmpeg-devel at ffmpeg.org>
> Subject: Re: [FFmpeg-devel] mov: support for multiple edits and cenc decryption
> 
> Can you add a fate test ? Rest looks fine to me.
> 
Attached:
1. Fate test
2. The original patch
3. Sample file - needs to be uploaded to $(TARGET_SAMPLES)/mov/mov-3elist-encrypted.mov

The sample file was created with this python script:
import struct
import os

# encrypt
os.system('ffmpeg -ignore_editlist 1 -i mov-3elist.mov -encryption_scheme cenc-aes-ctr -encryption_key 12345678901234567890123456789012 -encryption_kid 12345678901234567890123456789012 -vcodec copy -y mov-3elist-encrypted.mov')

# reapply the complex edit list
def growAtom(d, atom, size):
	atomPos = d.find(atom)
	size += struct.unpack('>L', d[(atomPos - 4):atomPos])[0]
	return d[:(atomPos - 4)] + struct.pack('>L', size) + d[atomPos:]

d = file('mov-3elist-encrypted.mov', 'rb').read()
d = d.replace(
	'00000024656474730000001C656C73740000000000000001000007D00000040000010000'.decode('hex'),
	'0000003C6564747300000034656C73740000000000000003000001F40000040000010000000001F400001C0000010000000003E80000340000010000'.decode('hex'))
d = growAtom(d, 'trak', 0x18)
d = growAtom(d, 'moov', 0x18)
file('mov-3elist-encrypted.mov', 'wb').write(d)

Thanks,

Eran 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-mov-add-fate-test-for-decryption-with-edit-list.patch
Type: application/octet-stream
Size: 5854 bytes
Desc: 0001-mov-add-fate-test-for-decryption-with-edit-list.patch
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170130/8d252163/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-mov-fix-decryption-with-edit-list.patch
Type: application/octet-stream
Size: 13091 bytes
Desc: 0001-mov-fix-decryption-with-edit-list.patch
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170130/8d252163/attachment-0001.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mov-3elist-encrypted.mov
Type: video/quicktime
Size: 31030 bytes
Desc: mov-3elist-encrypted.mov
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20170130/8d252163/attachment.mov>


More information about the ffmpeg-devel mailing list