I have to stream videos for mobile devices from server using Http Live Streaming. the file contains .m3u8 which has listed files of .ts. so how to secure this files to access only authorised users.
Basically you could encrypt every chunk with AES-128. AES-128 encrypts the whole chunk with AES using a 128 bit key, Cipher Block Chaining (CBC) and PKCS7 padding. The CBC will be restarted with each segment using the Initialization Vector (IV).
You could do this with ffmpeg by creating a key file that contains the following contents:
Key URI
Path to Key File
IV (optional)
You could create the key with openssl:
openssl rand 16 > video1.key
The file would then contain the following contents:
http://my-server.com/video1.key
video1.key
And then use ffmpeg by providing the path to the key file:
ffmpeg -i input.mp4 -hls_time 6 -hls_key_info_file keyFile playlist.m3u8
This will create the segments and a manifest which should contain a #EXT-X-KEY:METHOD=AES-128,URI attribute.
#EXT-X-KEY:METHOD=AES-128,URI="http://my-server.com/video1.key"