0

I'm trying to download HLS format video as mp4 using ffmpeg.

I don't want to bother the server side due to excessive requests, so I want to create an interval for ts file acquisition.

When I actually run ffmpeg, I sometimes get an HTTP 429 error as shown below.

In addition, it looked like there are no good options in ffmpeg.

[https @ 000001bfef570100] Opening 'https://~/ts/9.ts' for reading
[https @ 000001bfeef31140] HTTP error 429 Too Many Requests
[hls @ 000001bfee6be200] keepalive request failed for 'https://~/ts/9.ts' with error: 'Server returned 4XX Client Error, but not one of 40{0,1,3,4}' when opening url, retrying with new connection
[https @ 000001bfef570100] Opening 'https://~/ts/9.ts' for reading
[https @ 000001bfef570100] Opening 'https://~/ts/10.ts' for reading
[https @ 000001bfef570100] Opening 'https://~/ts/11.ts' for reading
[https @ 000001bfef570100] Opening 'https://~/ts/12.ts' for reading
[https @ 000001bfef570100] Opening 'https://~/ts/13.ts' for reading
[https @ 000001bfeef31140] HTTP error 429 Too Many Requests
[hls @ 000001bfee6be200] keepalive request failed for 'https://~/ts/13.ts' with error: 'Server returned 4XX Client Error, but not one of 40{0,1,3,4}' when opening url, retrying with new connection
[https @ 000001bfef570100] Opening 'https://~/ts/13.ts' for reading
…

Can you come up with any good way?

I'm not good at English, so I may not be able to respond well. sorry. This post was written by Google Translate.

atsu8492
  • 1
  • 1

2 Answers2

1

Disable multiple HTTP connections

The HLS demuxer has the option -http_multiple:

Use multiple HTTP connections for fetching segments (default auto)

Disabling multiple HTTP connections may help (but probably will not help): ffmpeg -http_multiple 0 -i https://...

I do not see any useful options for the HTTP protocol.

Rate limit

You could try limiting the download speed with a "bandwidth shaper" or rate limiting tool. Example using trickle to run ffmpeg limiting the download capacity to 50 KB/s:

 trickle -d 50 ffmpeg ...

Or if you can use youtube-dl on the web site then you can limit the rate. See youtube-dl rate limit download speed and auto resume download.

manual

Download the M3U8 file and manually download each .ts file listed in the M3U8 file.

llogan
  • 121,796
  • 28
  • 232
  • 243
0

You need to disable persistent connection in ffmpeg via -http_persistent 0

350D
  • 11,135
  • 5
  • 36
  • 49