mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-06-16 04:32:47 +02:00
avformat/http: allow limiting initial request size
Sometimes, HTTP sources require a lot of seeking during probing / header parsing (especially for formats like MXF). Currently, we need to completely tear down and re-establish the connection most times this happens, which puts a lot of stress on the network stack and also results in transmission of possibly many unnecessary bytes. This patch adds an option to allow FFmpeg to request partial ranges during the initialization stage. This is done until the initial request size is fully read, after which we fall back to the normal behavior (i.e. infinite streaming via an unbounded request). The usefulness of this is limited without also specifying -multiple_requests 1, since otherwise there is little point to requesting partial ranges to begin with. (However, it is semantically independent, so we keep it that way.)
This commit is contained in:
@@ -473,6 +473,19 @@ Set the Referer header. Include 'Referer: URL' header in HTTP request.
|
||||
@item multiple_requests
|
||||
Use persistent connections if set to 1, default is 0.
|
||||
|
||||
@item initial_request_size
|
||||
Limit the size of initial requests. This is useful when dealing with formats
|
||||
that require frequent seeks during initial parsing. This lasts until the
|
||||
demuxer makes a read request larger than this size (without a seek in between),
|
||||
after which the implementation will continue using unbounded requests as usual.
|
||||
Disabled (set to 0) by default.
|
||||
|
||||
Note that if enabling this option, it's strongly recommended to also enable
|
||||
the @option{multiple_requests} option, as well as setting
|
||||
@option{short_seek_size} to the same value or higher. Doing so allows FFmpeg
|
||||
to reuse a single HTTP connection wherever possible, even for formats like
|
||||
MXF or MOV that require frequent small seeks during initial parsing.
|
||||
|
||||
@item post_data
|
||||
Set custom HTTP post data.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user