[FFmpeg-user] Passing headers to encrypted hls stream in ffmpeg
Nitin Singh
acc4nitin at gmail.com
Thu Jan 26 17:13:53 EET 2023
Hi !
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
The content of mediafile.m3u8 is like this :
#EXTM3U
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:582
#EXT-X-TARGETDURATION:6
#EXT-X-KEY:METHOD=AES-128,URI="https://media.key.link/live/media-10.key",IV=0x00080
#EXTINF:5.000,
media-20.ts
#EXTINF:5.000,
media-25.ts
#EXTINF:6.000,
media-30.ts
#EXTINF:5.000,
media-35.ts
#EXTINF:5.000,
media-40.ts
-loglevel debug is showing that headers are being passed to fetch the
content from "http://media.link/mediafile.m3u8".
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 :
[http @ 0x01] No trailing CRLF found in HTTP header. Adding it.
[hls @ 0x01] Skip ('#EXT-X-VERSION:3')
[hls @ 0x01] Opening 'https://media.key.link/live/media-10.key' for reading
[https @ 0x01] HTTP error 403 Forbidden
[hls @ 0x01] Unable to open key file https://media.key.link/live/media-10.key
[hls @ 0x01] Opening 'crypto+http://media.link/media-20.ts' for reading
[hls @ 0x01] Opening 'crypto+http://media.link/media-25.ts' for reading
[hls @ 0x01] Error when loading first segment 'http://media.link/media-20.ts'
http://media.link/mediafile.m3u8: Invalid data found when processing input
How do I pass the headers to remote key file url as well ?
Thanks.
More information about the ffmpeg-user
mailing list