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 Caching wrapper for input stream.
56 Cache the input stream to temporary file. It brings seeking capability to live streams.
64 Physical concatenation protocol.
66 Allow to read and seek from many resource in sequence as if they were
69 A URL accepted by this protocol has the syntax:
71 concat:@var{URL1}|@var{URL2}|...|@var{URLN}
74 where @var{URL1}, @var{URL2}, ..., @var{URLN} are the urls of the
75 resource to be concatenated, each one possibly specifying a distinct
78 For example to read a sequence of files @file{split1.mpeg},
79 @file{split2.mpeg}, @file{split3.mpeg} with @command{ffplay} use the
82 ffplay concat:split1.mpeg\|split2.mpeg\|split3.mpeg
85 Note that you may need to escape the character "|" which is special for
90 AES-encrypted stream reading protocol.
92 The accepted options are:
95 Set the AES decryption key binary block from given hexadecimal representation.
98 Set the AES decryption initialization vector binary block from given hexadecimal representation.
101 Accepted URL formats:
109 Data in-line in the URI. See @url{http://en.wikipedia.org/wiki/Data_URI_scheme}.
111 For example, to convert a GIF file given inline with @command{ffmpeg}:
113 ffmpeg -i "data:image/gif;base64,R0lGODdhCAAIAMIEAAAAAAAA//8AAP//AP///////////////ywAAAAACAAIAAADF0gEDLojDgdGiJdJqUX02iB4E8Q9jUMkADs=" smiley.png
118 File access protocol.
120 Allow to read from or read to a file.
122 For example to read from a file @file{input.mpeg} with @command{ffmpeg}
125 ffmpeg -i file:input.mpeg output.mpeg
128 The ff* tools default to the file protocol, that is a resource
129 specified with the name "FILE.mpeg" is interpreted as the URL
134 FTP (File Transfer Protocol).
136 Allow to read from or write to remote resources using FTP protocol.
138 Following syntax is required.
140 ftp://[user[:password]@@]server[:port]/path/to/remote/resource.mpeg
143 This protocol accepts the following options.
147 Set timeout of socket I/O operations used by the underlying low level
148 operation. By default it is set to -1, which means that the timeout is
151 @item ftp-anonymous-password
152 Password used when login as anonymous user. Typically an e-mail address
155 @item ftp-write-seekable
156 Control seekability of connection during encoding. If set to 1 the
157 resource is supposed to be seekable, if set to 0 it is assumed not
158 to be seekable. Default value is 0.
161 NOTE: Protocol can be used as output, but it is recommended to not do
162 it, unless special care is taken (tests, customized server configuration
163 etc.). Different FTP servers behave in different way during seek
164 operation. ff* tools may produce incomplete content due to server limitations.
172 Read Apple HTTP Live Streaming compliant segmented stream as
173 a uniform one. The M3U8 playlists describing the segments can be
174 remote HTTP resources or local files, accessed using the standard
176 The nested protocol is declared by specifying
177 "+@var{proto}" after the hls URI scheme name, where @var{proto}
178 is either "file" or "http".
181 hls+http://host/path/to/remote/resource.m3u8
182 hls+file://path/to/local/resource.m3u8
185 Using this protocol is discouraged - the hls demuxer should work
186 just as well (if not, please report the issues) and is more complete.
187 To use the hls demuxer instead, simply use the direct URLs to the
192 HTTP (Hyper Text Transfer Protocol).
194 This protocol accepts the following options.
198 Control seekability of connection. If set to 1 the resource is
199 supposed to be seekable, if set to 0 it is assumed not to be seekable,
200 if set to -1 it will try to autodetect if it is seekable. Default
204 If set to 1 use chunked transfer-encoding for posts, default is 1.
207 Set custom HTTP headers, can override built in default headers. The
208 value must be a string encoding the headers.
211 Force a content type.
214 Override User-Agent header. If not specified the protocol will use a
215 string describing the libavformat build.
217 @item multiple_requests
218 Use persistent connections if set to 1. By default it is 0.
221 Set custom HTTP post data.
224 Set timeout of socket I/O operations used by the underlying low level
225 operation. By default it is set to -1, which means that the timeout is
232 Set the cookies to be sent in future requests. The format of each cookie is the
233 same as the value of a Set-Cookie HTTP response field. Multiple cookies can be
234 delimited by a newline character.
237 @subsection HTTP Cookies
239 Some HTTP requests will be denied unless cookie values are passed in with the
240 request. The @option{cookies} option allows these cookies to be specified. At
241 the very least, each cookie must specify a value along with a path and domain.
242 HTTP requests that match both the domain and path will automatically include the
243 cookie value in the HTTP Cookie header field. Multiple cookies can be delimited
246 The required syntax to play a stream specifying a cookie is:
248 ffplay -cookies "nlqptid=nltid=tsn; path=/; domain=somedomain.com;" http://somedomain.com/somestream.m3u8
253 MMS (Microsoft Media Server) protocol over TCP.
257 MMS (Microsoft Media Server) protocol over HTTP.
259 The required syntax is:
261 mmsh://@var{server}[:@var{port}][/@var{app}][/@var{playpath}]
268 Computes the MD5 hash of the data to be written, and on close writes
269 this to the designated output or stdout if none is specified. It can
270 be used to test muxers without writing an actual file.
272 Some examples follow.
274 # Write the MD5 hash of the encoded AVI file to the file output.avi.md5.
275 ffmpeg -i input.flv -f avi -y md5:output.avi.md5
277 # Write the MD5 hash of the encoded AVI file to stdout.
278 ffmpeg -i input.flv -f avi -y md5:
281 Note that some formats (typically MOV) require the output protocol to
282 be seekable, so they will fail with the MD5 output protocol.
286 UNIX pipe access protocol.
288 Allow to read and write from UNIX pipes.
290 The accepted syntax is:
295 @var{number} is the number corresponding to the file descriptor of the
296 pipe (e.g. 0 for stdin, 1 for stdout, 2 for stderr). If @var{number}
297 is not specified, by default the stdout file descriptor will be used
298 for writing, stdin for reading.
300 For example to read from stdin with @command{ffmpeg}:
302 cat test.wav | ffmpeg -i pipe:0
303 # ...this is the same as...
304 cat test.wav | ffmpeg -i pipe:
307 For writing to stdout with @command{ffmpeg}:
309 ffmpeg -i test.wav -f avi pipe:1 | cat > test.avi
310 # ...this is the same as...
311 ffmpeg -i test.wav -f avi pipe: | cat > test.avi
314 Note that some formats (typically MOV), require the output protocol to
315 be seekable, so they will fail with the pipe output protocol.
319 Real-Time Messaging Protocol.
321 The Real-Time Messaging Protocol (RTMP) is used for streaming multimedia
322 content across a TCP/IP network.
324 The required syntax is:
326 rtmp://@var{server}[:@var{port}][/@var{app}][/@var{instance}][/@var{playpath}]
329 The accepted parameters are:
333 The address of the RTMP server.
336 The number of the TCP port to use (by default is 1935).
339 It is the name of the application to access. It usually corresponds to
340 the path where the application is installed on the RTMP server
341 (e.g. @file{/ondemand/}, @file{/flash/live/}, etc.). You can override
342 the value parsed from the URI through the @code{rtmp_app} option, too.
345 It is the path or name of the resource to play with reference to the
346 application specified in @var{app}, may be prefixed by "mp4:". You
347 can override the value parsed from the URI through the @code{rtmp_playpath}
351 Act as a server, listening for an incoming connection.
354 Maximum time to wait for the incoming connection. Implies listen.
357 Additionally, the following parameters can be set via command line options
358 (or in code via @code{AVOption}s):
362 Name of application to connect on the RTMP server. This option
363 overrides the parameter specified in the URI.
366 Set the client buffer time in milliseconds. The default is 3000.
369 Extra arbitrary AMF connection parameters, parsed from a string,
370 e.g. like @code{B:1 S:authMe O:1 NN:code:1.23 NS:flag:ok O:0}.
371 Each value is prefixed by a single character denoting the type,
372 B for Boolean, N for number, S for string, O for object, or Z for null,
373 followed by a colon. For Booleans the data must be either 0 or 1 for
374 FALSE or TRUE, respectively. Likewise for Objects the data must be 0 or
375 1 to end or begin an object, respectively. Data items in subobjects may
376 be named, by prefixing the type with 'N' and specifying the name before
377 the value (i.e. @code{NB:myFlag:1}). This option may be used multiple
378 times to construct arbitrary AMF sequences.
381 Version of the Flash plugin used to run the SWF player. The default
384 @item rtmp_flush_interval
385 Number of packets flushed in the same request (RTMPT only). The default
389 Specify that the media is a live stream. No resuming or seeking in
390 live streams is possible. The default value is @code{any}, which means the
391 subscriber first tries to play the live stream specified in the
392 playpath. If a live stream of that name is not found, it plays the
393 recorded stream. The other possible values are @code{live} and
397 URL of the web page in which the media was embedded. By default no
401 Stream identifier to play or to publish. This option overrides the
402 parameter specified in the URI.
405 Name of live stream to subscribe to. By default no value will be sent.
406 It is only sent if the option is specified or if rtmp_live
410 SHA256 hash of the decompressed SWF file (32 bytes).
413 Size of the decompressed SWF file, required for SWFVerification.
416 URL of the SWF player for the media. By default no value will be sent.
419 URL to player swf file, compute hash/size automatically.
422 URL of the target stream. Defaults to proto://host[:port]/app.
426 For example to read with @command{ffplay} a multimedia resource named
427 "sample" from the application "vod" from an RTMP server "myserver":
429 ffplay rtmp://myserver/vod/sample
434 Encrypted Real-Time Messaging Protocol.
436 The Encrypted Real-Time Messaging Protocol (RTMPE) is used for
437 streaming multimedia content within standard cryptographic primitives,
438 consisting of Diffie-Hellman key exchange and HMACSHA256, generating
443 Real-Time Messaging Protocol over a secure SSL connection.
445 The Real-Time Messaging Protocol (RTMPS) is used for streaming
446 multimedia content across an encrypted connection.
450 Real-Time Messaging Protocol tunneled through HTTP.
452 The Real-Time Messaging Protocol tunneled through HTTP (RTMPT) is used
453 for streaming multimedia content within HTTP requests to traverse
458 Encrypted Real-Time Messaging Protocol tunneled through HTTP.
460 The Encrypted Real-Time Messaging Protocol tunneled through HTTP (RTMPTE)
461 is used for streaming multimedia content within HTTP requests to traverse
466 Real-Time Messaging Protocol tunneled through HTTPS.
468 The Real-Time Messaging Protocol tunneled through HTTPS (RTMPTS) is used
469 for streaming multimedia content within HTTPS requests to traverse
472 @section rtmp, rtmpe, rtmps, rtmpt, rtmpte
474 Real-Time Messaging Protocol and its variants supported through
477 Requires the presence of the librtmp headers and library during
478 configuration. You need to explicitly configure the build with
479 "--enable-librtmp". If enabled this will replace the native RTMP
482 This protocol provides most client functions and a few server
483 functions needed to support RTMP, RTMP tunneled in HTTP (RTMPT),
484 encrypted RTMP (RTMPE), RTMP over SSL/TLS (RTMPS) and tunneled
485 variants of these encrypted types (RTMPTE, RTMPTS).
487 The required syntax is:
489 @var{rtmp_proto}://@var{server}[:@var{port}][/@var{app}][/@var{playpath}] @var{options}
492 where @var{rtmp_proto} is one of the strings "rtmp", "rtmpt", "rtmpe",
493 "rtmps", "rtmpte", "rtmpts" corresponding to each RTMP variant, and
494 @var{server}, @var{port}, @var{app} and @var{playpath} have the same
495 meaning as specified for the RTMP native protocol.
496 @var{options} contains a list of space-separated options of the form
499 See the librtmp manual page (man 3 librtmp) for more information.
501 For example, to stream a file in real-time to an RTMP server using
504 ffmpeg -re -i myfile -f flv rtmp://myserver/live/mystream
507 To play the same stream using @command{ffplay}:
509 ffplay "rtmp://myserver/live/mystream live=1"
518 RTSP is not technically a protocol handler in libavformat, it is a demuxer
519 and muxer. The demuxer supports both normal RTSP (with data transferred
520 over RTP; this is used by e.g. Apple and Microsoft) and Real-RTSP (with
521 data transferred over RDT).
523 The muxer can be used to send a stream using RTSP ANNOUNCE to a server
524 supporting it (currently Darwin Streaming Server and Mischa Spiegelmock's
525 @uref{http://github.com/revmischa/rtsp-server, RTSP server}).
527 The required syntax for a RTSP url is:
529 rtsp://@var{hostname}[:@var{port}]/@var{path}
532 The following options (set on the @command{ffmpeg}/@command{ffplay} command
533 line, or set in code via @code{AVOption}s or in @code{avformat_open_input}),
536 Flags for @code{rtsp_transport}:
541 Use UDP as lower transport protocol.
544 Use TCP (interleaving within the RTSP control channel) as lower
548 Use UDP multicast as lower transport protocol.
551 Use HTTP tunneling as lower transport protocol, which is useful for
555 Multiple lower transport protocols may be specified, in that case they are
556 tried one at a time (if the setup of one fails, the next one is tried).
557 For the muxer, only the @code{tcp} and @code{udp} options are supported.
559 Flags for @code{rtsp_flags}:
563 Accept packets only from negotiated peer address and port.
565 Act as a server, listening for an incoming connection.
568 When receiving data over UDP, the demuxer tries to reorder received packets
569 (since they may arrive out of order, or packets may get lost totally). This
570 can be disabled by setting the maximum demuxing delay to zero (via
571 the @code{max_delay} field of AVFormatContext).
573 When watching multi-bitrate Real-RTSP streams with @command{ffplay}, the
574 streams to display can be chosen with @code{-vst} @var{n} and
575 @code{-ast} @var{n} for video and audio respectively, and can be switched
576 on the fly by pressing @code{v} and @code{a}.
578 Example command lines:
580 To watch a stream over UDP, with a max reordering delay of 0.5 seconds:
583 ffplay -max_delay 500000 -rtsp_transport udp rtsp://server/video.mp4
586 To watch a stream tunneled over HTTP:
589 ffplay -rtsp_transport http rtsp://server/video.mp4
592 To send a stream in realtime to a RTSP server, for others to watch:
595 ffmpeg -re -i @var{input} -f rtsp -muxdelay 0.1 rtsp://server/live.sdp
598 To receive a stream in realtime:
601 ffmpeg -rtsp_flags listen -i rtsp://ownaddress/live.sdp @var{output}
606 Socket IO timeout in micro seconds.
611 Session Announcement Protocol (RFC 2974). This is not technically a
612 protocol handler in libavformat, it is a muxer and demuxer.
613 It is used for signalling of RTP streams, by announcing the SDP for the
614 streams regularly on a separate port.
618 The syntax for a SAP url given to the muxer is:
620 sap://@var{destination}[:@var{port}][?@var{options}]
623 The RTP packets are sent to @var{destination} on port @var{port},
624 or to port 5004 if no port is specified.
625 @var{options} is a @code{&}-separated list. The following options
630 @item announce_addr=@var{address}
631 Specify the destination IP address for sending the announcements to.
632 If omitted, the announcements are sent to the commonly used SAP
633 announcement multicast address 224.2.127.254 (sap.mcast.net), or
634 ff0e::2:7ffe if @var{destination} is an IPv6 address.
636 @item announce_port=@var{port}
637 Specify the port to send the announcements on, defaults to
638 9875 if not specified.
641 Specify the time to live value for the announcements and RTP packets,
644 @item same_port=@var{0|1}
645 If set to 1, send all RTP streams on the same port pair. If zero (the
646 default), all streams are sent on unique ports, with each stream on a
647 port 2 numbers higher than the previous.
648 VLC/Live555 requires this to be set to 1, to be able to receive the stream.
649 The RTP stack in libavformat for receiving requires all streams to be sent
653 Example command lines follow.
655 To broadcast a stream on the local subnet, for watching in VLC:
658 ffmpeg -re -i @var{input} -f sap sap://224.0.0.255?same_port=1
661 Similarly, for watching in @command{ffplay}:
664 ffmpeg -re -i @var{input} -f sap sap://224.0.0.255
667 And for watching in @command{ffplay}, over IPv6:
670 ffmpeg -re -i @var{input} -f sap sap://[ff0e::1:2:3:4]
675 The syntax for a SAP url given to the demuxer is:
677 sap://[@var{address}][:@var{port}]
680 @var{address} is the multicast address to listen for announcements on,
681 if omitted, the default 224.2.127.254 (sap.mcast.net) is used. @var{port}
682 is the port that is listened on, 9875 if omitted.
684 The demuxers listens for announcements on the given address and port.
685 Once an announcement is received, it tries to receive that particular stream.
687 Example command lines follow.
689 To play back the first stream announced on the normal SAP multicast address:
695 To play back the first stream announced on one the default IPv6 SAP multicast address:
698 ffplay sap://[ff0e::2:7ffe]
703 Stream Control Transmission Protocol.
705 The accepted URL syntax is:
707 sctp://@var{host}:@var{port}[?@var{options}]
710 The protocol accepts the following options:
713 If set to any value, listen for an incoming connection. Outgoing connection is done by default.
716 Set the maximum number of streams. By default no limit is set.
721 Secure Real-time Transport Protocol.
723 The accepted options are:
727 Select input and output encoding suites.
731 @item AES_CM_128_HMAC_SHA1_80
732 @item SRTP_AES128_CM_HMAC_SHA1_80
733 @item AES_CM_128_HMAC_SHA1_32
734 @item SRTP_AES128_CM_HMAC_SHA1_32
738 @item srtp_out_params
739 Set input and output encoding parameters, which are expressed by a
740 base64-encoded representation of a binary block. The first 16 bytes of
741 this binary block are used as master key, the following 14 bytes are
747 Trasmission Control Protocol.
749 The required syntax for a TCP url is:
751 tcp://@var{hostname}:@var{port}[?@var{options}]
757 Listen for an incoming connection
759 @item timeout=@var{microseconds}
760 In read mode: if no data arrived in more than this time interval, raise error.
761 In write mode: if socket cannot be written in more than this time interval, raise error.
762 This also sets timeout on TCP connection establishing.
765 ffmpeg -i @var{input} -f @var{format} tcp://@var{hostname}:@var{port}?listen
766 ffplay tcp://@var{hostname}:@var{port}
773 Transport Layer Security/Secure Sockets Layer
775 The required syntax for a TLS/SSL url is:
777 tls://@var{hostname}:@var{port}[?@var{options}]
783 Act as a server, listening for an incoming connection.
785 @item cafile=@var{filename}
786 Certificate authority file. The file must be in OpenSSL PEM format.
788 @item cert=@var{filename}
789 Certificate file. The file must be in OpenSSL PEM format.
791 @item key=@var{filename}
794 @item verify=@var{0|1}
795 Verify the peer's certificate.
799 Example command lines:
801 To create a TLS/SSL server that serves an input stream.
804 ffmpeg -i @var{input} -f @var{format} tls://@var{hostname}:@var{port}?listen&cert=@var{server.crt}&key=@var{server.key}
807 To play back a stream from the TLS/SSL server using @command{ffplay}:
810 ffplay tls://@var{hostname}:@var{port}
815 User Datagram Protocol.
817 The required syntax for a UDP url is:
819 udp://@var{hostname}:@var{port}[?@var{options}]
822 @var{options} contains a list of &-separated options of the form @var{key}=@var{val}.
824 In case threading is enabled on the system, a circular buffer is used
825 to store the incoming data, which allows to reduce loss of data due to
826 UDP socket buffer overruns. The @var{fifo_size} and
827 @var{overrun_nonfatal} options are related to this buffer.
829 The list of supported options follows.
833 @item buffer_size=@var{size}
834 Set the UDP socket buffer size in bytes. This is used both for the
835 receiving and the sending buffer size.
837 @item localport=@var{port}
838 Override the local UDP port to bind with.
840 @item localaddr=@var{addr}
841 Choose the local IP address. This is useful e.g. if sending multicast
842 and the host has multiple interfaces, where the user can choose
843 which interface to send on by specifying the IP address of that interface.
845 @item pkt_size=@var{size}
846 Set the size in bytes of UDP packets.
848 @item reuse=@var{1|0}
849 Explicitly allow or disallow reusing UDP sockets.
852 Set the time to live value (for multicast only).
854 @item connect=@var{1|0}
855 Initialize the UDP socket with @code{connect()}. In this case, the
856 destination address can't be changed with ff_udp_set_remote_url later.
857 If the destination address isn't known at the start, this option can
858 be specified in ff_udp_set_remote_url, too.
859 This allows finding out the source address for the packets with getsockname,
860 and makes writes return with AVERROR(ECONNREFUSED) if "destination
861 unreachable" is received.
862 For receiving, this gives the benefit of only receiving packets from
863 the specified peer address/port.
865 @item sources=@var{address}[,@var{address}]
866 Only receive packets sent to the multicast group from one of the
867 specified sender IP addresses.
869 @item block=@var{address}[,@var{address}]
870 Ignore packets sent to the multicast group from the specified
873 @item fifo_size=@var{units}
874 Set the UDP receiving circular buffer size, expressed as a number of
875 packets with size of 188 bytes. If not specified defaults to 7*4096.
877 @item overrun_nonfatal=@var{1|0}
878 Survive in case of UDP receiving circular buffer overrun. Default
881 @item timeout=@var{microseconds}
882 In read mode: if no data arrived in more than this time interval, raise error.
885 Some usage examples of the UDP protocol with @command{ffmpeg} follow.
887 To stream over UDP to a remote endpoint:
889 ffmpeg -i @var{input} -f @var{format} udp://@var{hostname}:@var{port}
892 To stream in mpegts format over UDP using 188 sized UDP packets, using a large input buffer:
894 ffmpeg -i @var{input} -f mpegts udp://@var{hostname}:@var{port}?pkt_size=188&buffer_size=65535
897 To receive over UDP from a remote endpoint:
899 ffmpeg -i udp://[@var{multicast-address}]:@var{port}