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

Matheus Silva matheusuzumakilol at gmail.com
Tue Jul 7 23:56:57 EEST 2020

Thanks, this worked! I replaced the key's URI to point to the local file
key and added the full path to the chunks on the external network. To
download I used the command "ffmpeg -protocol_whitelist
file,http,https,tcp,tls,crypto -allowed_extensions ALL -i gordelicia.m3u8
-c copy gordelicia.mp4". I can make a shell script to automate all of this
but it is strange that ffmpeg does not provide a easy way to set/replace
the decryption key on the command line

Em ter, 7 de jul de 2020 17:21, Moritz Barsnick <barsnick at gmx.net> escreveu:

> 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.
> k0_chunk_1594093207765475768_0_a.ts
> to
> https://prod-ec-sa-east-1.video.periscope.tv/Transcoding/v1/hls/TZPcueFo9ipbNHlYV8n1AMloI1ea7i-9j4o5BqRsDYGuuqxctEEZEvDHDZbpcVLgY1V0M9kLLIi5QeOlp3q8qA/non_transcode/sa-east-1/periscope-replay-direct-prod-sa-east-1-private/k0_chunk_1594093207765475768_0_a.ts
> 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. ;-)
> Cheers,
> Moritz
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".

More information about the ffmpeg-user mailing list