I have a few thousand .ts AES-128 encrypted audio files with a .key and .m3u8 file.
The key file just contains a key comprised of 44 characters. The .m3ud files appe
Recent versions of ffmpeg should be able to decrypt the AES-128 HLS streams. You don't need a webserver. If the m3u8
URIs/paths are wrong you can:
my.key
, and place it in the dir. Note that keys can be rotated, if the playlist has multiple keys copy all of them to different files..ts
segments to the same dirplaylist.m3u8
and use just the filename(s) for the key(s) URI(s) and segments.to obtain a single .ts
file do:
ffmpeg -i playlist.m3u8 -c copy output.ts
if you want just the audio stream without the .ts
container you can extract it. Eg: assuming you have a single audio stream using the AAC
codec run:
ffmpeg -i playlist.m3u8 -map 0:a -c copy output.aac
This will extract the AAC
stream to a file without re-encoding. If you want a codec different than your source you will have to re-encode.
If for some reason you have to use openssl
to decrypt the segments keep in mind that if no IV
is specified then the IV
is equal to the segment's media sequence, ie. the first segment has IV=0
, the second has IV=1
and so on. After decryption update the playlist to point the decrypted segments and remove the EXT-X-KEY
line. If you go this route you don't even need ffmpeg to obtain a single .ts
file as MPEG-TS is directly concatenable, ie. you can just use cat
on the decrypted segments.