Skip to content

Instantly share code, notes, and snippets.

@jmurphyau
Created February 9, 2020 22:47
Show Gist options
  • Save jmurphyau/4273f823990d66b08be72e26b262f2ae to your computer and use it in GitHub Desktop.
Save jmurphyau/4273f823990d66b08be72e26b262f2ae to your computer and use it in GitHub Desktop.
Download HLS Stream with FFmpeg
#this
ffmpeg -loglevel debug -f hls -referer 'https://10play.com.au/live' -user_agent 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/82.0.4050.0 Safari/537.36' -f hls -i "https://manifest.prod.boltdns.net/manifest/v1/hls/v4/aes128/2199827728001/6bd7fe89-1f2f-42d0-b7a5-c676791a0d83/10s/master.m3u8?fastly_token=NWUzZDliOGZfNTJhZjJhN2IxMzQ5OTdjNGVkYmEzODkwNjYwZTYyMWY2ZmY1YjNmNGJkNWM3NjdiNDFiZmViNjczNzMwMmJlYQ%3D%3D" -c copy project5.mp4
# or this
ffmpeg -loglevel debug -f hls -referer 'https://10play.com.au/live' -user_agent 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/82.0.4050.0 Safari/537.36' -f hls -i "https://manifest.prod.boltdns.net/manifest/v1/hls/v4/aes128/2199827728001/6bd7fe89-1f2f-42d0-b7a5-c676791a0d83/10s/master.m3u8?fastly_token=NWUzZDliOGZfNTJhZjJhN2IxMzQ5OTdjNGVkYmEzODkwNjYwZTYyMWY2ZmY1YjNmNGJkNWM3NjdiNDFiZmViNjczNzMwMmJlYQ%3D%3D" -c copy -bsf:a aac_adtstoasc project3.mp4
@RJVB
Copy link

RJVB commented Dec 27, 2020

I'm often downloading videos where I get this kind of error:

[https @ 0x7fef54e01240] HTTP error 429 Too Many Requests
[hls @ 0x7fef5380fe00] Failed to open segment 300 of playlist 0                                                                     
[hls @ 0x7fef5380fe00] Opening 'XXX' for reading
[https @ 0x7fef54e01240] HTTP error 429 Too Many Requests
[hls @ 0x7fef5380fe00] Failed to open segment 300 of playlist 0                                                                     
[hls @ 0x7fef5380fe00] Opening 'XXX' for reading
[https @ 0x7fef54b8af40] HTTP error 429 Too Many Requests
[hls @ 0x7fef5380fe00] Failed to open segment 300 of playlist 0                                                                     
[hls @ 0x7fef5380fe00] Opening 'XXX' for reading
[https @ 0x7fef52d4bfc0] HTTP error 429 Too Many Requests
[hls @ 0x7fef5380fe00] Failed to open segment 300 of playlist 0                                                                     

The videos usually end up being fine and complete so I think ffmpeg just continues to harass the server until the request succeeds. A more polite way would be to wait a certain amount of time - possibly even as a function of the duration of the last downloaded segment (which would emulate someone watching the stream). Is there an option for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment