4 Protocols are configured elements in FFmpeg which allow to access
5 resources which require the use of a particular protocol.
7 When you configure your FFmpeg 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.
26 The accepted options are:
36 Playlist to read (BDMV/PLAYLIST/?????.mpls)
42 Read longest playlist from BluRay mounted to /mnt/bluray:
47 Read angle 2 of playlist 4 from BluRay mounted to /mnt/bluray, start from chapter 2:
49 -playlist 4 -angle 2 -chapter 2 bluray:/mnt/bluray
54 Physical concatenation protocol.
56 Allow to read and seek from many resource in sequence as if they were
59 A URL accepted by this protocol has the syntax:
61 concat:@var{URL1}|@var{URL2}|...|@var{URLN}
64 where @var{URL1}, @var{URL2}, ..., @var{URLN} are the urls of the
65 resource to be concatenated, each one possibly specifying a distinct
68 For example to read a sequence of files @file{split1.mpeg},
69 @file{split2.mpeg}, @file{split3.mpeg} with @command{ffplay} use the
72 ffplay concat:split1.mpeg\|split2.mpeg\|split3.mpeg
75 Note that you may need to escape the character "|" which is special for
80 Data in-line in the URI. See @url{http://en.wikipedia.org/wiki/Data_URI_scheme}.
82 For example, to convert a GIF file given inline with @command{ffmpeg}:
84 ffmpeg -i "data:image/gif;base64,R0lGODdhCAAIAMIEAAAAAAAA//8AAP//AP///////////////ywAAAAACAAIAAADF0gEDLojDgdGiJdJqUX02iB4E8Q9jUMkADs=" smiley.png
91 Allow to read from or read to a file.
93 For example to read from a file @file{input.mpeg} with @command{ffmpeg}
96 ffmpeg -i file:input.mpeg output.mpeg
99 The ff* tools default to the file protocol, that is a resource
100 specified with the name "FILE.mpeg" is interpreted as the URL
105 FTP (File Transfer Protocol)
107 Allow to read from or write to remote resources using FTP protocol.
109 Following syntax is required.
111 ftp://[user[:password]@@]server[:port]/path/to/remote/resource.mpeg
114 This protocol accepts the following options.
118 Set timeout of socket I/O operations used by the underlying low level
119 operation. By default it is set to -1, which means that the timeout is
122 @item ftp-anonymous-password
123 Password used when login as anonymous user. Typically an e-mail address
126 @item ftp-write-seekable
127 Control seekability of connection during encoding. If set to 1 the
128 resource is supposed to be seekable, if set to 0 it is assumed not
129 to be seekable. Default value is 0.
132 NOTE: Protocol can be used as output, but it is recommended to not do
133 it, unless special care is taken (tests, customized server configuration
134 etc.). Different FTP servers behave in different way during seek
135 operation. ff* tools may produce incomplete content due to server limitations.
143 Read Apple HTTP Live Streaming compliant segmented stream as
144 a uniform one. The M3U8 playlists describing the segments can be
145 remote HTTP resources or local files, accessed using the standard
147 The nested protocol is declared by specifying
148 "+@var{proto}" after the hls URI scheme name, where @var{proto}
149 is either "file" or "http".
152 hls+http://host/path/to/remote/resource.m3u8
153 hls+file://path/to/local/resource.m3u8
156 Using this protocol is discouraged - the hls demuxer should work
157 just as well (if not, please report the issues) and is more complete.
158 To use the hls demuxer instead, simply use the direct URLs to the
163 HTTP (Hyper Text Transfer Protocol).
165 This protocol accepts the following options.
169 Control seekability of connection. If set to 1 the resource is
170 supposed to be seekable, if set to 0 it is assumed not to be seekable,
171 if set to -1 it will try to autodetect if it is seekable. Default
175 If set to 1 use chunked transfer-encoding for posts, default is 1.
178 Set custom HTTP headers, can override built in default headers. The
179 value must be a string encoding the headers.
182 Force a content type.
185 Override User-Agent header. If not specified the protocol will use a
186 string describing the libavformat build.
188 @item multiple_requests
189 Use persistent connections if set to 1. By default it is 0.
192 Set custom HTTP post data.
195 Set timeout of socket I/O operations used by the underlying low level
196 operation. By default it is set to -1, which means that the timeout is
203 Set the cookies to be sent in future requests. The format of each cookie is the
204 same as the value of a Set-Cookie HTTP response field. Multiple cookies can be
205 delimited by a newline character.
208 @subsection HTTP Cookies
210 Some HTTP requests will be denied unless cookie values are passed in with the
211 request. The @option{cookies} option allows these cookies to be specified. At
212 the very least, each cookie must specify a value along with a path and domain.
213 HTTP requests that match both the domain and path will automatically include the
214 cookie value in the HTTP Cookie header field. Multiple cookies can be delimited
217 The required syntax to play a stream specifying a cookie is:
219 ffplay -cookies "nlqptid=nltid=tsn; path=/; domain=somedomain.com;" http://somedomain.com/somestream.m3u8
224 MMS (Microsoft Media Server) protocol over TCP.
228 MMS (Microsoft Media Server) protocol over HTTP.
230 The required syntax is:
232 mmsh://@var{server}[:@var{port}][/@var{app}][/@var{playpath}]
239 Computes the MD5 hash of the data to be written, and on close writes
240 this to the designated output or stdout if none is specified. It can
241 be used to test muxers without writing an actual file.
243 Some examples follow.
245 # Write the MD5 hash of the encoded AVI file to the file output.avi.md5.
246 ffmpeg -i input.flv -f avi -y md5:output.avi.md5
248 # Write the MD5 hash of the encoded AVI file to stdout.
249 ffmpeg -i input.flv -f avi -y md5:
252 Note that some formats (typically MOV) require the output protocol to
253 be seekable, so they will fail with the MD5 output protocol.
257 UNIX pipe access protocol.
259 Allow to read and write from UNIX pipes.
261 The accepted syntax is:
266 @var{number} is the number corresponding to the file descriptor of the
267 pipe (e.g. 0 for stdin, 1 for stdout, 2 for stderr). If @var{number}
268 is not specified, by default the stdout file descriptor will be used
269 for writing, stdin for reading.
271 For example to read from stdin with @command{ffmpeg}:
273 cat test.wav | ffmpeg -i pipe:0
274 # ...this is the same as...
275 cat test.wav | ffmpeg -i pipe:
278 For writing to stdout with @command{ffmpeg}:
280 ffmpeg -i test.wav -f avi pipe:1 | cat > test.avi
281 # ...this is the same as...
282 ffmpeg -i test.wav -f avi pipe: | cat > test.avi
285 Note that some formats (typically MOV), require the output protocol to
286 be seekable, so they will fail with the pipe output protocol.
290 Real-Time Messaging Protocol.
292 The Real-Time Messaging Protocol (RTMP) is used for streaming multimedia
293 content across a TCP/IP network.
295 The required syntax is:
297 rtmp://@var{server}[:@var{port}][/@var{app}][/@var{instance}][/@var{playpath}]
300 The accepted parameters are:
304 The address of the RTMP server.
307 The number of the TCP port to use (by default is 1935).
310 It is the name of the application to access. It usually corresponds to
311 the path where the application is installed on the RTMP server
312 (e.g. @file{/ondemand/}, @file{/flash/live/}, etc.). You can override
313 the value parsed from the URI through the @code{rtmp_app} option, too.
316 It is the path or name of the resource to play with reference to the
317 application specified in @var{app}, may be prefixed by "mp4:". You
318 can override the value parsed from the URI through the @code{rtmp_playpath}
322 Act as a server, listening for an incoming connection.
325 Maximum time to wait for the incoming connection. Implies listen.
328 Additionally, the following parameters can be set via command line options
329 (or in code via @code{AVOption}s):
333 Name of application to connect on the RTMP server. This option
334 overrides the parameter specified in the URI.
337 Set the client buffer time in milliseconds. The default is 3000.
340 Extra arbitrary AMF connection parameters, parsed from a string,
341 e.g. like @code{B:1 S:authMe O:1 NN:code:1.23 NS:flag:ok O:0}.
342 Each value is prefixed by a single character denoting the type,
343 B for Boolean, N for number, S for string, O for object, or Z for null,
344 followed by a colon. For Booleans the data must be either 0 or 1 for
345 FALSE or TRUE, respectively. Likewise for Objects the data must be 0 or
346 1 to end or begin an object, respectively. Data items in subobjects may
347 be named, by prefixing the type with 'N' and specifying the name before
348 the value (i.e. @code{NB:myFlag:1}). This option may be used multiple
349 times to construct arbitrary AMF sequences.
352 Version of the Flash plugin used to run the SWF player. The default
355 @item rtmp_flush_interval
356 Number of packets flushed in the same request (RTMPT only). The default
360 Specify that the media is a live stream. No resuming or seeking in
361 live streams is possible. The default value is @code{any}, which means the
362 subscriber first tries to play the live stream specified in the
363 playpath. If a live stream of that name is not found, it plays the
364 recorded stream. The other possible values are @code{live} and
368 URL of the web page in which the media was embedded. By default no
372 Stream identifier to play or to publish. This option overrides the
373 parameter specified in the URI.
376 Name of live stream to subscribe to. By default no value will be sent.
377 It is only sent if the option is specified or if rtmp_live
381 SHA256 hash of the decompressed SWF file (32 bytes).
384 Size of the decompressed SWF file, required for SWFVerification.
387 URL of the SWF player for the media. By default no value will be sent.
390 URL to player swf file, compute hash/size automatically.
393 URL of the target stream. Defaults to proto://host[:port]/app.
397 For example to read with @command{ffplay} a multimedia resource named
398 "sample" from the application "vod" from an RTMP server "myserver":
400 ffplay rtmp://myserver/vod/sample
405 Encrypted Real-Time Messaging Protocol.
407 The Encrypted Real-Time Messaging Protocol (RTMPE) is used for
408 streaming multimedia content within standard cryptographic primitives,
409 consisting of Diffie-Hellman key exchange and HMACSHA256, generating
414 Real-Time Messaging Protocol over a secure SSL connection.
416 The Real-Time Messaging Protocol (RTMPS) is used for streaming
417 multimedia content across an encrypted connection.
421 Real-Time Messaging Protocol tunneled through HTTP.
423 The Real-Time Messaging Protocol tunneled through HTTP (RTMPT) is used
424 for streaming multimedia content within HTTP requests to traverse
429 Encrypted Real-Time Messaging Protocol tunneled through HTTP.
431 The Encrypted Real-Time Messaging Protocol tunneled through HTTP (RTMPTE)
432 is used for streaming multimedia content within HTTP requests to traverse
437 Real-Time Messaging Protocol tunneled through HTTPS.
439 The Real-Time Messaging Protocol tunneled through HTTPS (RTMPTS) is used
440 for streaming multimedia content within HTTPS requests to traverse
443 @section rtmp, rtmpe, rtmps, rtmpt, rtmpte
445 Real-Time Messaging Protocol and its variants supported through
448 Requires the presence of the librtmp headers and library during
449 configuration. You need to explicitly configure the build with
450 "--enable-librtmp". If enabled this will replace the native RTMP
453 This protocol provides most client functions and a few server
454 functions needed to support RTMP, RTMP tunneled in HTTP (RTMPT),
455 encrypted RTMP (RTMPE), RTMP over SSL/TLS (RTMPS) and tunneled
456 variants of these encrypted types (RTMPTE, RTMPTS).
458 The required syntax is:
460 @var{rtmp_proto}://@var{server}[:@var{port}][/@var{app}][/@var{playpath}] @var{options}
463 where @var{rtmp_proto} is one of the strings "rtmp", "rtmpt", "rtmpe",
464 "rtmps", "rtmpte", "rtmpts" corresponding to each RTMP variant, and
465 @var{server}, @var{port}, @var{app} and @var{playpath} have the same
466 meaning as specified for the RTMP native protocol.
467 @var{options} contains a list of space-separated options of the form
470 See the librtmp manual page (man 3 librtmp) for more information.
472 For example, to stream a file in real-time to an RTMP server using
475 ffmpeg -re -i myfile -f flv rtmp://myserver/live/mystream
478 To play the same stream using @command{ffplay}:
480 ffplay "rtmp://myserver/live/mystream live=1"
489 RTSP is not technically a protocol handler in libavformat, it is a demuxer
490 and muxer. The demuxer supports both normal RTSP (with data transferred
491 over RTP; this is used by e.g. Apple and Microsoft) and Real-RTSP (with
492 data transferred over RDT).
494 The muxer can be used to send a stream using RTSP ANNOUNCE to a server
495 supporting it (currently Darwin Streaming Server and Mischa Spiegelmock's
496 @uref{http://github.com/revmischa/rtsp-server, RTSP server}).
498 The required syntax for a RTSP url is:
500 rtsp://@var{hostname}[:@var{port}]/@var{path}
503 The following options (set on the @command{ffmpeg}/@command{ffplay} command
504 line, or set in code via @code{AVOption}s or in @code{avformat_open_input}),
507 Flags for @code{rtsp_transport}:
512 Use UDP as lower transport protocol.
515 Use TCP (interleaving within the RTSP control channel) as lower
519 Use UDP multicast as lower transport protocol.
522 Use HTTP tunneling as lower transport protocol, which is useful for
526 Multiple lower transport protocols may be specified, in that case they are
527 tried one at a time (if the setup of one fails, the next one is tried).
528 For the muxer, only the @code{tcp} and @code{udp} options are supported.
530 Flags for @code{rtsp_flags}:
534 Accept packets only from negotiated peer address and port.
536 Act as a server, listening for an incoming connection.
539 When receiving data over UDP, the demuxer tries to reorder received packets
540 (since they may arrive out of order, or packets may get lost totally). This
541 can be disabled by setting the maximum demuxing delay to zero (via
542 the @code{max_delay} field of AVFormatContext).
544 When watching multi-bitrate Real-RTSP streams with @command{ffplay}, the
545 streams to display can be chosen with @code{-vst} @var{n} and
546 @code{-ast} @var{n} for video and audio respectively, and can be switched
547 on the fly by pressing @code{v} and @code{a}.
549 Example command lines:
551 To watch a stream over UDP, with a max reordering delay of 0.5 seconds:
554 ffplay -max_delay 500000 -rtsp_transport udp rtsp://server/video.mp4
557 To watch a stream tunneled over HTTP:
560 ffplay -rtsp_transport http rtsp://server/video.mp4
563 To send a stream in realtime to a RTSP server, for others to watch:
566 ffmpeg -re -i @var{input} -f rtsp -muxdelay 0.1 rtsp://server/live.sdp
569 To receive a stream in realtime:
572 ffmpeg -rtsp_flags listen -i rtsp://ownaddress/live.sdp @var{output}
577 Socket IO timeout in micro seconds.
582 Session Announcement Protocol (RFC 2974). This is not technically a
583 protocol handler in libavformat, it is a muxer and demuxer.
584 It is used for signalling of RTP streams, by announcing the SDP for the
585 streams regularly on a separate port.
589 The syntax for a SAP url given to the muxer is:
591 sap://@var{destination}[:@var{port}][?@var{options}]
594 The RTP packets are sent to @var{destination} on port @var{port},
595 or to port 5004 if no port is specified.
596 @var{options} is a @code{&}-separated list. The following options
601 @item announce_addr=@var{address}
602 Specify the destination IP address for sending the announcements to.
603 If omitted, the announcements are sent to the commonly used SAP
604 announcement multicast address 224.2.127.254 (sap.mcast.net), or
605 ff0e::2:7ffe if @var{destination} is an IPv6 address.
607 @item announce_port=@var{port}
608 Specify the port to send the announcements on, defaults to
609 9875 if not specified.
612 Specify the time to live value for the announcements and RTP packets,
615 @item same_port=@var{0|1}
616 If set to 1, send all RTP streams on the same port pair. If zero (the
617 default), all streams are sent on unique ports, with each stream on a
618 port 2 numbers higher than the previous.
619 VLC/Live555 requires this to be set to 1, to be able to receive the stream.
620 The RTP stack in libavformat for receiving requires all streams to be sent
624 Example command lines follow.
626 To broadcast a stream on the local subnet, for watching in VLC:
629 ffmpeg -re -i @var{input} -f sap sap://224.0.0.255?same_port=1
632 Similarly, for watching in @command{ffplay}:
635 ffmpeg -re -i @var{input} -f sap sap://224.0.0.255
638 And for watching in @command{ffplay}, over IPv6:
641 ffmpeg -re -i @var{input} -f sap sap://[ff0e::1:2:3:4]
646 The syntax for a SAP url given to the demuxer is:
648 sap://[@var{address}][:@var{port}]
651 @var{address} is the multicast address to listen for announcements on,
652 if omitted, the default 224.2.127.254 (sap.mcast.net) is used. @var{port}
653 is the port that is listened on, 9875 if omitted.
655 The demuxers listens for announcements on the given address and port.
656 Once an announcement is received, it tries to receive that particular stream.
658 Example command lines follow.
660 To play back the first stream announced on the normal SAP multicast address:
666 To play back the first stream announced on one the default IPv6 SAP multicast address:
669 ffplay sap://[ff0e::2:7ffe]
674 Trasmission Control Protocol.
676 The required syntax for a TCP url is:
678 tcp://@var{hostname}:@var{port}[?@var{options}]
684 Listen for an incoming connection
686 @item timeout=@var{microseconds}
687 In read mode: if no data arrived in more than this time interval, raise error.
688 In write mode: if socket cannot be written in more than this time interval, raise error.
689 This also sets timeout on TCP connection establishing.
692 ffmpeg -i @var{input} -f @var{format} tcp://@var{hostname}:@var{port}?listen
693 ffplay tcp://@var{hostname}:@var{port}
700 Transport Layer Security/Secure Sockets Layer
702 The required syntax for a TLS/SSL url is:
704 tls://@var{hostname}:@var{port}[?@var{options}]
710 Act as a server, listening for an incoming connection.
712 @item cafile=@var{filename}
713 Certificate authority file. The file must be in OpenSSL PEM format.
715 @item cert=@var{filename}
716 Certificate file. The file must be in OpenSSL PEM format.
718 @item key=@var{filename}
721 @item verify=@var{0|1}
722 Verify the peer's certificate.
726 Example command lines:
728 To create a TLS/SSL server that serves an input stream.
731 ffmpeg -i @var{input} -f @var{format} tls://@var{hostname}:@var{port}?listen&cert=@var{server.crt}&key=@var{server.key}
734 To play back a stream from the TLS/SSL server using @command{ffplay}:
737 ffplay tls://@var{hostname}:@var{port}
742 User Datagram Protocol.
744 The required syntax for a UDP url is:
746 udp://@var{hostname}:@var{port}[?@var{options}]
749 @var{options} contains a list of &-separated options of the form @var{key}=@var{val}.
751 In case threading is enabled on the system, a circular buffer is used
752 to store the incoming data, which allows to reduce loss of data due to
753 UDP socket buffer overruns. The @var{fifo_size} and
754 @var{overrun_nonfatal} options are related to this buffer.
756 The list of supported options follows.
760 @item buffer_size=@var{size}
761 Set the UDP socket buffer size in bytes. This is used both for the
762 receiving and the sending buffer size.
764 @item localport=@var{port}
765 Override the local UDP port to bind with.
767 @item localaddr=@var{addr}
768 Choose the local IP address. This is useful e.g. if sending multicast
769 and the host has multiple interfaces, where the user can choose
770 which interface to send on by specifying the IP address of that interface.
772 @item pkt_size=@var{size}
773 Set the size in bytes of UDP packets.
775 @item reuse=@var{1|0}
776 Explicitly allow or disallow reusing UDP sockets.
779 Set the time to live value (for multicast only).
781 @item connect=@var{1|0}
782 Initialize the UDP socket with @code{connect()}. In this case, the
783 destination address can't be changed with ff_udp_set_remote_url later.
784 If the destination address isn't known at the start, this option can
785 be specified in ff_udp_set_remote_url, too.
786 This allows finding out the source address for the packets with getsockname,
787 and makes writes return with AVERROR(ECONNREFUSED) if "destination
788 unreachable" is received.
789 For receiving, this gives the benefit of only receiving packets from
790 the specified peer address/port.
792 @item sources=@var{address}[,@var{address}]
793 Only receive packets sent to the multicast group from one of the
794 specified sender IP addresses.
796 @item block=@var{address}[,@var{address}]
797 Ignore packets sent to the multicast group from the specified
800 @item fifo_size=@var{units}
801 Set the UDP receiving circular buffer size, expressed as a number of
802 packets with size of 188 bytes. If not specified defaults to 7*4096.
804 @item overrun_nonfatal=@var{1|0}
805 Survive in case of UDP receiving circular buffer overrun. Default
808 @item timeout=@var{microseconds}
809 In read mode: if no data arrived in more than this time interval, raise error.
812 Some usage examples of the UDP protocol with @command{ffmpeg} follow.
814 To stream over UDP to a remote endpoint:
816 ffmpeg -i @var{input} -f @var{format} udp://@var{hostname}:@var{port}
819 To stream in mpegts format over UDP using 188 sized UDP packets, using a large input buffer:
821 ffmpeg -i @var{input} -f mpegts udp://@var{hostname}:@var{port}?pkt_size=188&buffer_size=65535
824 To receive over UDP from a remote endpoint:
826 ffmpeg -i udp://[@var{multicast-address}]:@var{port}