Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use ffmpeg encrypt AES-128 HLS m3u8 playlist? [duplicate]

I use the ffmpeg -i fighter.mp4 -hls_time 10 stream.m3u8 to crated a m3u8 file. But there's not #EXT-X-KEY info in the m3u8 file. What should I do to add key in the HLS playlist?

like image 631
jason Avatar asked Dec 22 '15 21:12

jason


1 Answers

To make use of FFmpeg's HLS segment encryption feature, check out 22.7.1 from the documentation.

You may pass the hls_key_info_file option, pointing to a file containing the key information. The file may look like:

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

The first line of this file states the URI for the key, which is written into the HLS playlist. The second line of the file points to the key file (may be local or http) against which the media will be encrypted.

So, adding something like this to your FFmpeg command should work:

ffmpeg -i fighter.mp4 -hls_time 10 -hls_key_info_file file.keyinfo stream.m3u8

like image 67
AndrewUnmuted Avatar answered Nov 10 '22 11:11

AndrewUnmuted