[FFmpeg-user] How to download encrypted m3u8 providing the key?

Moritz Barsnick barsnick at gmx.net
Tue Jul 7 23:21:31 EEST 2020

Hi Matheus,

On Tue, Jul 07, 2020 at 14:45:08 -0300, Matheus Silva wrote:
> Guys, how can I download from an encrypted m3u8 but that the key's URI is
> no longer available? Obviously I downloaded the key previously, a 16 byte
> file (that I get the hex string using "xxd -p"), I tried the following
> using the cryptokey parameter but ffmpeg keeps trying to do the decryption
> using the key URI provided in the m3u8 file. https://pastebin.com/SNA0CAJ2

I'm not sure you can override the key URI given by the HLS (m3u8). What
you should be able to do is to download the m3u8, replace all the
"URI=" in each "EXT-X-KEY:" line, retaining the "IV=", and expanding
each segment to a full path, from e.g.

Then use the local m3u8 file as ffmpeg's input.

You may need some protocol whitelist or some "safe" flag on the ffmpeg
command line, in order to be able to load content from file and
network, but ffmpeg will probably tell you so.

Good luck. I'm too lazy to convert your hex command line key argument
back to a key file in order to test. ;-)


More information about the ffmpeg-user mailing list