Table of Contents

1 Description

This document describes the input and output protocols provided by the libavformat library.

2 Protocol Options

The libavformat library provides some generic global options, which can be set on all the protocols. In addition each protocol may support so-called private options, which are specific for that component.

Options may be set by specifying -option value in the FFmpeg tools, or by setting the value explicitly in the AVFormatContext options or using the libavutil/opt.h API for programmatic use.

The list of supported options follows:

protocol_whitelist list (input) : Set a “,”-separated list of allowed protocols. “ALL” matches all protocols. Protocols prefixed by “-” are disabled. All protocols are allowed by default but protocols used by an another protocol (nested protocols) are restricted to a per protocol subset.

3 Protocols

Protocols are configured elements in FFmpeg that enable access to resources that require specific protocols.

When you configure your FFmpeg build, all the supported protocols are enabled by default. You can list all available ones using the configure option “–list-protocols”.

You can disable all the protocols using the configure option “–disable-protocols”, and selectively enable a protocol using the option “–enable-protocol=PROTOCOL”, or you can disable a particular protocol using the option “–disable-protocol=PROTOCOL”.

The option “-protocols” of the ff* tools will display the list of supported protocols.

All protocols accept the following options:

rw_timeout : Maximum time to wait for (network) read/write operations to complete, in microseconds.

A description of the currently available protocols follows.

3.1 amqp

Advanced Message Queueing Protocol (AMQP) version 0-9-1 is a broker based publish-subscribe communication protocol.

FFmpeg must be compiled with –enable-librabbitmq to support AMQP. A separate AMQP broker must also be run. An example open-source AMQP broker is RabbitMQ.

After starting the broker, an FFmpeg client may stream data to the broker using the command:

ffmpeg -re -i input -f mpegts amqp://[[user]:[password]@]hostname[:port][/vhost]

Where hostname and port (default is 5672) is the address of the broker. The client may also set a user/password for authentication. The default for both fields is “guest”. Name of virtual host on broker can be set with vhost. The default value is “/”.

Multiple subscribers may stream from the broker using the command:

ffplay amqp://[[user]:[password]@]hostname[:port][/vhost]

In RabbitMQ all data published to the broker flows through a specific exchange, and each subscribing client has an assigned queue/buffer. When a packet arrives at an exchange, it may be copied to a client’s queue depending on the exchange and routing_key fields.

The following options are supported:

exchange : Sets the exchange to use on the broker. RabbitMQ has several predefined exchanges: “amq.direct” is the default exchange, where the publisher and subscriber must have a matching routing_key; “amq.fanout” is the same as a broadcast operation (i.e. the data is forwarded to all queues on the fanout exchange independent of the routing_key); and “amq.topic” is similar to “amq.direct”, but allows for more complex pattern matching (refer to the RabbitMQ documentation).

routing_key : Sets the routing key. The default value is “amqp”. The routing key is used on the “amq.direct” and “amq.topic” exchanges to decide whether packets are written to the queue of a subscriber.

pkt_size : Maximum size of each packet sent/received to the broker. Default is 131072. Minimum is 4096 and max is any large value (representable by an int). When receiving packets, this sets an internal buffer size in FFmpeg. It should be equal to or greater than the size of the published packets to the broker. Otherwise the received message may be truncated causing decoding errors.

connection_timeout : The timeout in seconds during the initial connection to the broker. The default value is rw_timeout, or 5 seconds if rw_timeout is not set.

delivery_mode mode : Sets the delivery mode of each message sent to broker. The following values are accepted:

‘`persistent`’
:   Delivery mode set to “persistent” (2). This is the default value.
    Messages may be written to the broker’s disk depending on its setup.

‘`non-persistent`’
:   Delivery mode set to “non-persistent” (1).
    Messages will stay in broker’s memory unless the broker is under memory
    pressure.

3.2 async

Asynchronous data filling wrapper for input stream.

Fill data in a background thread, to decouple I/O operation from demux thread.

async:URL
async:http://host/resource
async:cache:http://host/resource

3.3 bluray

Read BluRay playlist.

The accepted options are:

angle : BluRay angle

chapter : Start chapter (1...N)

playlist : Playlist to read (BDMV/PLAYLIST/?????.mpls)

Examples:

Read longest playlist from BluRay mounted to /mnt/bluray:

bluray:/mnt/bluray

Read angle 2 of playlist 4 from BluRay mounted to /mnt/bluray, start from chapter 2:

-playlist 4 -angle 2 -chapter 2 bluray:/mnt/bluray

3.4 cache

Caching wrapper for input stream.

Cache the input stream to temporary file. It brings seeking capability to live streams.

The accepted options are:

read_ahead_limit : Amount in bytes that may be read ahead when seeking isn’t supported. Range is -1 to INT_MAX. -1 for unlimited. Default is 65536.

URL Syntax is

cache:URL

3.5 concat

Physical concatenation protocol.

Read and seek from many resources in sequence as if they were a unique resource.

A URL accepted by this protocol has the syntax:

concat:URL1|URL2|...|URLN

where URL1, URL2, ..., URLN are the urls of the resource to be concatenated, each one possibly specifying a distinct protocol.

For example to read a sequence of files split1.mpeg, split2.mpeg, split3.mpeg with ffplay use the command:

ffplay concat:split1.mpeg\|split2.mpeg\|split3.mpeg

Note that you may need to escape the character “|” which is special for many shells.

3.6 concatf

Physical concatenation protocol using a line break delimited list of resources.

Read and seek from many resources in sequence as if they were a unique resource.

A URL accepted by this protocol has the syntax:

concatf:URL

where URL is the url containing a line break delimited list of resources to be concatenated, each one possibly specifying a distinct protocol. Special characters must be escaped with backslash or single quotes. See the “Quoting and escaping” section in the ffmpeg-utils(1) manual.

For example to read a sequence of files split1.mpeg, split2.mpeg, split3.mpeg listed in separate lines within a file split.txt with ffplay use the command:

ffplay concatf:split.txt

Where split.txt contains the lines:

split1.mpeg
split2.mpeg
split3.mpeg

3.7 crypto

AES-encrypted stream reading protocol.

The accepted options are:

key : Set the AES decryption key binary block from given hexadecimal representation.

iv : Set the AES decryption initialization vector binary block from given hexadecimal representation.

Accepted URL formats:

crypto:URL
crypto+URL

3.8 data

Data in-line in the URI. See <http://en.wikipedia.org/wiki/Data_URI_scheme>.

For example, to convert a GIF file given inline with ffmpeg:

ffmpeg -i "data:image/gif;base64,R0lGODdhCAAIAMIEAAAAAAAA//8AAP//AP///////////////ywAAAAACAAIAAADF0gEDLojDgdGiJdJqUX02iB4E8Q9jUMkADs=" smiley.png

3.9 fd

File descriptor access protocol.

The accepted syntax is:

fd: -fd file_descriptor

If fd is not specified, by default the stdout file descriptor will be used for writing, stdin for reading. Unlike the pipe protocol, fd protocol has seek support if it corresponding to a regular file. fd protocol doesn’t support pass file descriptor via URL for security.

This protocol accepts the following options:

blocksize : Set I/O operation maximum block size, in bytes. Default value is INT_MAX, which results in not limiting the requested block size. Setting this value reasonably low improves user termination request reaction time, which is valuable if data transmission is slow.

fd : Set file descriptor.

3.10 file

File access protocol.

Read from or write to a file.

A file URL can have the form:

file:filename

where filename is the path of the file to read.

An URL that does not have a protocol prefix will be assumed to be a file URL. Depending on the build, an URL that looks like a Windows path with the drive letter at the beginning will also be assumed to be a file URL (usually not the case in builds for unix-like systems).

For example to read from a file input.mpeg with ffmpeg use the command:

ffmpeg -i file:input.mpeg output.mpeg

This protocol accepts the following options:

truncate : Truncate existing files on write, if set to 1. A value of 0 prevents truncating. Default value is 1.

blocksize : Set I/O operation maximum block size, in bytes. Default value is INT_MAX, which results in not limiting the requested block size. Setting this value reasonably low improves user termination request reaction time, which is valuable for files on slow medium.

follow : If set to 1, the protocol will retry reading at the end of the file, allowing reading files that still are being written. In order for this to terminate, you either need to use the rw_timeout option, or use the interrupt callback (for API users). Setting this option also ignores the file size reported by the file system.

seekable : Controls if seekability is advertised on the file. 0 means non-seekable, -1 means auto (seekable for normal files, non-seekable for named pipes).

Many demuxers handle seekable and non-seekable resources differently,
overriding this might speed up opening certain files at the cost of losing some
features (e.g. accurate seeking).

pkt_size : Set the maximum packet size used for file I/O. A smaller value may reduce memory usage. A higher value may increase throughput especially with networked filesystems.

For reading, if explicitly set, it overrides the default internal buffer size
(32 KB) and limits the maximum amount of data read per operation.

For writing, this sets the size of each write operation. The default is 256 KB
for regular files, 32 KB otherwise.

3.11 ftp

FTP (File Transfer Protocol).

Read from or write to remote resources using FTP protocol.

Following syntax is required.

ftp://[user[:password]@]server[:port]/path/to/remote/resource.mpeg

This protocol accepts the following options.

timeout : Set timeout in microseconds of socket I/O operations used by the underlying low level operation. By default it is set to -1, which means that the timeout is not specified.

ftp-user : Set a user to be used for authenticating to the FTP server. This is overridden by the user in the FTP URL.

ftp-password : Set a password to be used for authenticating to the FTP server. This is overridden by the password in the FTP URL, or by ftp-anonymous-password if no user is set.

ftp-anonymous-password : Password used when login as anonymous user. Typically an e-mail address should be used.

ftp-write-seekable : Control seekability of connection during encoding. If set to 1 the resource is supposed to be seekable, if set to 0 it is assumed not to be seekable. Default value is 0.

NOTE: Protocol can be used as output, but it is recommended to not do it, unless special care is taken (tests, customized server configuration etc.). Different FTP servers behave in different way during seek operation. ff* tools may produce incomplete content due to server limitations.

3.12 gopher

Gopher protocol.

3.13 gophers

Gophers protocol.

The Gopher protocol with TLS encapsulation.

3.14 handle

Windows handle access protocol.

The accepted syntax is:

handle: -handle handle

If handle is not specified, by default the output handle will be used for writing, input handle for reading. This protocol is only available on Windows. It has seek support if the handle corresponds to a regular file. It doesn’t support passing the handle via URL.

This protocol accepts the following options:

blocksize : Set I/O operation maximum block size, in bytes. Default value is INT_MAX, which results in not limiting the requested block size. Setting this value reasonably low improves user termination request reaction time, which is valuable if data transmission is slow.

handle : Set Windows handle.

The supplied handle must already be valid in the calling process.
When launching `ffmpeg`, arrange for the child process to
inherit the handle before passing its numeric value with
`handle`. Handles opened with `FILE_FLAG_OVERLAPPED`
are not supported. Closing the protocol does not close the
caller’s original handle.

3.15 http

HTTP (Hyper Text Transfer Protocol).

This protocol accepts the following options:

seekable : Control seekability of connection. If set to 1 the resource is supposed to be seekable, if set to 0 it is assumed not to be seekable, if set to -1 it will try to autodetect if it is seekable. Default value is -1.

chunked_post : If set to 1 use chunked Transfer-Encoding for posts, default is 1.

http_proxy : set HTTP proxy to tunnel through e.g. http://example.com:1234

headers : Set custom HTTP headers, can override built in default headers. The value must be a string encoding the headers.

content_type : Set a specific content type for the POST messages or for listen mode.

user_agent : Override the User-Agent header. If not specified the protocol will use a string describing the libavformat build. (“Lavf/<version>”)

referer : Set the Referer header. Include ’Referer: URL’ header in HTTP request.

multiple_requests : Force persistent connections if set to 1, or disable if 0. Default is -1, which means auto (implies keep-alive when using -request_size or -initial_request_size).

request_size : Limit the size of requests made. This is useful for some pathological servers that throttle unbounded range requests, as well as when expecting to seek frequently. Disabled (set to 0) by default.

Note that if enabling this option, it’s strongly recommended to also set
`short_seek_size` to the same value or higher. Doing so allows FFmpeg
to reuse a single HTTP connection wherever possible.

initial_request_size : Limit the size of initial requests. Similar to request_size, but only used during initial format parsing. Useful for formats like MXF or MOV that require frequent seeks during header parsing. Lasts until the demuxer makes a read request larger than this size (without a seek in between), after which the implementation will continue using requests as usual. Disabled (set to 0) by default.

Note that if enabling this option, it’s strongly recommended to also enable
the `multiple_requests` option, as well as setting
`short_seek_size` to the same value or higher.

post_data : Set custom HTTP post data.

mime_type : Export the MIME type.

http_version : Exports the HTTP response version number. Usually “1.0” or “1.1”.

cookies : Set the cookies to be sent in future requests. The format of each cookie is the same as the value of a Set-Cookie HTTP response field. Multiple cookies can be delimited by a newline character. A cookie without a Domain attribute is only sent to the host of the URL it is set for.

icy : If set to 1 request ICY (SHOUTcast) metadata from the server. If the server supports this, the metadata has to be retrieved by the application by reading the icy_metadata_headers and icy_metadata_packet options. The default is 1.

icy_metadata_headers : If the server supports ICY metadata, this contains the ICY-specific HTTP reply headers, separated by newline characters.

icy_metadata_packet : If the server supports ICY metadata, and icy was set to 1, this contains the last non-empty metadata packet sent by the server. It should be polled in regular intervals by applications interested in mid-stream metadata updates.

metadata : Set an exported dictionary containing Icecast metadata from the bitstream, if present. Only useful with the C API.

auth_type : Set HTTP authentication type. No option for Digest, since this method requires getting nonce parameters from the server first and can’t be used straight away like Basic.

`none`
:   Choose the HTTP authentication type automatically. This is the default.

`basic`
:   Choose the HTTP basic authentication.

    Basic authentication sends a Base64-encoded string that contains a user name and password
    for the client. Base64 is not a form of encryption and should be considered the same as
    sending the user name and password in clear text (Base64 is a reversible encoding).
    If a resource needs to be protected, strongly consider using an authentication scheme
    other than basic authentication. HTTPS/TLS should be used with basic authentication.
    Without these additional security enhancements, basic authentication should not be used
    to protect sensitive or valuable information.

send_expect_100 : Send an Expect: 100-continue header for POST. If set to 1 it will send, if set to 0 it won’t, if set to -1 it will try to send if it is applicable. Default value is -1.

location : An exported dictionary containing the content location. Only useful with the C API.

offset : Set initial byte offset.

end_offset : Try to limit the request to bytes preceding this offset.

method : When used as a client option it sets the HTTP method for the request.

When used as a server option it sets the HTTP method that is going to be
expected from the client(s).
If the expected and the received HTTP method do not match the client will
be given a Bad Request response.
When unset the HTTP method is not checked for now. This will be replaced by
autodetection in the future.

reconnect : Reconnect automatically when disconnected before EOF is hit.

reconnect_at_eof : If set then eof is treated like an error and causes reconnection, this is useful for live / endless streams. This does not apply to the deliberately established end of a resource whose complete size is unknown, i.e. when a ranged request past the end is answered with 416. Such an end is reported as a clean EOF and is not retried, unless reconnect_on_http_error lists 416 by number.

reconnect_on_network_error : Reconnect automatically in case of TCP/TLS errors during connect.

reconnect_on_http_error : A comma separated list of HTTP status codes to reconnect on. The list can include specific status codes (e.g. ’503’) or the strings ’4xx’ / ’5xx’. A 416 that ends a read or a seek past the end of a resource whose complete size is unknown is reported as EOF. It is retried first only if 416 is listed by number, for example to read a resource that is still being written. ’4xx’ does not cover it.

reconnect_streamed : If set then even streamed/non seekable streams will be reconnected on errors.

reconnect_delay_max : Set the maximum delay in seconds after which to give up reconnecting.

reconnect_max_retries : Set the maximum number of times to retry a connection. Default unset.

reconnect_delay_total_max : Set the maximum total delay in seconds after which to give up reconnecting.

respect_retry_after : If enabled, and a Retry-After header is encountered, its requested reconnection delay will be honored, rather than using exponential backoff. Useful for 429 and 503 errors. Default enabled.

listen : If set to 1 enables experimental HTTP server. This can be used to send data when used as an output option, or read data from a client with HTTP POST when used as an input option. If set to 2 enables experimental multi-client HTTP server. This is not yet implemented in ffmpeg.c and thus must not be used as a command line option.

```
# Server side (sending):
ffmpeg -i somefile.ogg -c copy -listen 1 -f ogg http://server:port

# Client side (receiving):
ffmpeg -i http://server:port -c copy somefile.ogg

# Client can also be done with wget:
wget http://server:port -O somefile.ogg

# Server side (receiving):
ffmpeg -listen 1 -i http://server:port -c copy somefile.ogg

# Client side (sending):
ffmpeg -i somefile.ogg -chunked_post 0 -c copy -f ogg http://server:port

# Client can also be done with wget:
wget --post-file=somefile.ogg http://server:port
```

resource : The resource requested by a client, when the experimental HTTP server is in use.

reply_code : The HTTP code returned to the client, when the experimental HTTP server is in use.

short_seek_size : Set the threshold, in bytes, for when a readahead should be preferred over a seek and new HTTP request. This is useful, for example, to make sure the same connection is used for reading large video packets with small audio packets in between.

3.15.1 HTTP Cookies

Some HTTP requests will be denied unless cookie values are passed in with the request. The cookies option allows these cookies to be specified. At the very least, each cookie must specify a value. HTTP requests that match both the domain and path will automatically include the cookie value in the HTTP Cookie header field. Multiple cookies can be delimited by a newline.

The required syntax to play a stream specifying a cookie is:

ffplay -cookies "nlqptid=nltid=tsn; path=/; domain=somedomain.com;" http://somedomain.com/somestream.m3u8

3.16 Icecast

Icecast protocol (stream to Icecast servers)

This protocol accepts the following options:

ice_genre : Set the stream genre.

ice_name : Set the stream name.

ice_description : Set the stream description.

ice_url : Set the stream website URL.

ice_public : Set if the stream should be public. The default is 0 (not public).

user_agent : Override the User-Agent header. If not specified a string of the form “Lavf/<version>” will be used.

password : Set the Icecast mountpoint password.

content_type : Set the stream content type. This must be set if it is different from audio/mpeg.

legacy_icecast : This enables support for Icecast versions < 2.4.0, that do not support the HTTP PUT method but the SOURCE method.

tls : Establish a TLS (HTTPS) connection to Icecast.

icecast://[username[:password]@]server:port/mountpoint

3.17 ipfs

InterPlanetary File System (IPFS) protocol support. One can access files stored on the IPFS network through so-called gateways. These are http(s) endpoints. This protocol wraps the IPFS native protocols (ipfs:// and ipns://) to be sent to such a gateway. Users can (and should) host their own node which means this protocol will use one’s local gateway to access files on the IPFS network.

This protocol accepts the following options:

gateway : Defines the gateway to use. When not set, the protocol will first try locating the local gateway by looking at $IPFS_GATEWAY, $IPFS_PATH and $HOME/.ipfs/, in that order.

One can use this protocol in 2 ways. Using IPFS:

ffplay ipfs://<hash>

Or the IPNS protocol (IPNS is mutable IPFS):

ffplay ipns://<hash>

3.18 mmst

MMS (Microsoft Media Server) protocol over TCP.

3.19 mmsh

MMS (Microsoft Media Server) protocol over HTTP.

The required syntax is:

mmsh://server[:port][/app][/playpath]

3.20 md5

MD5 output protocol.

Computes the MD5 hash of the data to be written, and on close writes this to the designated output or stdout if none is specified. It can be used to test muxers without writing an actual file.

Some examples follow.

## Write the MD5 hash of the encoded AVI file to the file output.avi.md5.
ffmpeg -i input.flv -f avi -y md5:output.avi.md5

## Write the MD5 hash of the encoded AVI file to stdout.
ffmpeg -i input.flv -f avi -y md5:

Note that some formats (typically MOV) require the output protocol to be seekable, so they will fail with the MD5 output protocol.

3.21 pipe

UNIX pipe access protocol.

Read and write from UNIX pipes.

The accepted syntax is:

pipe:[number]

If fd isn’t specified, number is the number corresponding to the file descriptor of the pipe (e.g. 0 for stdin, 1 for stdout, 2 for stderr). If number is not specified, by default the stdout file descriptor will be used for writing, stdin for reading.

For example to read from stdin with ffmpeg:

cat test.wav | ffmpeg -i pipe:0
## ...this is the same as...
cat test.wav | ffmpeg -i pipe:

For writing to stdout with ffmpeg:

ffmpeg -i test.wav -f avi pipe:1 | cat > test.avi
## ...this is the same as...
ffmpeg -i test.wav -f avi pipe: | cat > test.avi

This protocol accepts the following options:

blocksize : Set I/O operation maximum block size, in bytes. Default value is INT_MAX, which results in not limiting the requested block size. Setting this value reasonably low improves user termination request reaction time, which is valuable if data transmission is slow.

fd : Set file descriptor.

Note that some formats (typically MOV), require the output protocol to be seekable, so they will fail with the pipe output protocol.

3.22 prompeg

Pro-MPEG Code of Practice #3 Release 2 FEC protocol.

The Pro-MPEG CoP#3 FEC is a 2D parity-check forward error correction mechanism for MPEG-2 Transport Streams sent over RTP.

This protocol must be used in conjunction with the rtp_mpegts muxer and the rtp protocol.

The required syntax is:

-f rtp_mpegts -fec prompeg=option=val... rtp://hostname:port

The destination UDP ports are port + 2 for the column FEC stream and port + 4 for the row FEC stream.

This protocol accepts the following options:

l=n : The number of columns (4-20, LxD <= 100)

d=n : The number of rows (4-20, LxD <= 100)

Example usage:

-f rtp_mpegts -fec prompeg=l=8:d=4 rtp://hostname:port

3.23 rist

Reliable Internet Streaming Transport protocol

The accepted options are:

rist_profile : Supported values:

‘`simple`’

‘`main`’
:   This one is default.

‘`advanced`’

buffer_size : Set internal RIST buffer size in milliseconds for retransmission of data. Default value is 0 which means the librist default (1 sec). Maximum value is 30 seconds.

fifo_size : Size of the librist receiver output fifo in number of packets. This must be a power of 2. Defaults to 8192 (vs the librist default of 1024).

overrun_nonfatal=1|0 : Survive in case of librist fifo buffer overrun. Default value is 0.

pkt_size : Set maximum packet size for sending data. 1316 by default.

log_level : Set loglevel for RIST logging messages. You only need to set this if you explicitly want to enable debug level messages or packet loss simulation, otherwise the regular loglevel is respected.

secret : Set override of encryption secret, by default is unset.

encryption : Set encryption type, by default is disabled. Acceptable values are 128 and 256.

3.24 rtmp

Real-Time Messaging Protocol.

The Real-Time Messaging Protocol (RTMP) is used for streaming multimedia content across a TCP/IP network.

The required syntax is:

rtmp://[username:password@]server[:port][/app][/instance][/playpath]

The accepted parameters are:

username : An optional username (mostly for publishing).

password : An optional password (mostly for publishing).

server : The address of the RTMP server.

port : The number of the TCP port to use (by default is 1935).

app : It is the name of the application to access. It usually corresponds to the path where the application is installed on the RTMP server (e.g. /ondemand/, /flash/live/, etc.). You can override the value parsed from the URI through the rtmp_app option, too.

playpath : It is the path or name of the resource to play with reference to the application specified in app, may be prefixed by “mp4:”. You can override the value parsed from the URI through the rtmp_playpath option, too.

listen : Act as a server, listening for an incoming connection.

timeout : Maximum time to wait for the incoming connection. Implies listen.

Additionally, the following parameters can be set via command line options (or in code via AVOptions):

rtmp_app : Name of application to connect on the RTMP server. This option overrides the parameter specified in the URI.

rtmp_buffer : Set the client buffer time in milliseconds. The default is 3000.

rtmp_conn : Extra arbitrary AMF connection parameters, parsed from a string, e.g. like B:1 S:authMe O:1 NN:code:1.23 NS:flag:ok O:0. Each value is prefixed by a single character denoting the type, B for Boolean, N for number, S for string, O for object, or Z for null, followed by a colon. For Booleans the data must be either 0 or 1 for FALSE or TRUE, respectively. Likewise for Objects the data must be 0 or 1 to end or begin an object, respectively. Data items in subobjects may be named, by prefixing the type with ’N’ and specifying the name before the value (i.e. NB:myFlag:1). This option may be used multiple times to construct arbitrary AMF sequences.

rtmp_enhanced_codecs : Specify the list of codecs the client advertises to support in an enhanced RTMP stream. This option should be set to a comma separated list of fourcc values, like hvc1,av01,vp09 for multiple codecs or hvc1 for only one codec. The specified list will be presented in the “fourCcLive” property of the Connect Command Message.

rtmp_flashver : Version of the Flash plugin used to run the SWF player. The default is LNX 9,0,124,2. (When publishing, the default is FMLE/3.0 (compatible; <libavformat version>).)

rtmp_flush_interval : Number of packets flushed in the same request (RTMPT only). The default is 10.

rtmp_live : Specify that the media is a live stream. No resuming or seeking in live streams is possible. The default value is any, which means the subscriber first tries to play the live stream specified in the playpath. If a live stream of that name is not found, it plays the recorded stream. The other possible values are live and recorded.

rtmp_pageurl : URL of the web page in which the media was embedded. By default no value will be sent.

rtmp_playpath : Stream identifier to play or to publish. This option overrides the parameter specified in the URI.

rtmp_subscribe : Name of live stream to subscribe to. By default no value will be sent. It is only sent if the option is specified or if rtmp_live is set to live.

rtmp_swfhash : SHA256 hash of the decompressed SWF file (32 bytes).

rtmp_swfsize : Size of the decompressed SWF file, required for SWFVerification.

rtmp_swfurl : URL of the SWF player for the media. By default no value will be sent.

rtmp_swfverify : URL to player swf file, compute hash/size automatically.

rtmp_tcurl : URL of the target stream. Defaults to proto://host[:port]/app.

tcp_nodelay=1|0 : Set TCP_NODELAY to disable Nagle’s algorithm. Default value is 0.

*Remark: Writing to the socket is currently not optimized to minimize system calls and reduces the efficiency / effect of TCP\_NODELAY.*

tcp_keepalive=1|0 : Enable the TCP keepalive mechanism to detect dead peers and help maintain long-lived idle connections. Default value is 0.

Only the basic keepalive option (SO\_KEEPALIVE) can be enabled or disabled. Platform-specific tuning parameters such as TCP\_KEEPIDLE, TCP\_KEEPINTVL, or TCP\_KEEPCNT are not configurable and will use the operating system’s default values.

For example to read with ffplay a multimedia resource named “sample” from the application “vod” from an RTMP server “myserver”:

ffplay rtmp://myserver/vod/sample

To publish to a password protected server, passing the playpath and app names separately:

ffmpeg -re -i <input> -f flv -rtmp_playpath some/long/path -rtmp_app long/app/name rtmp://username:password@myserver/

3.25 rtmpe

Encrypted Real-Time Messaging Protocol.

The Encrypted Real-Time Messaging Protocol (RTMPE) is used for streaming multimedia content within standard cryptographic primitives, consisting of Diffie-Hellman key exchange and HMACSHA256, generating a pair of RC4 keys.

3.26 rtmps

Real-Time Messaging Protocol over a secure SSL connection.

The Real-Time Messaging Protocol (RTMPS) is used for streaming multimedia content across an encrypted connection.

3.27 rtmpt

Real-Time Messaging Protocol tunneled through HTTP.

The Real-Time Messaging Protocol tunneled through HTTP (RTMPT) is used for streaming multimedia content within HTTP requests to traverse firewalls.

3.28 rtmpte

Encrypted Real-Time Messaging Protocol tunneled through HTTP.

The Encrypted Real-Time Messaging Protocol tunneled through HTTP (RTMPTE) is used for streaming multimedia content within HTTP requests to traverse firewalls.

3.29 rtmpts

Real-Time Messaging Protocol tunneled through HTTPS.

The Real-Time Messaging Protocol tunneled through HTTPS (RTMPTS) is used for streaming multimedia content within HTTPS requests to traverse firewalls.

3.30 libcurl

HTTP and HTTPS access through the libcurl library, available as an alternative to the native http protocol when FFmpeg is built with --enable-libcurl. It runs transfers on a dedicated event-loop thread shared per AVFormatContext, so all of a demuxer’s connections (for example HLS segments) reuse libcurl’s connection cache and HTTP/2 and HTTP/3 multiplexing.

The native http protocol stays the default. There are two ways to use libcurl instead:

  • Prefix the URL with libcurl: to force it explicitly, for example libcurl:https://example.com/video.mp4.
  • Set the prefer_libcurl option to route http:// and https:// URLs through libcurl transparently.

prefer_libcurl : When set to 1, open http(s) URLs with the libcurl protocol instead of the native one. This is a generic IO option rather than a libcurl-specific one, so it also applies on builds without libcurl (where it has no effect). Default is 0.

The libcurl protocol accepts the following options.

user_agent : Override the User-Agent header. Defaults to Lavf/<version>.

referer : Set the Referer header.

headers : Set custom HTTP headers, overriding internal defaults. Multiple headers are separated by newlines.

http_proxy : Set the HTTP proxy to tunnel through.

cookies : Cookies to be sent in future requests, given as newline-delimited Set-Cookie-style values.

location : The actual location of the data after following redirects. This is an output option, read with av_opt_get; demuxers use it to resolve relative URLs.

offset : Initial byte offset of the request. Default is 0.

end_offset : If greater than 0, limit the request to the bytes preceding this offset. Together with offset this requests a sub-range of the resource, as used for HLS byte-range segments.

seekable : Control seekability of the connection. If set to 0 the stream is treated as non-seekable, 1 forces seekable, and -1 (the default) lets it be detected from the server response.

tls_verify : Verify the peer certificate and host name. Enabled by default.

ca_file : Path to a certificate authority bundle that overrides the system store.

cert_file

key_file : Client certificate and private key files for mutual TLS.

connect_timeout : Connection timeout in seconds. 0 (the default) uses libcurl’s own timeout.

max_redirects : Maximum number of redirects to follow. Default is 16.

multiple_requests : Reuse the connection across requests (HTTP keep-alive). Enabled by default; setting it to 0 uses a fresh connection per transfer.

http_version : HTTP version to use: auto (default), 1.0, 1.1, 2, 2tls, 2-prior-knowledge, 3 or 3only.

buffer_size : Size in bytes of the receive buffer. Default is 4 MiB.

request_size : If greater than 0, split a seekable transfer into ranged requests of at most this many bytes each. Default is 0 (a single request).

initial_request_size : Limit the size of initial requests. Similar to request_size, but only used during initial format parsing. Useful for formats like MXF or MOV that require frequent seeks during header parsing. Lasts until the demuxer makes a read request larger than this size (without a seek in between), after which the implementation will continue using requests as usual. Disabled (set to 0) by default.

Note that if enabling this option, it’s strongly recommended to also set
`short_seek_size` to the same value or higher, otherwise the HTTP
connection may be closed and recreated for each subsequent initial request.

max_retries : Maximum number of retries after a recoverable error on a seekable transfer. Default is 5.

short_seek_size : Set the threshold, in bytes, for when a readahead should be preferred over a seek and new HTTP request. This is useful, for example, to make sure the same connection is used for reading large video packets with small audio packets in between.

icy : If set to 1 request ICY (SHOUTcast) metadata from the server. If the server supports this, the metadata has to be retrieved by the application by reading the icy_metadata_headers and icy_metadata_packet options. The default is 1.

icy_status : If set to 1 accept the legacy Shoutcast v1 ICY 200 OK status line in place of an HTTP one. Any reply whose status line starts with ICY 200 is then treated as a successful HTTP 200. The default is 1.

icy_metadata_headers : If the server supports ICY metadata, this contains the ICY-specific HTTP reply headers, separated by newline characters.

icy_metadata_packet : If the server supports ICY metadata, and icy was set to 1, this contains the last non-empty metadata packet sent by the server. It should be polled in regular intervals by applications interested in mid-stream metadata updates.

metadata : Set an exported dictionary containing Icecast metadata from the bitstream, if present. Only useful with the C API.

A stream carrying in-band ICY metadata is always treated as non-seekable, since its byte offsets do not address the payload. seekable, request_size and max_retries therefore have no effect on such a stream.

For more information see: <https://curl.se/libcurl/>.

3.31 libsmbclient

libsmbclient permits one to manipulate CIFS/SMB network resources.

Following syntax is required.

smb://[[domain:]user[:password@]]server[/share[/path[/file]]]

This protocol accepts the following options.

timeout : Set timeout in milliseconds of socket I/O operations used by the underlying low level operation. By default it is set to -1, which means that the timeout is not specified.

truncate : Truncate existing files on write, if set to 1. A value of 0 prevents truncating. Default value is 1.

workgroup : Set the workgroup used for making connections. By default workgroup is not specified.

For more information see: <http://www.samba.org/>.

3.32 libssh

Secure File Transfer Protocol via libssh

Read from or write to remote resources using SFTP protocol.

Following syntax is required.

sftp://[user[:password]@]server[:port]/path/to/remote/resource.mpeg

This protocol accepts the following options.

timeout : Set timeout of socket I/O operations used by the underlying low level operation. By default it is set to -1, which means that the timeout is not specified.

truncate : Truncate existing files on write, if set to 1. A value of 0 prevents truncating. Default value is 1.

private_key : Specify the path of the file containing private key to use during authorization. By default libssh searches for keys in the ~/.ssh/ directory.

verify : Verify the server host key against the known_hosts file before authenticating, if set to 1. Servers that are not in the file, or whose key differs from the one recorded there, are refused. Default value is 1.

Example: Play a file stored on remote server.

ffplay sftp://user:password@server_address:22/home/user/resource.mpeg

3.33 librtmp rtmp, rtmpe, rtmps, rtmpt, rtmpte

Real-Time Messaging Protocol and its variants supported through librtmp.

Requires the presence of the librtmp headers and library during configuration. You need to explicitly configure the build with “–enable-librtmp”. If enabled this will replace the native RTMP protocol.

This protocol provides most client functions and a few server functions needed to support RTMP, RTMP tunneled in HTTP (RTMPT), encrypted RTMP (RTMPE), RTMP over SSL/TLS (RTMPS) and tunneled variants of these encrypted types (RTMPTE, RTMPTS).

The required syntax is:

rtmp_proto://server[:port][/app][/playpath] options

where rtmp_proto is one of the strings “rtmp”, “rtmpt”, “rtmpe”, “rtmps”, “rtmpte”, “rtmpts” corresponding to each RTMP variant, and server, port, app and playpath have the same meaning as specified for the RTMP native protocol. options contains a list of space-separated options of the form key=val.

See the librtmp manual page (man 3 librtmp) for more information.

For example, to stream a file in real-time to an RTMP server using ffmpeg:

ffmpeg -re -i myfile -f flv rtmp://myserver/live/mystream

To play the same stream using ffplay:

ffplay "rtmp://myserver/live/mystream live=1"

3.34 rtp

Real-time Transport Protocol.

The required syntax for an RTP URL is:

rtp://hostname[:port][?options]

port specifies the RTP port to use.

options contains a list of &-separated options of the form key=val. Standard percent-encoding (and using the plus sign for space) can be used to escape keys and values.

Options can also can be specified via command line options (or in code via AVOptions).

The list of supported options follows.

ttl=n : Set the TTL (Time-To-Live) value (for multicast only).

rtcpport=n : Set the remote RTCP port to n.

localport, local_rtpport, localrtpport=n : Set the local RTP port to n.

Using the localport option name is deprecated and should not be used.

local_rtcpport, localrtcpport=n' : Set the local RTCP port to n.

pkt_size=n : Set max packet size (in bytes) to n.

buffer_size=size : Set the maximum UDP socket buffer size in bytes.

connect=0|1 : Do a connect() on the UDP socket (if set to 1) or not (if set to 0).

sources=ip[,ip] : List allowed source IP addresses.

block=ip[,ip] : List disallowed (blocked) source IP addresses.

write_to_source=0|1 : Send packets to the source address of the latest received packet (if set to 1) or to a default remote address (if set to 0).

localaddr=addr : Local IP address of a network interface used for sending packets or joining multicast groups.

timeout=n : Set timeout (in microseconds) of socket I/O operations to n.

Important notes:

  1. If rtcpport is not set the RTCP port will be set to the RTP port value plus 1.
  2. If localrtpport (the local RTP port) is not set any available port will be used for the local RTP and RTCP ports.
  3. If localrtcpport (the local RTCP port) is not set it will be set to the local RTP port value plus 1.

3.35 rtsp

Real-Time Streaming Protocol.

RTSP is not technically a protocol handler in libavformat, it is a demuxer and muxer. The demuxer supports both normal RTSP (with data transferred over RTP; this is used by e.g. Apple and Microsoft) and Real-RTSP (with data transferred over RDT).

The muxer can be used to send a stream using RTSP ANNOUNCE to a server supporting it (currently Darwin Streaming Server and Misc

(本文超出站点单文档体积上限,已截断)