I have been using ffmepg and many tools to download online videos but I have the following case:
The main m3u8 file from the streaming server shows different resolutions:
#EXTM3U
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=133241,RESOLUTION=426x240, CODECS="avc1.42e00a,mp4a.40.2"
240.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=216379,RESOLUTION=640x360, CODECS="avc1.42e00a,mp4a.40.2"
360.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=239756,RESOLUTION=852x480, CODECS="avc1.42e00a,mp4a.40.2"
480.m3u8
#EXT-X-STREAM-INF:PROGRAM-ID=1,BANDWIDTH=408978,RESOLUTION=1280x720, CODECS="avc1.42e00a,mp4a.40.2"
720.m3u8
Then for every resolution there are 2 files, for example let us pick the 720:
720.m3u8
720.key
The 720.m3u8 has the segments and the 720.key has base64 encrypted key
Now when I use ffmpeg I got the following error:
[https @ 0x7fc00a40e0c0] HTTP error 403 Forbidden
[hls @ 0x7fc00a204100] Unable to open key file https://hls2.videos.*****/video/720.key
I was sure that I added all the required headers in my ffmpeg command:
-user_agent
-referer
I am not sure what is the problem and I have tested all other tools like yt-dlp, yotube-dl and streamlink