[FFmpeg-user] Passing headers to encrypted hls stream in ffmpeg

Moritz Barsnick barsnick at gmx.net
Thu Jan 26 17:32:38 EET 2023

On Thu, Jan 26, 2023 at 20:43:53 +0530, Nitin Singh wrote:
> I am using ffmpeg 5.1. I want to save encrypted aes-128 hls in which
> the decrypting key link is in m3u8 stream link. I am able to pass
> headers & get m3u8 file content using :
> ffmpeg  -headers "Hvar1: hvalue1" -headers "Hvar2: hvalue2" -headers
> "Hvar3: hvalue3" -i "http://media.link/mediafile.m3u8" -t 30 -c copy
> output.mkv -loglevel debug
> But the problem is with getting remote key file i.e.
> https://media.key.link/live/media-10.key as it needs the same headers
> to get fetched and those same headers are not getting passed to remote
> key file url and I get this error :

I believe that's a bug or shortcoming of ffmpeg, as described in this

When searching for this, I didn't realize I had commented on this
almost exactly four years ago. ;-) I probably had the same issue.


More information about the ffmpeg-user mailing list