4 Protocols are configured elements in Libav which allow to access
5 resources which require the use of a particular protocol.
7 When you configure your Libav build, all the supported protocols are
8 enabled by default. You can list all available ones using the
9 configure option "--list-protocols".
11 You can disable all the protocols using the configure option
12 "--disable-protocols", and selectively enable a protocol using the
13 option "--enable-protocol=@var{PROTOCOL}", or you can disable a
14 particular protocol using the option
15 "--disable-protocol=@var{PROTOCOL}".
17 The option "-protocols" of the ff* tools will display the list of
20 A description of the currently available protocols follows.
24 Read Apple HTTP Live Streaming compliant segmented stream as
25 a uniform one. The M3U8 playlists describing the segments can be
26 remote HTTP resources or local files, accessed using the standard
28 The nested protocol is declared by specifying
29 "+@var{proto}" after the hls URI scheme name, where @var{proto}
30 is either "file" or "http".
33 hls+http://host/path/to/remote/resource.m3u8
34 hls+file://path/to/local/resource.m3u8
39 Physical concatenation protocol.
41 Allow to read and seek from many resource in sequence as if they were
44 A URL accepted by this protocol has the syntax:
46 concat:@var{URL1}|@var{URL2}|...|@var{URLN}
49 where @var{URL1}, @var{URL2}, ..., @var{URLN} are the urls of the
50 resource to be concatenated, each one possibly specifying a distinct
53 For example to read a sequence of files @file{split1.mpeg},
54 @file{split2.mpeg}, @file{split3.mpeg} with @file{avplay} use the
57 avplay concat:split1.mpeg\|split2.mpeg\|split3.mpeg
60 Note that you may need to escape the character "|" which is special for
67 Allow to read from or read to a file.
69 For example to read from a file @file{input.mpeg} with @command{avconv}
72 avconv -i file:input.mpeg output.mpeg
75 The ff* tools default to the file protocol, that is a resource
76 specified with the name "FILE.mpeg" is interpreted as the URL
85 HTTP (Hyper Text Transfer Protocol).
89 MMS (Microsoft Media Server) protocol over TCP.
93 MMS (Microsoft Media Server) protocol over HTTP.
95 The required syntax is:
97 mmsh://@var{server}[:@var{port}][/@var{app}][/@var{playpath}]
104 Computes the MD5 hash of the data to be written, and on close writes
105 this to the designated output or stdout if none is specified. It can
106 be used to test muxers without writing an actual file.
108 Some examples follow.
110 # Write the MD5 hash of the encoded AVI file to the file output.avi.md5.
111 avconv -i input.flv -f avi -y md5:output.avi.md5
113 # Write the MD5 hash of the encoded AVI file to stdout.
114 avconv -i input.flv -f avi -y md5:
117 Note that some formats (typically MOV) require the output protocol to
118 be seekable, so they will fail with the MD5 output protocol.
122 UNIX pipe access protocol.
124 Allow to read and write from UNIX pipes.
126 The accepted syntax is:
131 @var{number} is the number corresponding to the file descriptor of the
132 pipe (e.g. 0 for stdin, 1 for stdout, 2 for stderr). If @var{number}
133 is not specified, by default the stdout file descriptor will be used
134 for writing, stdin for reading.
136 For example to read from stdin with @command{avconv}:
138 cat test.wav | avconv -i pipe:0
139 # ...this is the same as...
140 cat test.wav | avconv -i pipe:
143 For writing to stdout with @command{avconv}:
145 avconv -i test.wav -f avi pipe:1 | cat > test.avi
146 # ...this is the same as...
147 avconv -i test.wav -f avi pipe: | cat > test.avi
150 Note that some formats (typically MOV), require the output protocol to
151 be seekable, so they will fail with the pipe output protocol.
155 Real-Time Messaging Protocol.
157 The Real-Time Messaging Protocol (RTMP) is used for streaming multimedia
158 content across a TCP/IP network.
160 The required syntax is:
162 rtmp://@var{server}[:@var{port}][/@var{app}][/@var{playpath}]
165 The accepted parameters are:
169 The address of the RTMP server.
172 The number of the TCP port to use (by default is 1935).
175 It is the name of the application to access. It usually corresponds to
176 the path where the application is installed on the RTMP server
177 (e.g. @file{/ondemand/}, @file{/flash/live/}, etc.).
180 It is the path or name of the resource to play with reference to the
181 application specified in @var{app}, may be prefixed by "mp4:".
185 For example to read with @file{avplay} a multimedia resource named
186 "sample" from the application "vod" from an RTMP server "myserver":
188 avplay rtmp://myserver/vod/sample
191 @section rtmp, rtmpe, rtmps, rtmpt, rtmpte
193 Real-Time Messaging Protocol and its variants supported through
196 Requires the presence of the librtmp headers and library during
197 configuration. You need to explicitly configure the build with
198 "--enable-librtmp". If enabled this will replace the native RTMP
201 This protocol provides most client functions and a few server
202 functions needed to support RTMP, RTMP tunneled in HTTP (RTMPT),
203 encrypted RTMP (RTMPE), RTMP over SSL/TLS (RTMPS) and tunneled
204 variants of these encrypted types (RTMPTE, RTMPTS).
206 The required syntax is:
208 @var{rtmp_proto}://@var{server}[:@var{port}][/@var{app}][/@var{playpath}] @var{options}
211 where @var{rtmp_proto} is one of the strings "rtmp", "rtmpt", "rtmpe",
212 "rtmps", "rtmpte", "rtmpts" corresponding to each RTMP variant, and
213 @var{server}, @var{port}, @var{app} and @var{playpath} have the same
214 meaning as specified for the RTMP native protocol.
215 @var{options} contains a list of space-separated options of the form
218 See the librtmp manual page (man 3 librtmp) for more information.
220 For example, to stream a file in real-time to an RTMP server using
223 avconv -re -i myfile -f flv rtmp://myserver/live/mystream
226 To play the same stream using @file{avplay}:
228 avplay "rtmp://myserver/live/mystream live=1"
237 RTSP is not technically a protocol handler in libavformat, it is a demuxer
238 and muxer. The demuxer supports both normal RTSP (with data transferred
239 over RTP; this is used by e.g. Apple and Microsoft) and Real-RTSP (with
240 data transferred over RDT).
242 The muxer can be used to send a stream using RTSP ANNOUNCE to a server
243 supporting it (currently Darwin Streaming Server and Mischa Spiegelmock's
244 @uref{http://github.com/revmischa/rtsp-server, RTSP server}).
246 The required syntax for a RTSP url is:
248 rtsp://@var{hostname}[:@var{port}]/@var{path}
251 The following options (set on the @command{avconv}/@file{avplay} command
252 line, or set in code via @code{AVOption}s or in @code{avformat_open_input}),
255 Flags for @code{rtsp_transport}:
260 Use UDP as lower transport protocol.
263 Use TCP (interleaving within the RTSP control channel) as lower
267 Use UDP multicast as lower transport protocol.
270 Use HTTP tunneling as lower transport protocol, which is useful for
274 Multiple lower transport protocols may be specified, in that case they are
275 tried one at a time (if the setup of one fails, the next one is tried).
276 For the muxer, only the @code{tcp} and @code{udp} options are supported.
278 Flags for @code{rtsp_flags}:
282 Accept packets only from negotiated peer address and port.
285 When receiving data over UDP, the demuxer tries to reorder received packets
286 (since they may arrive out of order, or packets may get lost totally). In
287 order for this to be enabled, a maximum delay must be specified in the
288 @code{max_delay} field of AVFormatContext.
290 When watching multi-bitrate Real-RTSP streams with @file{avplay}, the
291 streams to display can be chosen with @code{-vst} @var{n} and
292 @code{-ast} @var{n} for video and audio respectively, and can be switched
293 on the fly by pressing @code{v} and @code{a}.
295 Example command lines:
297 To watch a stream over UDP, with a max reordering delay of 0.5 seconds:
300 avplay -max_delay 500000 -rtsp_transport udp rtsp://server/video.mp4
303 To watch a stream tunneled over HTTP:
306 avplay -rtsp_transport http rtsp://server/video.mp4
309 To send a stream in realtime to a RTSP server, for others to watch:
312 avconv -re -i @var{input} -f rtsp -muxdelay 0.1 rtsp://server/live.sdp
317 Session Announcement Protocol (RFC 2974). This is not technically a
318 protocol handler in libavformat, it is a muxer and demuxer.
319 It is used for signalling of RTP streams, by announcing the SDP for the
320 streams regularly on a separate port.
324 The syntax for a SAP url given to the muxer is:
326 sap://@var{destination}[:@var{port}][?@var{options}]
329 The RTP packets are sent to @var{destination} on port @var{port},
330 or to port 5004 if no port is specified.
331 @var{options} is a @code{&}-separated list. The following options
336 @item announce_addr=@var{address}
337 Specify the destination IP address for sending the announcements to.
338 If omitted, the announcements are sent to the commonly used SAP
339 announcement multicast address 224.2.127.254 (sap.mcast.net), or
340 ff0e::2:7ffe if @var{destination} is an IPv6 address.
342 @item announce_port=@var{port}
343 Specify the port to send the announcements on, defaults to
344 9875 if not specified.
347 Specify the time to live value for the announcements and RTP packets,
350 @item same_port=@var{0|1}
351 If set to 1, send all RTP streams on the same port pair. If zero (the
352 default), all streams are sent on unique ports, with each stream on a
353 port 2 numbers higher than the previous.
354 VLC/Live555 requires this to be set to 1, to be able to receive the stream.
355 The RTP stack in libavformat for receiving requires all streams to be sent
359 Example command lines follow.
361 To broadcast a stream on the local subnet, for watching in VLC:
364 avconv -re -i @var{input} -f sap sap://224.0.0.255?same_port=1
367 Similarly, for watching in avplay:
370 avconv -re -i @var{input} -f sap sap://224.0.0.255
373 And for watching in avplay, over IPv6:
376 avconv -re -i @var{input} -f sap sap://[ff0e::1:2:3:4]
381 The syntax for a SAP url given to the demuxer is:
383 sap://[@var{address}][:@var{port}]
386 @var{address} is the multicast address to listen for announcements on,
387 if omitted, the default 224.2.127.254 (sap.mcast.net) is used. @var{port}
388 is the port that is listened on, 9875 if omitted.
390 The demuxers listens for announcements on the given address and port.
391 Once an announcement is received, it tries to receive that particular stream.
393 Example command lines follow.
395 To play back the first stream announced on the normal SAP multicast address:
401 To play back the first stream announced on one the default IPv6 SAP multicast address:
404 avplay sap://[ff0e::2:7ffe]
409 Trasmission Control Protocol.
411 The required syntax for a TCP url is:
413 tcp://@var{hostname}:@var{port}[?@var{options}]
419 Listen for an incoming connection
422 avconv -i @var{input} -f @var{format} tcp://@var{hostname}:@var{port}?listen
423 avplay tcp://@var{hostname}:@var{port}
430 User Datagram Protocol.
432 The required syntax for a UDP url is:
434 udp://@var{hostname}:@var{port}[?@var{options}]
437 @var{options} contains a list of &-seperated options of the form @var{key}=@var{val}.
438 Follow the list of supported options.
442 @item buffer_size=@var{size}
443 set the UDP buffer size in bytes
445 @item localport=@var{port}
446 override the local UDP port to bind with
448 @item localaddr=@var{addr}
449 Choose the local IP address. This is useful e.g. if sending multicast
450 and the host has multiple interfaces, where the user can choose
451 which interface to send on by specifying the IP address of that interface.
453 @item pkt_size=@var{size}
454 set the size in bytes of UDP packets
456 @item reuse=@var{1|0}
457 explicitly allow or disallow reusing UDP sockets
460 set the time to live value (for multicast only)
462 @item connect=@var{1|0}
463 Initialize the UDP socket with @code{connect()}. In this case, the
464 destination address can't be changed with ff_udp_set_remote_url later.
465 If the destination address isn't known at the start, this option can
466 be specified in ff_udp_set_remote_url, too.
467 This allows finding out the source address for the packets with getsockname,
468 and makes writes return with AVERROR(ECONNREFUSED) if "destination
469 unreachable" is received.
470 For receiving, this gives the benefit of only receiving packets from
471 the specified peer address/port.
474 Some usage examples of the udp protocol with @command{avconv} follow.
476 To stream over UDP to a remote endpoint:
478 avconv -i @var{input} -f @var{format} udp://@var{hostname}:@var{port}
481 To stream in mpegts format over UDP using 188 sized UDP packets, using a large input buffer:
483 avconv -i @var{input} -f mpegts udp://@var{hostname}:@var{port}?pkt_size=188&buffer_size=65535
486 To receive over UDP from a remote endpoint:
488 avconv -i udp://[@var{multicast-address}]:@var{port}