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?
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With