1 @chapter Protocol Options
2 @c man begin PROTOCOL OPTIONS
4 The libavformat library provides some generic global options, which
5 can be set on all the protocols. In addition each protocol may support
6 so-called private options, which are specific for that component.
8 The list of supported options follows:
11 @item protocol_whitelist @var{list} (@emph{input})
12 Set a ","-separated list of allowed protocols. "ALL" matches all protocols. Protocols
13 prefixed by "-" are disabled.
14 All protocols are allowed by default but protocols used by an another
15 protocol (nested protocols) are restricted to a per protocol subset.
18 @c man end PROTOCOL OPTIONS
21 @c man begin PROTOCOLS
23 Protocols are configured elements in FFmpeg that enable access to
24 resources that require specific protocols.
26 When you configure your FFmpeg build, all the supported protocols are
27 enabled by default. You can list all available ones using the
28 configure option "--list-protocols".
30 You can disable all the protocols using the configure option
31 "--disable-protocols", and selectively enable a protocol using the
32 option "--enable-protocol=@var{PROTOCOL}", or you can disable a
33 particular protocol using the option
34 "--disable-protocol=@var{PROTOCOL}".
36 The option "-protocols" of the ff* tools will display the list of
39 All protocols accept the following options:
43 Maximum time to wait for (network) read/write operations to complete,
47 A description of the currently available protocols follows.
51 Asynchronous data filling wrapper for input stream.
53 Fill data in a background thread, to decouple I/O operation from demux thread.
57 async:http://host/resource
58 async:cache:http://host/resource
65 The accepted options are:
75 Playlist to read (BDMV/PLAYLIST/?????.mpls)
81 Read longest playlist from BluRay mounted to /mnt/bluray:
86 Read angle 2 of playlist 4 from BluRay mounted to /mnt/bluray, start from chapter 2:
88 -playlist 4 -angle 2 -chapter 2 bluray:/mnt/bluray
93 Caching wrapper for input stream.
95 Cache the input stream to temporary file. It brings seeking capability to live streams.
103 Physical concatenation protocol.
105 Read and seek from many resources in sequence as if they were
108 A URL accepted by this protocol has the syntax:
110 concat:@var{URL1}|@var{URL2}|...|@var{URLN}
113 where @var{URL1}, @var{URL2}, ..., @var{URLN} are the urls of the
114 resource to be concatenated, each one possibly specifying a distinct
117 For example to read a sequence of files @file{split1.mpeg},
118 @file{split2.mpeg}, @file{split3.mpeg} with @command{ffplay} use the
121 ffplay concat:split1.mpeg\|split2.mpeg\|split3.mpeg
124 Note that you may need to escape the character "|" which is special for
129 AES-encrypted stream reading protocol.
131 The accepted options are:
134 Set the AES decryption key binary block from given hexadecimal representation.
137 Set the AES decryption initialization vector binary block from given hexadecimal representation.
140 Accepted URL formats:
148 Data in-line in the URI. See @url{http://en.wikipedia.org/wiki/Data_URI_scheme}.
150 For example, to convert a GIF file given inline with @command{ffmpeg}:
152 ffmpeg -i "data:image/gif;base64,R0lGODdhCAAIAMIEAAAAAAAA//8AAP//AP///////////////ywAAAAACAAIAAADF0gEDLojDgdGiJdJqUX02iB4E8Q9jUMkADs=" smiley.png
157 File access protocol.
159 Read from or write to a file.
161 A file URL can have the form:
166 where @var{filename} is the path of the file to read.
168 An URL that does not have a protocol prefix will be assumed to be a
169 file URL. Depending on the build, an URL that looks like a Windows
170 path with the drive letter at the beginning will also be assumed to be
171 a file URL (usually not the case in builds for unix-like systems).
173 For example to read from a file @file{input.mpeg} with @command{ffmpeg}
176 ffmpeg -i file:input.mpeg output.mpeg
179 This protocol accepts the following options:
183 Truncate existing files on write, if set to 1. A value of 0 prevents
184 truncating. Default value is 1.
187 Set I/O operation maximum block size, in bytes. Default value is
188 @code{INT_MAX}, which results in not limiting the requested block size.
189 Setting this value reasonably low improves user termination request reaction
190 time, which is valuable for files on slow medium.
195 FTP (File Transfer Protocol).
197 Read from or write to remote resources using FTP protocol.
199 Following syntax is required.
201 ftp://[user[:password]@@]server[:port]/path/to/remote/resource.mpeg
204 This protocol accepts the following options.
208 Set timeout in microseconds of socket I/O operations used by the underlying low level
209 operation. By default it is set to -1, which means that the timeout is
212 @item ftp-anonymous-password
213 Password used when login as anonymous user. Typically an e-mail address
216 @item ftp-write-seekable
217 Control seekability of connection during encoding. If set to 1 the
218 resource is supposed to be seekable, if set to 0 it is assumed not
219 to be seekable. Default value is 0.
222 NOTE: Protocol can be used as output, but it is recommended to not do
223 it, unless special care is taken (tests, customized server configuration
224 etc.). Different FTP servers behave in different way during seek
225 operation. ff* tools may produce incomplete content due to server limitations.
227 This protocol accepts the following options:
231 If set to 1, the protocol will retry reading at the end of the file, allowing
232 reading files that still are being written. In order for this to terminate,
233 you either need to use the rw_timeout option, or use the interrupt callback
244 Read Apple HTTP Live Streaming compliant segmented stream as
245 a uniform one. The M3U8 playlists describing the segments can be
246 remote HTTP resources or local files, accessed using the standard
248 The nested protocol is declared by specifying
249 "+@var{proto}" after the hls URI scheme name, where @var{proto}
250 is either "file" or "http".
253 hls+http://host/path/to/remote/resource.m3u8
254 hls+file://path/to/local/resource.m3u8
257 Using this protocol is discouraged - the hls demuxer should work
258 just as well (if not, please report the issues) and is more complete.
259 To use the hls demuxer instead, simply use the direct URLs to the
264 HTTP (Hyper Text Transfer Protocol).
266 This protocol accepts the following options:
270 Control seekability of connection. If set to 1 the resource is
271 supposed to be seekable, if set to 0 it is assumed not to be seekable,
272 if set to -1 it will try to autodetect if it is seekable. Default
276 If set to 1 use chunked Transfer-Encoding for posts, default is 1.
279 Set a specific content type for the POST messages or for listen mode.
282 set HTTP proxy to tunnel through e.g. http://example.com:1234
285 Set custom HTTP headers, can override built in default headers. The
286 value must be a string encoding the headers.
288 @item multiple_requests
289 Use persistent connections if set to 1, default is 0.
292 Set custom HTTP post data.
295 Override the User-Agent header. If not specified the protocol will use a
296 string describing the libavformat build. ("Lavf/<version>")
299 This is a deprecated option, you can use user_agent instead it.
302 Set timeout in microseconds of socket I/O operations used by the underlying low level
303 operation. By default it is set to -1, which means that the timeout is
306 @item reconnect_at_eof
307 If set then eof is treated like an error and causes reconnection, this is useful
308 for live / endless streams.
310 @item reconnect_streamed
311 If set then even streamed/non seekable streams will be reconnected on errors.
313 @item reconnect_delay_max
314 Sets the maximum delay in seconds after which to give up reconnecting
317 Export the MIME type.
320 If set to 1 request ICY (SHOUTcast) metadata from the server. If the server
321 supports this, the metadata has to be retrieved by the application by reading
322 the @option{icy_metadata_headers} and @option{icy_metadata_packet} options.
325 @item icy_metadata_headers
326 If the server supports ICY metadata, this contains the ICY-specific HTTP reply
327 headers, separated by newline characters.
329 @item icy_metadata_packet
330 If the server supports ICY metadata, and @option{icy} was set to 1, this
331 contains the last non-empty metadata packet sent by the server. It should be
332 polled in regular intervals by applications interested in mid-stream metadata
336 Set the cookies to be sent in future requests. The format of each cookie is the
337 same as the value of a Set-Cookie HTTP response field. Multiple cookies can be
338 delimited by a newline character.
341 Set initial byte offset.
344 Try to limit the request to bytes preceding this offset.
347 When used as a client option it sets the HTTP method for the request.
349 When used as a server option it sets the HTTP method that is going to be
350 expected from the client(s).
351 If the expected and the received HTTP method do not match the client will
352 be given a Bad Request response.
353 When unset the HTTP method is not checked for now. This will be replaced by
354 autodetection in the future.
357 If set to 1 enables experimental HTTP server. This can be used to send data when
358 used as an output option, or read data from a client with HTTP POST when used as
360 If set to 2 enables experimental multi-client HTTP server. This is not yet implemented
361 in ffmpeg.c or ffserver.c and thus must not be used as a command line option.
363 # Server side (sending):
364 ffmpeg -i somefile.ogg -c copy -listen 1 -f ogg http://@var{server}:@var{port}
366 # Client side (receiving):
367 ffmpeg -i http://@var{server}:@var{port} -c copy somefile.ogg
369 # Client can also be done with wget:
370 wget http://@var{server}:@var{port} -O somefile.ogg
372 # Server side (receiving):
373 ffmpeg -listen 1 -i http://@var{server}:@var{port} -c copy somefile.ogg
375 # Client side (sending):
376 ffmpeg -i somefile.ogg -chunked_post 0 -c copy -f ogg http://@var{server}:@var{port}
378 # Client can also be done with wget:
379 wget --post-file=somefile.ogg http://@var{server}:@var{port}
384 @subsection HTTP Cookies
386 Some HTTP requests will be denied unless cookie values are passed in with the
387 request. The @option{cookies} option allows these cookies to be specified. At
388 the very least, each cookie must specify a value along with a path and domain.
389 HTTP requests that match both the domain and path will automatically include the
390 cookie value in the HTTP Cookie header field. Multiple cookies can be delimited
393 The required syntax to play a stream specifying a cookie is:
395 ffplay -cookies "nlqptid=nltid=tsn; path=/; domain=somedomain.com;" http://somedomain.com/somestream.m3u8
400 Icecast protocol (stream to Icecast servers)
402 This protocol accepts the following options:
406 Set the stream genre.
411 @item ice_description
412 Set the stream description.
415 Set the stream website URL.
418 Set if the stream should be public.
419 The default is 0 (not public).
422 Override the User-Agent header. If not specified a string of the form
423 "Lavf/<version>" will be used.
426 Set the Icecast mountpoint password.
429 Set the stream content type. This must be set if it is different from
433 This enables support for Icecast versions < 2.4.0, that do not support the
434 HTTP PUT method but the SOURCE method.
439 icecast://[@var{username}[:@var{password}]@@]@var{server}:@var{port}/@var{mountpoint}
444 MMS (Microsoft Media Server) protocol over TCP.
448 MMS (Microsoft Media Server) protocol over HTTP.
450 The required syntax is:
452 mmsh://@var{server}[:@var{port}][/@var{app}][/@var{playpath}]
459 Computes the MD5 hash of the data to be written, and on close writes
460 this to the designated output or stdout if none is specified. It can
461 be used to test muxers without writing an actual file.
463 Some examples follow.
465 # Write the MD5 hash of the encoded AVI file to the file output.avi.md5.
466 ffmpeg -i input.flv -f avi -y md5:output.avi.md5
468 # Write the MD5 hash of the encoded AVI file to stdout.
469 ffmpeg -i input.flv -f avi -y md5:
472 Note that some formats (typically MOV) require the output protocol to
473 be seekable, so they will fail with the MD5 output protocol.
477 UNIX pipe access protocol.
479 Read and write from UNIX pipes.
481 The accepted syntax is:
486 @var{number} is the number corresponding to the file descriptor of the
487 pipe (e.g. 0 for stdin, 1 for stdout, 2 for stderr). If @var{number}
488 is not specified, by default the stdout file descriptor will be used
489 for writing, stdin for reading.
491 For example to read from stdin with @command{ffmpeg}:
493 cat test.wav | ffmpeg -i pipe:0
494 # ...this is the same as...
495 cat test.wav | ffmpeg -i pipe:
498 For writing to stdout with @command{ffmpeg}:
500 ffmpeg -i test.wav -f avi pipe:1 | cat > test.avi
501 # ...this is the same as...
502 ffmpeg -i test.wav -f avi pipe: | cat > test.avi
505 This protocol accepts the following options:
509 Set I/O operation maximum block size, in bytes. Default value is
510 @code{INT_MAX}, which results in not limiting the requested block size.
511 Setting this value reasonably low improves user termination request reaction
512 time, which is valuable if data transmission is slow.
515 Note that some formats (typically MOV), require the output protocol to
516 be seekable, so they will fail with the pipe output protocol.
520 Pro-MPEG Code of Practice #3 Release 2 FEC protocol.
522 The Pro-MPEG CoP#3 FEC is a 2D parity-check forward error correction mechanism
523 for MPEG-2 Transport Streams sent over RTP.
525 This protocol must be used in conjunction with the @code{rtp_mpegts} muxer and
526 the @code{rtp} protocol.
528 The required syntax is:
530 -f rtp_mpegts -fec prompeg=@var{option}=@var{val}... rtp://@var{hostname}:@var{port}
533 The destination UDP ports are @code{port + 2} for the column FEC stream
534 and @code{port + 4} for the row FEC stream.
536 This protocol accepts the following options:
540 The number of columns (4-20, LxD <= 100)
543 The number of rows (4-20, LxD <= 100)
550 -f rtp_mpegts -fec prompeg=l=8:d=4 rtp://@var{hostname}:@var{port}
555 Real-Time Messaging Protocol.
557 The Real-Time Messaging Protocol (RTMP) is used for streaming multimedia
558 content across a TCP/IP network.
560 The required syntax is:
562 rtmp://[@var{username}:@var{password}@@]@var{server}[:@var{port}][/@var{app}][/@var{instance}][/@var{playpath}]
565 The accepted parameters are:
569 An optional username (mostly for publishing).
572 An optional password (mostly for publishing).
575 The address of the RTMP server.
578 The number of the TCP port to use (by default is 1935).
581 It is the name of the application to access. It usually corresponds to
582 the path where the application is installed on the RTMP server
583 (e.g. @file{/ondemand/}, @file{/flash/live/}, etc.). You can override
584 the value parsed from the URI through the @code{rtmp_app} option, too.
587 It is the path or name of the resource to play with reference to the
588 application specified in @var{app}, may be prefixed by "mp4:". You
589 can override the value parsed from the URI through the @code{rtmp_playpath}
593 Act as a server, listening for an incoming connection.
596 Maximum time to wait for the incoming connection. Implies listen.
599 Additionally, the following parameters can be set via command line options
600 (or in code via @code{AVOption}s):
604 Name of application to connect on the RTMP server. This option
605 overrides the parameter specified in the URI.
608 Set the client buffer time in milliseconds. The default is 3000.
611 Extra arbitrary AMF connection parameters, parsed from a string,
612 e.g. like @code{B:1 S:authMe O:1 NN:code:1.23 NS:flag:ok O:0}.
613 Each value is prefixed by a single character denoting the type,
614 B for Boolean, N for number, S for string, O for object, or Z for null,
615 followed by a colon. For Booleans the data must be either 0 or 1 for
616 FALSE or TRUE, respectively. Likewise for Objects the data must be 0 or
617 1 to end or begin an object, respectively. Data items in subobjects may
618 be named, by prefixing the type with 'N' and specifying the name before
619 the value (i.e. @code{NB:myFlag:1}). This option may be used multiple
620 times to construct arbitrary AMF sequences.
623 Version of the Flash plugin used to run the SWF player. The default
624 is LNX 9,0,124,2. (When publishing, the default is FMLE/3.0 (compatible;
625 <libavformat version>).)
627 @item rtmp_flush_interval
628 Number of packets flushed in the same request (RTMPT only). The default
632 Specify that the media is a live stream. No resuming or seeking in
633 live streams is possible. The default value is @code{any}, which means the
634 subscriber first tries to play the live stream specified in the
635 playpath. If a live stream of that name is not found, it plays the
636 recorded stream. The other possible values are @code{live} and
640 URL of the web page in which the media was embedded. By default no
644 Stream identifier to play or to publish. This option overrides the
645 parameter specified in the URI.
648 Name of live stream to subscribe to. By default no value will be sent.
649 It is only sent if the option is specified or if rtmp_live
653 SHA256 hash of the decompressed SWF file (32 bytes).
656 Size of the decompressed SWF file, required for SWFVerification.
659 URL of the SWF player for the media. By default no value will be sent.
662 URL to player swf file, compute hash/size automatically.
665 URL of the target stream. Defaults to proto://host[:port]/app.
669 For example to read with @command{ffplay} a multimedia resource named
670 "sample" from the application "vod" from an RTMP server "myserver":
672 ffplay rtmp://myserver/vod/sample
675 To publish to a password protected server, passing the playpath and
676 app names separately:
678 ffmpeg -re -i <input> -f flv -rtmp_playpath some/long/path -rtmp_app long/app/name rtmp://username:password@@myserver/
683 Encrypted Real-Time Messaging Protocol.
685 The Encrypted Real-Time Messaging Protocol (RTMPE) is used for
686 streaming multimedia content within standard cryptographic primitives,
687 consisting of Diffie-Hellman key exchange and HMACSHA256, generating
692 Real-Time Messaging Protocol over a secure SSL connection.
694 The Real-Time Messaging Protocol (RTMPS) is used for streaming
695 multimedia content across an encrypted connection.
699 Real-Time Messaging Protocol tunneled through HTTP.
701 The Real-Time Messaging Protocol tunneled through HTTP (RTMPT) is used
702 for streaming multimedia content within HTTP requests to traverse
707 Encrypted Real-Time Messaging Protocol tunneled through HTTP.
709 The Encrypted Real-Time Messaging Protocol tunneled through HTTP (RTMPTE)
710 is used for streaming multimedia content within HTTP requests to traverse
715 Real-Time Messaging Protocol tunneled through HTTPS.
717 The Real-Time Messaging Protocol tunneled through HTTPS (RTMPTS) is used
718 for streaming multimedia content within HTTPS requests to traverse
721 @section libsmbclient
723 libsmbclient permits one to manipulate CIFS/SMB network resources.
725 Following syntax is required.
728 smb://[[domain:]user[:password@@]]server[/share[/path[/file]]]
731 This protocol accepts the following options.
735 Set timeout in milliseconds of socket I/O operations used by the underlying
736 low level operation. By default it is set to -1, which means that the timeout
740 Truncate existing files on write, if set to 1. A value of 0 prevents
741 truncating. Default value is 1.
744 Set the workgroup used for making connections. By default workgroup is not specified.
748 For more information see: @url{http://www.samba.org/}.
752 Secure File Transfer Protocol via libssh
754 Read from or write to remote resources using SFTP protocol.
756 Following syntax is required.
759 sftp://[user[:password]@@]server[:port]/path/to/remote/resource.mpeg
762 This protocol accepts the following options.
766 Set timeout of socket I/O operations used by the underlying low level
767 operation. By default it is set to -1, which means that the timeout
771 Truncate existing files on write, if set to 1. A value of 0 prevents
772 truncating. Default value is 1.
775 Specify the path of the file containing private key to use during authorization.
776 By default libssh searches for keys in the @file{~/.ssh/} directory.
780 Example: Play a file stored on remote server.
783 ffplay sftp://user:password@@server_address:22/home/user/resource.mpeg
786 @section librtmp rtmp, rtmpe, rtmps, rtmpt, rtmpte
788 Real-Time Messaging Protocol and its variants supported through
791 Requires the presence of the librtmp headers and library during
792 configuration. You need to explicitly configure the build with
793 "--enable-librtmp". If enabled this will replace the native RTMP
796 This protocol provides most client functions and a few server
797 functions needed to support RTMP, RTMP tunneled in HTTP (RTMPT),
798 encrypted RTMP (RTMPE), RTMP over SSL/TLS (RTMPS) and tunneled
799 variants of these encrypted types (RTMPTE, RTMPTS).
801 The required syntax is:
803 @var{rtmp_proto}://@var{server}[:@var{port}][/@var{app}][/@var{playpath}] @var{options}
806 where @var{rtmp_proto} is one of the strings "rtmp", "rtmpt", "rtmpe",
807 "rtmps", "rtmpte", "rtmpts" corresponding to each RTMP variant, and
808 @var{server}, @var{port}, @var{app} and @var{playpath} have the same
809 meaning as specified for the RTMP native protocol.
810 @var{options} contains a list of space-separated options of the form
813 See the librtmp manual page (man 3 librtmp) for more information.
815 For example, to stream a file in real-time to an RTMP server using
818 ffmpeg -re -i myfile -f flv rtmp://myserver/live/mystream
821 To play the same stream using @command{ffplay}:
823 ffplay "rtmp://myserver/live/mystream live=1"
828 Real-time Transport Protocol.
830 The required syntax for an RTP URL is:
831 rtp://@var{hostname}[:@var{port}][?@var{option}=@var{val}...]
833 @var{port} specifies the RTP port to use.
835 The following URL options are supported:
840 Set the TTL (Time-To-Live) value (for multicast only).
842 @item rtcpport=@var{n}
843 Set the remote RTCP port to @var{n}.
845 @item localrtpport=@var{n}
846 Set the local RTP port to @var{n}.
848 @item localrtcpport=@var{n}'
849 Set the local RTCP port to @var{n}.
851 @item pkt_size=@var{n}
852 Set max packet size (in bytes) to @var{n}.
855 Do a @code{connect()} on the UDP socket (if set to 1) or not (if set
858 @item sources=@var{ip}[,@var{ip}]
859 List allowed source IP addresses.
861 @item block=@var{ip}[,@var{ip}]
862 List disallowed (blocked) source IP addresses.
864 @item write_to_source=0|1
865 Send packets to the source address of the latest received packet (if
866 set to 1) or to a default remote address (if set to 0).
868 @item localport=@var{n}
869 Set the local RTP port to @var{n}.
871 This is a deprecated option. Instead, @option{localrtpport} should be
881 If @option{rtcpport} is not set the RTCP port will be set to the RTP
885 If @option{localrtpport} (the local RTP port) is not set any available
886 port will be used for the local RTP and RTCP ports.
889 If @option{localrtcpport} (the local RTCP port) is not set it will be
890 set to the local RTP port value plus 1.
895 Real-Time Streaming Protocol.
897 RTSP is not technically a protocol handler in libavformat, it is a demuxer
898 and muxer. The demuxer supports both normal RTSP (with data transferred
899 over RTP; this is used by e.g. Apple and Microsoft) and Real-RTSP (with
900 data transferred over RDT).
902 The muxer can be used to send a stream using RTSP ANNOUNCE to a server
903 supporting it (currently Darwin Streaming Server and Mischa Spiegelmock's
904 @uref{https://github.com/revmischa/rtsp-server, RTSP server}).
906 The required syntax for a RTSP url is:
908 rtsp://@var{hostname}[:@var{port}]/@var{path}
911 Options can be set on the @command{ffmpeg}/@command{ffplay} command
912 line, or set in code via @code{AVOption}s or in
913 @code{avformat_open_input}.
915 The following options are supported.
919 Do not start playing the stream immediately if set to 1. Default value
923 Set RTSP transport protocols.
925 It accepts the following values:
928 Use UDP as lower transport protocol.
931 Use TCP (interleaving within the RTSP control channel) as lower
935 Use UDP multicast as lower transport protocol.
938 Use HTTP tunneling as lower transport protocol, which is useful for
942 Multiple lower transport protocols may be specified, in that case they are
943 tried one at a time (if the setup of one fails, the next one is tried).
944 For the muxer, only the @samp{tcp} and @samp{udp} options are supported.
949 The following values are accepted:
952 Accept packets only from negotiated peer address and port.
954 Act as a server, listening for an incoming connection.
956 Try TCP for RTP transport first, if TCP is available as RTSP RTP transport.
959 Default value is @samp{none}.
961 @item allowed_media_types
962 Set media types to accept from the server.
964 The following flags are accepted:
971 By default it accepts all media types.
974 Set minimum local UDP port. Default value is 5000.
977 Set maximum local UDP port. Default value is 65000.
980 Set maximum timeout (in seconds) to wait for incoming connections.
982 A value of -1 means infinite (default). This option implies the
983 @option{rtsp_flags} set to @samp{listen}.
985 @item reorder_queue_size
986 Set number of packets to buffer for handling of reordered packets.
989 Set socket TCP I/O timeout in microseconds.
992 Override User-Agent header. If not specified, it defaults to the
993 libavformat identifier string.
996 When receiving data over UDP, the demuxer tries to reorder received packets
997 (since they may arrive out of order, or packets may get lost totally). This
998 can be disabled by setting the maximum demuxing delay to zero (via
999 the @code{max_delay} field of AVFormatContext).
1001 When watching multi-bitrate Real-RTSP streams with @command{ffplay}, the
1002 streams to display can be chosen with @code{-vst} @var{n} and
1003 @code{-ast} @var{n} for video and audio respectively, and can be switched
1004 on the fly by pressing @code{v} and @code{a}.
1006 @subsection Examples
1008 The following examples all make use of the @command{ffplay} and
1009 @command{ffmpeg} tools.
1013 Watch a stream over UDP, with a max reordering delay of 0.5 seconds:
1015 ffplay -max_delay 500000 -rtsp_transport udp rtsp://server/video.mp4
1019 Watch a stream tunneled over HTTP:
1021 ffplay -rtsp_transport http rtsp://server/video.mp4
1025 Send a stream in realtime to a RTSP server, for others to watch:
1027 ffmpeg -re -i @var{input} -f rtsp -muxdelay 0.1 rtsp://server/live.sdp
1031 Receive a stream in realtime:
1033 ffmpeg -rtsp_flags listen -i rtsp://ownaddress/live.sdp @var{output}
1039 Session Announcement Protocol (RFC 2974). This is not technically a
1040 protocol handler in libavformat, it is a muxer and demuxer.
1041 It is used for signalling of RTP streams, by announcing the SDP for the
1042 streams regularly on a separate port.
1046 The syntax for a SAP url given to the muxer is:
1048 sap://@var{destination}[:@var{port}][?@var{options}]
1051 The RTP packets are sent to @var{destination} on port @var{port},
1052 or to port 5004 if no port is specified.
1053 @var{options} is a @code{&}-separated list. The following options
1058 @item announce_addr=@var{address}
1059 Specify the destination IP address for sending the announcements to.
1060 If omitted, the announcements are sent to the commonly used SAP
1061 announcement multicast address 224.2.127.254 (sap.mcast.net), or
1062 ff0e::2:7ffe if @var{destination} is an IPv6 address.
1064 @item announce_port=@var{port}
1065 Specify the port to send the announcements on, defaults to
1066 9875 if not specified.
1069 Specify the time to live value for the announcements and RTP packets,
1072 @item same_port=@var{0|1}
1073 If set to 1, send all RTP streams on the same port pair. If zero (the
1074 default), all streams are sent on unique ports, with each stream on a
1075 port 2 numbers higher than the previous.
1076 VLC/Live555 requires this to be set to 1, to be able to receive the stream.
1077 The RTP stack in libavformat for receiving requires all streams to be sent
1081 Example command lines follow.
1083 To broadcast a stream on the local subnet, for watching in VLC:
1086 ffmpeg -re -i @var{input} -f sap sap://224.0.0.255?same_port=1
1089 Similarly, for watching in @command{ffplay}:
1092 ffmpeg -re -i @var{input} -f sap sap://224.0.0.255
1095 And for watching in @command{ffplay}, over IPv6:
1098 ffmpeg -re -i @var{input} -f sap sap://[ff0e::1:2:3:4]
1103 The syntax for a SAP url given to the demuxer is:
1105 sap://[@var{address}][:@var{port}]
1108 @var{address} is the multicast address to listen for announcements on,
1109 if omitted, the default 224.2.127.254 (sap.mcast.net) is used. @var{port}
1110 is the port that is listened on, 9875 if omitted.
1112 The demuxers listens for announcements on the given address and port.
1113 Once an announcement is received, it tries to receive that particular stream.
1115 Example command lines follow.
1117 To play back the first stream announced on the normal SAP multicast address:
1123 To play back the first stream announced on one the default IPv6 SAP multicast address:
1126 ffplay sap://[ff0e::2:7ffe]
1131 Stream Control Transmission Protocol.
1133 The accepted URL syntax is:
1135 sctp://@var{host}:@var{port}[?@var{options}]
1138 The protocol accepts the following options:
1141 If set to any value, listen for an incoming connection. Outgoing connection is done by default.
1144 Set the maximum number of streams. By default no limit is set.
1149 Secure Real-time Transport Protocol.
1151 The accepted options are:
1154 @item srtp_out_suite
1155 Select input and output encoding suites.
1159 @item AES_CM_128_HMAC_SHA1_80
1160 @item SRTP_AES128_CM_HMAC_SHA1_80
1161 @item AES_CM_128_HMAC_SHA1_32
1162 @item SRTP_AES128_CM_HMAC_SHA1_32
1165 @item srtp_in_params
1166 @item srtp_out_params
1167 Set input and output encoding parameters, which are expressed by a
1168 base64-encoded representation of a binary block. The first 16 bytes of
1169 this binary block are used as master key, the following 14 bytes are
1170 used as master salt.
1175 Virtually extract a segment of a file or another stream.
1176 The underlying stream must be seekable.
1181 Start offset of the extracted segment, in bytes.
1183 End offset of the extracted segment, in bytes.
1188 Extract a chapter from a DVD VOB file (start and end sectors obtained
1189 externally and multiplied by 2048):
1191 subfile,,start,153391104,end,268142592,,:/media/dvd/VIDEO_TS/VTS_08_1.VOB
1194 Play an AVI file directly from a TAR archive:
1196 subfile,,start,183241728,end,366490624,,:archive.tar
1201 Writes the output to multiple protocols. The individual outputs are separated
1205 tee:file://path/to/local/this.avi|file://path/to/local/that.avi
1210 Transmission Control Protocol.
1212 The required syntax for a TCP url is:
1214 tcp://@var{hostname}:@var{port}[?@var{options}]
1217 @var{options} contains a list of &-separated options of the form
1218 @var{key}=@var{val}.
1220 The list of supported options follows.
1223 @item listen=@var{1|0}
1224 Listen for an incoming connection. Default value is 0.
1226 @item timeout=@var{microseconds}
1227 Set raise error timeout, expressed in microseconds.
1229 This option is only relevant in read mode: if no data arrived in more
1230 than this time interval, raise error.
1232 @item listen_timeout=@var{milliseconds}
1233 Set listen timeout, expressed in milliseconds.
1235 @item recv_buffer_size=@var{bytes}
1236 Set receive buffer size, expressed bytes.
1238 @item send_buffer_size=@var{bytes}
1239 Set send buffer size, expressed bytes.
1242 The following example shows how to setup a listening TCP connection
1243 with @command{ffmpeg}, which is then accessed with @command{ffplay}:
1245 ffmpeg -i @var{input} -f @var{format} tcp://@var{hostname}:@var{port}?listen
1246 ffplay tcp://@var{hostname}:@var{port}
1251 Transport Layer Security (TLS) / Secure Sockets Layer (SSL)
1253 The required syntax for a TLS/SSL url is:
1255 tls://@var{hostname}:@var{port}[?@var{options}]
1258 The following parameters can be set via command line options
1259 (or in code via @code{AVOption}s):
1263 @item ca_file, cafile=@var{filename}
1264 A file containing certificate authority (CA) root certificates to treat
1265 as trusted. If the linked TLS library contains a default this might not
1266 need to be specified for verification to work, but not all libraries and
1267 setups have defaults built in.
1268 The file must be in OpenSSL PEM format.
1270 @item tls_verify=@var{1|0}
1271 If enabled, try to verify the peer that we are communicating with.
1272 Note, if using OpenSSL, this currently only makes sure that the
1273 peer certificate is signed by one of the root certificates in the CA
1274 database, but it does not validate that the certificate actually
1275 matches the host name we are trying to connect to. (With GnuTLS,
1276 the host name is validated as well.)
1278 This is disabled by default since it requires a CA database to be
1279 provided by the caller in many cases.
1281 @item cert_file, cert=@var{filename}
1282 A file containing a certificate to use in the handshake with the peer.
1283 (When operating as server, in listen mode, this is more often required
1284 by the peer, while client certificates only are mandated in certain
1287 @item key_file, key=@var{filename}
1288 A file containing the private key for the certificate.
1290 @item listen=@var{1|0}
1291 If enabled, listen for connections on the provided port, and assume
1292 the server role in the handshake instead of the client role.
1296 Example command lines:
1298 To create a TLS/SSL server that serves an input stream.
1301 ffmpeg -i @var{input} -f @var{format} tls://@var{hostname}:@var{port}?listen&cert=@var{server.crt}&key=@var{server.key}
1304 To play back a stream from the TLS/SSL server using @command{ffplay}:
1307 ffplay tls://@var{hostname}:@var{port}
1312 User Datagram Protocol.
1314 The required syntax for an UDP URL is:
1316 udp://@var{hostname}:@var{port}[?@var{options}]
1319 @var{options} contains a list of &-separated options of the form @var{key}=@var{val}.
1321 In case threading is enabled on the system, a circular buffer is used
1322 to store the incoming data, which allows one to reduce loss of data due to
1323 UDP socket buffer overruns. The @var{fifo_size} and
1324 @var{overrun_nonfatal} options are related to this buffer.
1326 The list of supported options follows.
1329 @item buffer_size=@var{size}
1330 Set the UDP maximum socket buffer size in bytes. This is used to set either
1331 the receive or send buffer size, depending on what the socket is used for.
1332 Default is 64KB. See also @var{fifo_size}.
1334 @item bitrate=@var{bitrate}
1335 If set to nonzero, the output will have the specified constant bitrate if the
1336 input has enough packets to sustain it.
1338 @item burst_bits=@var{bits}
1339 When using @var{bitrate} this specifies the maximum number of bits in
1342 @item localport=@var{port}
1343 Override the local UDP port to bind with.
1345 @item localaddr=@var{addr}
1346 Choose the local IP address. This is useful e.g. if sending multicast
1347 and the host has multiple interfaces, where the user can choose
1348 which interface to send on by specifying the IP address of that interface.
1350 @item pkt_size=@var{size}
1351 Set the size in bytes of UDP packets.
1353 @item reuse=@var{1|0}
1354 Explicitly allow or disallow reusing UDP sockets.
1357 Set the time to live value (for multicast only).
1359 @item connect=@var{1|0}
1360 Initialize the UDP socket with @code{connect()}. In this case, the
1361 destination address can't be changed with ff_udp_set_remote_url later.
1362 If the destination address isn't known at the start, this option can
1363 be specified in ff_udp_set_remote_url, too.
1364 This allows finding out the source address for the packets with getsockname,
1365 and makes writes return with AVERROR(ECONNREFUSED) if "destination
1366 unreachable" is received.
1367 For receiving, this gives the benefit of only receiving packets from
1368 the specified peer address/port.
1370 @item sources=@var{address}[,@var{address}]
1371 Only receive packets sent to the multicast group from one of the
1372 specified sender IP addresses.
1374 @item block=@var{address}[,@var{address}]
1375 Ignore packets sent to the multicast group from the specified
1376 sender IP addresses.
1378 @item fifo_size=@var{units}
1379 Set the UDP receiving circular buffer size, expressed as a number of
1380 packets with size of 188 bytes. If not specified defaults to 7*4096.
1382 @item overrun_nonfatal=@var{1|0}
1383 Survive in case of UDP receiving circular buffer overrun. Default
1386 @item timeout=@var{microseconds}
1387 Set raise error timeout, expressed in microseconds.
1389 This option is only relevant in read mode: if no data arrived in more
1390 than this time interval, raise error.
1392 @item broadcast=@var{1|0}
1393 Explicitly allow or disallow UDP broadcasting.
1395 Note that broadcasting may not work properly on networks having
1396 a broadcast storm protection.
1399 @subsection Examples
1403 Use @command{ffmpeg} to stream over UDP to a remote endpoint:
1405 ffmpeg -i @var{input} -f @var{format} udp://@var{hostname}:@var{port}
1409 Use @command{ffmpeg} to stream in mpegts format over UDP using 188
1410 sized UDP packets, using a large input buffer:
1412 ffmpeg -i @var{input} -f mpegts udp://@var{hostname}:@var{port}?pkt_size=188&buffer_size=65535
1416 Use @command{ffmpeg} to receive over UDP from a remote endpoint:
1418 ffmpeg -i udp://[@var{multicast-address}]:@var{port} ...
1426 The required syntax for a Unix socket URL is:
1429 unix://@var{filepath}
1432 The following parameters can be set via command line options
1433 (or in code via @code{AVOption}s):
1439 Create the Unix socket in listening mode.
1442 @c man end PROTOCOLS