]> git.sesse.net Git - ffmpeg/commit
avformat/hlsenc: added HLS encryption
authorChristian Suloway <csuloway@globaleagleent.com>
Mon, 15 Jun 2015 18:58:07 +0000 (10:58 -0800)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 16 Jun 2015 01:25:31 +0000 (03:25 +0200)
commit907ac20aa29341e49a4f89ff3d4240d92f9a0cb9
treec81b0a067ed9e863389394af8660f5a284dede62
parentfefe04259ae903f265074ef3e8db7e0941f00307
avformat/hlsenc: added HLS encryption

Added HLS encryption with -hls_key_info_file <key_info_file> option. The
first line of key_info_file specifies the key URI written to the
playlist. The key URL is used to access the encryption key during
playback. The second line specifies the path to the key file used to
obtain the key during the encryption process. The key file is read as a
single packed array of 16 octets in binary format. The optional third
line specifies the initialization vector (IV) as a hexadecimal string to
be used instead of the segment sequence number (default) for encryption.
Changes to key_info_file will result in segment encryption with the new
key/IV and an entry in the playlist for the new key URI/IV.

Key info file format:
<key URI>
<key file path>
<IV> (optional)

Example key URIs:
http://server/file.key
/path/to/file.key
file.key

Example key file paths:
file.key
/path/to/file.key

Example IV:
0123456789ABCDEF0123456789ABCDEF

Example:
ffmpeg -f lavfi -i testsrc -c:v h264 -hls_key_info_file file.keyinfo
foo.m3u8

file.keyinfo:
http://server/file.key
/path/to/file.key
0123456789ABCDEF0123456789ABCDEF

Example shell script:
BASE_URL=${1:-'.'}
openssl rand 16 > file.key
echo $BASE_URL/file.key > file.keyinfo
echo file.key >> file.keyinfo
echo $(openssl rand -hex 16) >> file.keyinfo
ffmpeg -f lavfi -re -i testsrc -c:v h264 -hls_flags delete_segments \
  -hls_key_info_file file.keyinfo out.m3u8
--

Signed-off-by: Christian Suloway <csuloway@globaleagleent.com>
Signed-off-by: Dan Dennedy <dan@dennedy.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
doc/muxers.texi
libavformat/hlsenc.c