[FFmpeg-devel] Patch libavformat/crypto to add seek when reading

Michael Niedermayer michael at niedermayer.cc
Tue Aug 30 18:17:20 EEST 2016


On Tue, Aug 30, 2016 at 09:47:12AM +0100, Simon H wrote:
> 

>  crypto.c |  116 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--
>  1 file changed, 114 insertions(+), 2 deletions(-)
> a8d9d6638d0be86896de1cb2fa5f9a9f60d7b3c3  libavformat-crypto-add-seek.patch
> From a0c4d274b2b1712e6ca26a18083edccb55032b94 Mon Sep 17 00:00:00 2001
> From: Simon Hailes <btsimonh at googlemail.com>
> Date: Tue, 30 Aug 2016 09:40:14 +0100
> Subject: [PATCH] cyrpto allows reading of data which has been aes-128-cbc
>  encrypted given a key and an iv. But it did not handle filetypes which
>  require seeking...  e.g. it failed on an encrypted .mp4 file.
> 
> example:
> take 25.mp4 created with:
> ffmpeg -f lavfi -i sine=frequency=1000:beep_factor=2:r=48000:duration=720.0 -f lavfi -i testsrc=duration=720.0:rate=25 -vcodec libx264 -cmp 22 -timecode 10:00:00:00 -r 25 -y out\25.mp4
> 
> encrypt with:
> openssl enc -aes-128-cbc -K 12345678901234567890123456789012 -iv 12345678901234567890123456789012 -in 25.mp4 -out 25.enc
> then to transcode in ffmpeg:
> ffmpeg -key 12345678901234567890123456789012 -iv 12345678901234567890123456789012 -i crypto:25.enc -vcodec mpeg4 -r 25 -y 25dec.mp4
> 
> prior to this modification, the transcode would fail.
> 
> Note also:  crypto previously maked both reads and writes as streamed, which caused the whole file
> to be read before the transcode started.  Now, for read only, if the underlying layer is not marked as streamed,
> then crypto is not.  This should enable efficient reading of encrypted containers which require seeking.
> ---
>  libavformat/crypto.c | 116 ++++++++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 114 insertions(+), 2 deletions(-)

applied

can you add a fate test for this case ?

thanks

[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

When you are offended at any man's fault, turn to yourself and study your
own failings. Then you will forget your anger. -- Epictetus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20160830/9f3d1687/attachment.sig>


More information about the ffmpeg-devel mailing list