1@chapter Protocol Options 2@c man begin PROTOCOL OPTIONS 3 4The libavformat library provides some generic global options, which 5can be set on all the protocols. In addition each protocol may support 6so-called private options, which are specific for that component. 7 8Options may be set by specifying -@var{option} @var{value} in the 9FFmpeg tools, or by setting the value explicitly in the 10@code{AVFormatContext} options or using the @file{libavutil/opt.h} API 11for programmatic use. 12 13The list of supported options follows: 14 15@table @option 16@item protocol_whitelist @var{list} (@emph{input}) 17Set a ","-separated list of allowed protocols. "ALL" matches all protocols. Protocols 18prefixed by "-" are disabled. 19All protocols are allowed by default but protocols used by an another 20protocol (nested protocols) are restricted to a per protocol subset. 21@end table 22 23@c man end PROTOCOL OPTIONS 24 25@chapter Protocols 26@c man begin PROTOCOLS 27 28Protocols are configured elements in FFmpeg that enable access to 29resources that require specific protocols. 30 31When you configure your FFmpeg build, all the supported protocols are 32enabled by default. You can list all available ones using the 33configure option "--list-protocols". 34 35You can disable all the protocols using the configure option 36"--disable-protocols", and selectively enable a protocol using the 37option "--enable-protocol=@var{PROTOCOL}", or you can disable a 38particular protocol using the option 39"--disable-protocol=@var{PROTOCOL}". 40 41The option "-protocols" of the ff* tools will display the list of 42supported protocols. 43 44All protocols accept the following options: 45 46@table @option 47@item rw_timeout 48Maximum time to wait for (network) read/write operations to complete, 49in microseconds. 50@end table 51 52A description of the currently available protocols follows. 53 54@section amqp 55 56Advanced Message Queueing Protocol (AMQP) version 0-9-1 is a broker based 57publish-subscribe communication protocol. 58 59FFmpeg must be compiled with --enable-librabbitmq to support AMQP. A separate 60AMQP broker must also be run. An example open-source AMQP broker is RabbitMQ. 61 62After starting the broker, an FFmpeg client may stream data to the broker using 63the command: 64 65@example 66ffmpeg -re -i input -f mpegts amqp://[[user]:[password]@@]hostname[:port][/vhost] 67@end example 68 69Where hostname and port (default is 5672) is the address of the broker. The 70client may also set a user/password for authentication. The default for both 71fields is "guest". Name of virtual host on broker can be set with vhost. The 72default value is "/". 73 74Muliple subscribers may stream from the broker using the command: 75@example 76ffplay amqp://[[user]:[password]@@]hostname[:port][/vhost] 77@end example 78 79In RabbitMQ all data published to the broker flows through a specific exchange, 80and each subscribing client has an assigned queue/buffer. When a packet arrives 81at an exchange, it may be copied to a client's queue depending on the exchange 82and routing_key fields. 83 84The following options are supported: 85 86@table @option 87 88@item exchange 89Sets the exchange to use on the broker. RabbitMQ has several predefined 90exchanges: "amq.direct" is the default exchange, where the publisher and 91subscriber must have a matching routing_key; "amq.fanout" is the same as a 92broadcast operation (i.e. the data is forwarded to all queues on the fanout 93exchange independent of the routing_key); and "amq.topic" is similar to 94"amq.direct", but allows for more complex pattern matching (refer to the RabbitMQ 95documentation). 96 97@item routing_key 98Sets the routing key. The default value is "amqp". The routing key is used on 99the "amq.direct" and "amq.topic" exchanges to decide whether packets are written 100to the queue of a subscriber. 101 102@item pkt_size 103Maximum size of each packet sent/received to the broker. Default is 131072. 104Minimum is 4096 and max is any large value (representable by an int). When 105receiving packets, this sets an internal buffer size in FFmpeg. It should be 106equal to or greater than the size of the published packets to the broker. Otherwise 107the received message may be truncated causing decoding errors. 108 109@item connection_timeout 110The timeout in seconds during the initial connection to the broker. The 111default value is rw_timeout, or 5 seconds if rw_timeout is not set. 112 113@item delivery_mode @var{mode} 114Sets the delivery mode of each message sent to broker. 115The following values are accepted: 116@table @samp 117@item persistent 118Delivery mode set to "persistent" (2). This is the default value. 119Messages may be written to the broker's disk depending on its setup. 120 121@item non-persistent 122Delivery mode set to "non-persistent" (1). 123Messages will stay in broker's memory unless the broker is under memory 124pressure. 125 126@end table 127 128@end table 129 130@section async 131 132Asynchronous data filling wrapper for input stream. 133 134Fill data in a background thread, to decouple I/O operation from demux thread. 135 136@example 137async:@var{URL} 138async:http://host/resource 139async:cache:http://host/resource 140@end example 141 142@section bluray 143 144Read BluRay playlist. 145 146The accepted options are: 147@table @option 148 149@item angle 150BluRay angle 151 152@item chapter 153Start chapter (1...N) 154 155@item playlist 156Playlist to read (BDMV/PLAYLIST/?????.mpls) 157 158@end table 159 160Examples: 161 162Read longest playlist from BluRay mounted to /mnt/bluray: 163@example 164bluray:/mnt/bluray 165@end example 166 167Read angle 2 of playlist 4 from BluRay mounted to /mnt/bluray, start from chapter 2: 168@example 169-playlist 4 -angle 2 -chapter 2 bluray:/mnt/bluray 170@end example 171 172@section cache 173 174Caching wrapper for input stream. 175 176Cache the input stream to temporary file. It brings seeking capability to live streams. 177 178The accepted options are: 179@table @option 180 181@item read_ahead_limit 182Amount in bytes that may be read ahead when seeking isn't supported. Range is -1 to INT_MAX. 183-1 for unlimited. Default is 65536. 184 185@end table 186 187URL Syntax is 188@example 189cache:@var{URL} 190@end example 191 192@section concat 193 194Physical concatenation protocol. 195 196Read and seek from many resources in sequence as if they were 197a unique resource. 198 199A URL accepted by this protocol has the syntax: 200@example 201concat:@var{URL1}|@var{URL2}|...|@var{URLN} 202@end example 203 204where @var{URL1}, @var{URL2}, ..., @var{URLN} are the urls of the 205resource to be concatenated, each one possibly specifying a distinct 206protocol. 207 208For example to read a sequence of files @file{split1.mpeg}, 209@file{split2.mpeg}, @file{split3.mpeg} with @command{ffplay} use the 210command: 211@example 212ffplay concat:split1.mpeg\|split2.mpeg\|split3.mpeg 213@end example 214 215Note that you may need to escape the character "|" which is special for 216many shells. 217 218@section concatf 219 220Physical concatenation protocol using a line break delimited list of 221resources. 222 223Read and seek from many resources in sequence as if they were 224a unique resource. 225 226A URL accepted by this protocol has the syntax: 227@example 228concatf:@var{URL} 229@end example 230 231where @var{URL} is the url containing a line break delimited list of 232resources to be concatenated, each one possibly specifying a distinct 233protocol. Special characters must be escaped with backslash or single 234quotes. See @ref{quoting_and_escaping,,the "Quoting and escaping" 235section in the ffmpeg-utils(1) manual,ffmpeg-utils}. 236 237For example to read a sequence of files @file{split1.mpeg}, 238@file{split2.mpeg}, @file{split3.mpeg} listed in separate lines within 239a file @file{split.txt} with @command{ffplay} use the command: 240@example 241ffplay concatf:split.txt 242@end example 243Where @file{split.txt} contains the lines: 244@example 245split1.mpeg 246split2.mpeg 247split3.mpeg 248@end example 249 250@section crypto 251 252AES-encrypted stream reading protocol. 253 254The accepted options are: 255@table @option 256@item key 257Set the AES decryption key binary block from given hexadecimal representation. 258 259@item iv 260Set the AES decryption initialization vector binary block from given hexadecimal representation. 261@end table 262 263Accepted URL formats: 264@example 265crypto:@var{URL} 266crypto+@var{URL} 267@end example 268 269@section data 270 271Data in-line in the URI. See @url{http://en.wikipedia.org/wiki/Data_URI_scheme}. 272 273For example, to convert a GIF file given inline with @command{ffmpeg}: 274@example 275ffmpeg -i "data:image/gif;base64,R0lGODdhCAAIAMIEAAAAAAAA//8AAP//AP///////////////ywAAAAACAAIAAADF0gEDLojDgdGiJdJqUX02iB4E8Q9jUMkADs=" smiley.png 276@end example 277 278@section file 279 280File access protocol. 281 282Read from or write to a file. 283 284A file URL can have the form: 285@example 286file:@var{filename} 287@end example 288 289where @var{filename} is the path of the file to read. 290 291An URL that does not have a protocol prefix will be assumed to be a 292file URL. Depending on the build, an URL that looks like a Windows 293path with the drive letter at the beginning will also be assumed to be 294a file URL (usually not the case in builds for unix-like systems). 295 296For example to read from a file @file{input.mpeg} with @command{ffmpeg} 297use the command: 298@example 299ffmpeg -i file:input.mpeg output.mpeg 300@end example 301 302This protocol accepts the following options: 303 304@table @option 305@item truncate 306Truncate existing files on write, if set to 1. A value of 0 prevents 307truncating. Default value is 1. 308 309@item blocksize 310Set I/O operation maximum block size, in bytes. Default value is 311@code{INT_MAX}, which results in not limiting the requested block size. 312Setting this value reasonably low improves user termination request reaction 313time, which is valuable for files on slow medium. 314 315@item follow 316If set to 1, the protocol will retry reading at the end of the file, allowing 317reading files that still are being written. In order for this to terminate, 318you either need to use the rw_timeout option, or use the interrupt callback 319(for API users). 320 321@item seekable 322Controls if seekability is advertised on the file. 0 means non-seekable, -1 323means auto (seekable for normal files, non-seekable for named pipes). 324 325Many demuxers handle seekable and non-seekable resources differently, 326overriding this might speed up opening certain files at the cost of losing some 327features (e.g. accurate seeking). 328@end table 329 330@section ftp 331 332FTP (File Transfer Protocol). 333 334Read from or write to remote resources using FTP protocol. 335 336Following syntax is required. 337@example 338ftp://[user[:password]@@]server[:port]/path/to/remote/resource.mpeg 339@end example 340 341This protocol accepts the following options. 342 343@table @option 344@item timeout 345Set timeout in microseconds of socket I/O operations used by the underlying low level 346operation. By default it is set to -1, which means that the timeout is 347not specified. 348 349@item ftp-user 350Set a user to be used for authenticating to the FTP server. This is overridden by the 351user in the FTP URL. 352 353@item ftp-password 354Set a password to be used for authenticating to the FTP server. This is overridden by 355the password in the FTP URL, or by @option{ftp-anonymous-password} if no user is set. 356 357@item ftp-anonymous-password 358Password used when login as anonymous user. Typically an e-mail address 359should be used. 360 361@item ftp-write-seekable 362Control seekability of connection during encoding. If set to 1 the 363resource is supposed to be seekable, if set to 0 it is assumed not 364to be seekable. Default value is 0. 365@end table 366 367NOTE: Protocol can be used as output, but it is recommended to not do 368it, unless special care is taken (tests, customized server configuration 369etc.). Different FTP servers behave in different way during seek 370operation. ff* tools may produce incomplete content due to server limitations. 371 372@section gopher 373 374Gopher protocol. 375 376@section gophers 377 378Gophers protocol. 379 380The Gopher protocol with TLS encapsulation. 381 382@section hls 383 384Read Apple HTTP Live Streaming compliant segmented stream as 385a uniform one. The M3U8 playlists describing the segments can be 386remote HTTP resources or local files, accessed using the standard 387file protocol. 388The nested protocol is declared by specifying 389"+@var{proto}" after the hls URI scheme name, where @var{proto} 390is either "file" or "http". 391 392@example 393hls+http://host/path/to/remote/resource.m3u8 394hls+file://path/to/local/resource.m3u8 395@end example 396 397Using this protocol is discouraged - the hls demuxer should work 398just as well (if not, please report the issues) and is more complete. 399To use the hls demuxer instead, simply use the direct URLs to the 400m3u8 files. 401 402@section http 403 404HTTP (Hyper Text Transfer Protocol). 405 406This protocol accepts the following options: 407 408@table @option 409@item seekable 410Control seekability of connection. If set to 1 the resource is 411supposed to be seekable, if set to 0 it is assumed not to be seekable, 412if set to -1 it will try to autodetect if it is seekable. Default 413value is -1. 414 415@item chunked_post 416If set to 1 use chunked Transfer-Encoding for posts, default is 1. 417 418@item content_type 419Set a specific content type for the POST messages or for listen mode. 420 421@item http_proxy 422set HTTP proxy to tunnel through e.g. http://example.com:1234 423 424@item headers 425Set custom HTTP headers, can override built in default headers. The 426value must be a string encoding the headers. 427 428@item multiple_requests 429Use persistent connections if set to 1, default is 0. 430 431@item post_data 432Set custom HTTP post data. 433 434@item referer 435Set the Referer header. Include 'Referer: URL' header in HTTP request. 436 437@item user_agent 438Override the User-Agent header. If not specified the protocol will use a 439string describing the libavformat build. ("Lavf/<version>") 440 441@item reconnect_at_eof 442If set then eof is treated like an error and causes reconnection, this is useful 443for live / endless streams. 444 445@item reconnect_streamed 446If set then even streamed/non seekable streams will be reconnected on errors. 447 448@item reconnect_on_network_error 449Reconnect automatically in case of TCP/TLS errors during connect. 450 451@item reconnect_on_http_error 452A comma separated list of HTTP status codes to reconnect on. The list can 453include specific status codes (e.g. '503') or the strings '4xx' / '5xx'. 454 455@item reconnect_delay_max 456Sets the maximum delay in seconds after which to give up reconnecting 457 458@item mime_type 459Export the MIME type. 460 461@item http_version 462Exports the HTTP response version number. Usually "1.0" or "1.1". 463 464@item icy 465If set to 1 request ICY (SHOUTcast) metadata from the server. If the server 466supports this, the metadata has to be retrieved by the application by reading 467the @option{icy_metadata_headers} and @option{icy_metadata_packet} options. 468The default is 1. 469 470@item icy_metadata_headers 471If the server supports ICY metadata, this contains the ICY-specific HTTP reply 472headers, separated by newline characters. 473 474@item icy_metadata_packet 475If the server supports ICY metadata, and @option{icy} was set to 1, this 476contains the last non-empty metadata packet sent by the server. It should be 477polled in regular intervals by applications interested in mid-stream metadata 478updates. 479 480@item cookies 481Set the cookies to be sent in future requests. The format of each cookie is the 482same as the value of a Set-Cookie HTTP response field. Multiple cookies can be 483delimited by a newline character. 484 485@item offset 486Set initial byte offset. 487 488@item end_offset 489Try to limit the request to bytes preceding this offset. 490 491@item method 492When used as a client option it sets the HTTP method for the request. 493 494When used as a server option it sets the HTTP method that is going to be 495expected from the client(s). 496If the expected and the received HTTP method do not match the client will 497be given a Bad Request response. 498When unset the HTTP method is not checked for now. This will be replaced by 499autodetection in the future. 500 501@item listen 502If set to 1 enables experimental HTTP server. This can be used to send data when 503used as an output option, or read data from a client with HTTP POST when used as 504an input option. 505If set to 2 enables experimental multi-client HTTP server. This is not yet implemented 506in ffmpeg.c and thus must not be used as a command line option. 507@example 508# Server side (sending): 509ffmpeg -i somefile.ogg -c copy -listen 1 -f ogg http://@var{server}:@var{port} 510 511# Client side (receiving): 512ffmpeg -i http://@var{server}:@var{port} -c copy somefile.ogg 513 514# Client can also be done with wget: 515wget http://@var{server}:@var{port} -O somefile.ogg 516 517# Server side (receiving): 518ffmpeg -listen 1 -i http://@var{server}:@var{port} -c copy somefile.ogg 519 520# Client side (sending): 521ffmpeg -i somefile.ogg -chunked_post 0 -c copy -f ogg http://@var{server}:@var{port} 522 523# Client can also be done with wget: 524wget --post-file=somefile.ogg http://@var{server}:@var{port} 525@end example 526 527@item send_expect_100 528Send an Expect: 100-continue header for POST. If set to 1 it will send, if set 529to 0 it won't, if set to -1 it will try to send if it is applicable. Default 530value is -1. 531 532@item auth_type 533 534Set HTTP authentication type. No option for Digest, since this method requires 535getting nonce parameters from the server first and can't be used straight away like 536Basic. 537 538@table @option 539@item none 540Choose the HTTP authentication type automatically. This is the default. 541@item basic 542 543Choose the HTTP basic authentication. 544 545Basic authentication sends a Base64-encoded string that contains a user name and password 546for the client. Base64 is not a form of encryption and should be considered the same as 547sending the user name and password in clear text (Base64 is a reversible encoding). 548If a resource needs to be protected, strongly consider using an authentication scheme 549other than basic authentication. HTTPS/TLS should be used with basic authentication. 550Without these additional security enhancements, basic authentication should not be used 551to protect sensitive or valuable information. 552@end table 553 554@end table 555 556@subsection HTTP Cookies 557 558Some HTTP requests will be denied unless cookie values are passed in with the 559request. The @option{cookies} option allows these cookies to be specified. At 560the very least, each cookie must specify a value along with a path and domain. 561HTTP requests that match both the domain and path will automatically include the 562cookie value in the HTTP Cookie header field. Multiple cookies can be delimited 563by a newline. 564 565The required syntax to play a stream specifying a cookie is: 566@example 567ffplay -cookies "nlqptid=nltid=tsn; path=/; domain=somedomain.com;" http://somedomain.com/somestream.m3u8 568@end example 569 570@section Icecast 571 572Icecast protocol (stream to Icecast servers) 573 574This protocol accepts the following options: 575 576@table @option 577@item ice_genre 578Set the stream genre. 579 580@item ice_name 581Set the stream name. 582 583@item ice_description 584Set the stream description. 585 586@item ice_url 587Set the stream website URL. 588 589@item ice_public 590Set if the stream should be public. 591The default is 0 (not public). 592 593@item user_agent 594Override the User-Agent header. If not specified a string of the form 595"Lavf/<version>" will be used. 596 597@item password 598Set the Icecast mountpoint password. 599 600@item content_type 601Set the stream content type. This must be set if it is different from 602audio/mpeg. 603 604@item legacy_icecast 605This enables support for Icecast versions < 2.4.0, that do not support the 606HTTP PUT method but the SOURCE method. 607 608@item tls 609Establish a TLS (HTTPS) connection to Icecast. 610 611@end table 612 613@example 614icecast://[@var{username}[:@var{password}]@@]@var{server}:@var{port}/@var{mountpoint} 615@end example 616 617@section ipfs 618 619InterPlanetary File System (IPFS) protocol support. One can access files stored 620on the IPFS network through so-called gateways. These are http(s) endpoints. 621This protocol wraps the IPFS native protocols (ipfs:// and ipns://) to be sent 622to such a gateway. Users can (and should) host their own node which means this 623protocol will use one's local gateway to access files on the IPFS network. 624 625If a user doesn't have a node of their own then the public gateway @code{https://dweb.link} 626is used by default. 627 628This protocol accepts the following options: 629 630@table @option 631 632@item gateway 633Defines the gateway to use. When not set, the protocol will first try 634locating the local gateway by looking at @code{$IPFS_GATEWAY}, @code{$IPFS_PATH} 635and @code{$HOME/.ipfs/}, in that order. If that fails @code{https://dweb.link} will be used. 636 637@end table 638 639One can use this protocol in 2 ways. Using IPFS: 640@example 641ffplay ipfs://QmbGtJg23skhvFmu9mJiePVByhfzu5rwo74MEkVDYAmF5T 642@end example 643 644Or the IPNS protocol (IPNS is mutable IPFS): 645@example 646ffplay ipns://QmbGtJg23skhvFmu9mJiePVByhfzu5rwo74MEkVDYAmF5T 647@end example 648 649@section mmst 650 651MMS (Microsoft Media Server) protocol over TCP. 652 653@section mmsh 654 655MMS (Microsoft Media Server) protocol over HTTP. 656 657The required syntax is: 658@example 659mmsh://@var{server}[:@var{port}][/@var{app}][/@var{playpath}] 660@end example 661 662@section md5 663 664MD5 output protocol. 665 666Computes the MD5 hash of the data to be written, and on close writes 667this to the designated output or stdout if none is specified. It can 668be used to test muxers without writing an actual file. 669 670Some examples follow. 671@example 672# Write the MD5 hash of the encoded AVI file to the file output.avi.md5. 673ffmpeg -i input.flv -f avi -y md5:output.avi.md5 674 675# Write the MD5 hash of the encoded AVI file to stdout. 676ffmpeg -i input.flv -f avi -y md5: 677@end example 678 679Note that some formats (typically MOV) require the output protocol to 680be seekable, so they will fail with the MD5 output protocol. 681 682@section pipe 683 684UNIX pipe access protocol. 685 686Read and write from UNIX pipes. 687 688The accepted syntax is: 689@example 690pipe:[@var{number}] 691@end example 692 693@var{number} is the number corresponding to the file descriptor of the 694pipe (e.g. 0 for stdin, 1 for stdout, 2 for stderr). If @var{number} 695is not specified, by default the stdout file descriptor will be used 696for writing, stdin for reading. 697 698For example to read from stdin with @command{ffmpeg}: 699@example 700cat test.wav | ffmpeg -i pipe:0 701# ...this is the same as... 702cat test.wav | ffmpeg -i pipe: 703@end example 704 705For writing to stdout with @command{ffmpeg}: 706@example 707ffmpeg -i test.wav -f avi pipe:1 | cat > test.avi 708# ...this is the same as... 709ffmpeg -i test.wav -f avi pipe: | cat > test.avi 710@end example 711 712This protocol accepts the following options: 713 714@table @option 715@item blocksize 716Set I/O operation maximum block size, in bytes. Default value is 717@code{INT_MAX}, which results in not limiting the requested block size. 718Setting this value reasonably low improves user termination request reaction 719time, which is valuable if data transmission is slow. 720@end table 721 722Note that some formats (typically MOV), require the output protocol to 723be seekable, so they will fail with the pipe output protocol. 724 725@section prompeg 726 727Pro-MPEG Code of Practice #3 Release 2 FEC protocol. 728 729The Pro-MPEG CoP#3 FEC is a 2D parity-check forward error correction mechanism 730for MPEG-2 Transport Streams sent over RTP. 731 732This protocol must be used in conjunction with the @code{rtp_mpegts} muxer and 733the @code{rtp} protocol. 734 735The required syntax is: 736@example 737-f rtp_mpegts -fec prompeg=@var{option}=@var{val}... rtp://@var{hostname}:@var{port} 738@end example 739 740The destination UDP ports are @code{port + 2} for the column FEC stream 741and @code{port + 4} for the row FEC stream. 742 743This protocol accepts the following options: 744@table @option 745 746@item l=@var{n} 747The number of columns (4-20, LxD <= 100) 748 749@item d=@var{n} 750The number of rows (4-20, LxD <= 100) 751 752@end table 753 754Example usage: 755 756@example 757-f rtp_mpegts -fec prompeg=l=8:d=4 rtp://@var{hostname}:@var{port} 758@end example 759 760@section rist 761 762Reliable Internet Streaming Transport protocol 763 764The accepted options are: 765@table @option 766@item rist_profile 767Supported values: 768@table @samp 769@item simple 770@item main 771This one is default. 772@item advanced 773@end table 774 775@item buffer_size 776Set internal RIST buffer size in milliseconds for retransmission of data. 777Default value is 0 which means the librist default (1 sec). Maximum value is 30 778seconds. 779 780@item fifo_size 781Size of the librist receiver output fifo in number of packets. This must be a 782power of 2. 783Defaults to 8192 (vs the librist default of 1024). 784 785@item overrun_nonfatal=@var{1|0} 786Survive in case of librist fifo buffer overrun. Default value is 0. 787 788@item pkt_size 789Set maximum packet size for sending data. 1316 by default. 790 791@item log_level 792Set loglevel for RIST logging messages. You only need to set this if you 793explicitly want to enable debug level messages or packet loss simulation, 794otherwise the regular loglevel is respected. 795 796@item secret 797Set override of encryption secret, by default is unset. 798 799@item encryption 800Set encryption type, by default is disabled. 801Acceptable values are 128 and 256. 802@end table 803 804@section rtmp 805 806Real-Time Messaging Protocol. 807 808The Real-Time Messaging Protocol (RTMP) is used for streaming multimedia 809content across a TCP/IP network. 810 811The required syntax is: 812@example 813rtmp://[@var{username}:@var{password}@@]@var{server}[:@var{port}][/@var{app}][/@var{instance}][/@var{playpath}] 814@end example 815 816The accepted parameters are: 817@table @option 818 819@item username 820An optional username (mostly for publishing). 821 822@item password 823An optional password (mostly for publishing). 824 825@item server 826The address of the RTMP server. 827 828@item port 829The number of the TCP port to use (by default is 1935). 830 831@item app 832It is the name of the application to access. It usually corresponds to 833the path where the application is installed on the RTMP server 834(e.g. @file{/ondemand/}, @file{/flash/live/}, etc.). You can override 835the value parsed from the URI through the @code{rtmp_app} option, too. 836 837@item playpath 838It is the path or name of the resource to play with reference to the 839application specified in @var{app}, may be prefixed by "mp4:". You 840can override the value parsed from the URI through the @code{rtmp_playpath} 841option, too. 842 843@item listen 844Act as a server, listening for an incoming connection. 845 846@item timeout 847Maximum time to wait for the incoming connection. Implies listen. 848@end table 849 850Additionally, the following parameters can be set via command line options 851(or in code via @code{AVOption}s): 852@table @option 853 854@item rtmp_app 855Name of application to connect on the RTMP server. This option 856overrides the parameter specified in the URI. 857 858@item rtmp_buffer 859Set the client buffer time in milliseconds. The default is 3000. 860 861@item rtmp_conn 862Extra arbitrary AMF connection parameters, parsed from a string, 863e.g. like @code{B:1 S:authMe O:1 NN:code:1.23 NS:flag:ok O:0}. 864Each value is prefixed by a single character denoting the type, 865B for Boolean, N for number, S for string, O for object, or Z for null, 866followed by a colon. For Booleans the data must be either 0 or 1 for 867FALSE or TRUE, respectively. Likewise for Objects the data must be 0 or 8681 to end or begin an object, respectively. Data items in subobjects may 869be named, by prefixing the type with 'N' and specifying the name before 870the value (i.e. @code{NB:myFlag:1}). This option may be used multiple 871times to construct arbitrary AMF sequences. 872 873@item rtmp_flashver 874Version of the Flash plugin used to run the SWF player. The default 875is LNX 9,0,124,2. (When publishing, the default is FMLE/3.0 (compatible; 876<libavformat version>).) 877 878@item rtmp_flush_interval 879Number of packets flushed in the same request (RTMPT only). The default 880is 10. 881 882@item rtmp_live 883Specify that the media is a live stream. No resuming or seeking in 884live streams is possible. The default value is @code{any}, which means the 885subscriber first tries to play the live stream specified in the 886playpath. If a live stream of that name is not found, it plays the 887recorded stream. The other possible values are @code{live} and 888@code{recorded}. 889 890@item rtmp_pageurl 891URL of the web page in which the media was embedded. By default no 892value will be sent. 893 894@item rtmp_playpath 895Stream identifier to play or to publish. This option overrides the 896parameter specified in the URI. 897 898@item rtmp_subscribe 899Name of live stream to subscribe to. By default no value will be sent. 900It is only sent if the option is specified or if rtmp_live 901is set to live. 902 903@item rtmp_swfhash 904SHA256 hash of the decompressed SWF file (32 bytes). 905 906@item rtmp_swfsize 907Size of the decompressed SWF file, required for SWFVerification. 908 909@item rtmp_swfurl 910URL of the SWF player for the media. By default no value will be sent. 911 912@item rtmp_swfverify 913URL to player swf file, compute hash/size automatically. 914 915@item rtmp_tcurl 916URL of the target stream. Defaults to proto://host[:port]/app. 917 918@item tcp_nodelay=@var{1|0} 919Set TCP_NODELAY to disable Nagle's algorithm. Default value is 0. 920 921@emph{Remark: Writing to the socket is currently not optimized to minimize system calls and reduces the efficiency / effect of TCP_NODELAY.} 922 923@end table 924 925For example to read with @command{ffplay} a multimedia resource named 926"sample" from the application "vod" from an RTMP server "myserver": 927@example 928ffplay rtmp://myserver/vod/sample 929@end example 930 931To publish to a password protected server, passing the playpath and 932app names separately: 933@example 934ffmpeg -re -i <input> -f flv -rtmp_playpath some/long/path -rtmp_app long/app/name rtmp://username:password@@myserver/ 935@end example 936 937@section rtmpe 938 939Encrypted Real-Time Messaging Protocol. 940 941The Encrypted Real-Time Messaging Protocol (RTMPE) is used for 942streaming multimedia content within standard cryptographic primitives, 943consisting of Diffie-Hellman key exchange and HMACSHA256, generating 944a pair of RC4 keys. 945 946@section rtmps 947 948Real-Time Messaging Protocol over a secure SSL connection. 949 950The Real-Time Messaging Protocol (RTMPS) is used for streaming 951multimedia content across an encrypted connection. 952 953@section rtmpt 954 955Real-Time Messaging Protocol tunneled through HTTP. 956 957The Real-Time Messaging Protocol tunneled through HTTP (RTMPT) is used 958for streaming multimedia content within HTTP requests to traverse 959firewalls. 960 961@section rtmpte 962 963Encrypted Real-Time Messaging Protocol tunneled through HTTP. 964 965The Encrypted Real-Time Messaging Protocol tunneled through HTTP (RTMPTE) 966is used for streaming multimedia content within HTTP requests to traverse 967firewalls. 968 969@section rtmpts 970 971Real-Time Messaging Protocol tunneled through HTTPS. 972 973The Real-Time Messaging Protocol tunneled through HTTPS (RTMPTS) is used 974for streaming multimedia content within HTTPS requests to traverse 975firewalls. 976 977@section libsmbclient 978 979libsmbclient permits one to manipulate CIFS/SMB network resources. 980 981Following syntax is required. 982 983@example 984smb://[[domain:]user[:password@@]]server[/share[/path[/file]]] 985@end example 986 987This protocol accepts the following options. 988 989@table @option 990@item timeout 991Set timeout in milliseconds of socket I/O operations used by the underlying 992low level operation. By default it is set to -1, which means that the timeout 993is not specified. 994 995@item truncate 996Truncate existing files on write, if set to 1. A value of 0 prevents 997truncating. Default value is 1. 998 999@item workgroup 1000Set the workgroup used for making connections. By default workgroup is not specified. 1001 1002@end table 1003 1004For more information see: @url{http://www.samba.org/}. 1005 1006@section libssh 1007 1008Secure File Transfer Protocol via libssh 1009 1010Read from or write to remote resources using SFTP protocol. 1011 1012Following syntax is required. 1013 1014@example 1015sftp://[user[:password]@@]server[:port]/path/to/remote/resource.mpeg 1016@end example 1017 1018This protocol accepts the following options. 1019 1020@table @option 1021@item timeout 1022Set timeout of socket I/O operations used by the underlying low level 1023operation. By default it is set to -1, which means that the timeout 1024is not specified. 1025 1026@item truncate 1027Truncate existing files on write, if set to 1. A value of 0 prevents 1028truncating. Default value is 1. 1029 1030@item private_key 1031Specify the path of the file containing private key to use during authorization. 1032By default libssh searches for keys in the @file{~/.ssh/} directory. 1033 1034@end table 1035 1036Example: Play a file stored on remote server. 1037 1038@example 1039ffplay sftp://user:password@@server_address:22/home/user/resource.mpeg 1040@end example 1041 1042@section librtmp rtmp, rtmpe, rtmps, rtmpt, rtmpte 1043 1044Real-Time Messaging Protocol and its variants supported through 1045librtmp. 1046 1047Requires the presence of the librtmp headers and library during 1048configuration. You need to explicitly configure the build with 1049"--enable-librtmp". If enabled this will replace the native RTMP 1050protocol. 1051 1052This protocol provides most client functions and a few server 1053functions needed to support RTMP, RTMP tunneled in HTTP (RTMPT), 1054encrypted RTMP (RTMPE), RTMP over SSL/TLS (RTMPS) and tunneled 1055variants of these encrypted types (RTMPTE, RTMPTS). 1056 1057The required syntax is: 1058@example 1059@var{rtmp_proto}://@var{server}[:@var{port}][/@var{app}][/@var{playpath}] @var{options} 1060@end example 1061 1062where @var{rtmp_proto} is one of the strings "rtmp", "rtmpt", "rtmpe", 1063"rtmps", "rtmpte", "rtmpts" corresponding to each RTMP variant, and 1064@var{server}, @var{port}, @var{app} and @var{playpath} have the same 1065meaning as specified for the RTMP native protocol. 1066@var{options} contains a list of space-separated options of the form 1067@var{key}=@var{val}. 1068 1069See the librtmp manual page (man 3 librtmp) for more information. 1070 1071For example, to stream a file in real-time to an RTMP server using 1072@command{ffmpeg}: 1073@example 1074ffmpeg -re -i myfile -f flv rtmp://myserver/live/mystream 1075@end example 1076 1077To play the same stream using @command{ffplay}: 1078@example 1079ffplay "rtmp://myserver/live/mystream live=1" 1080@end example 1081 1082@section rtp 1083 1084Real-time Transport Protocol. 1085 1086The required syntax for an RTP URL is: 1087rtp://@var{hostname}[:@var{port}][?@var{option}=@var{val}...] 1088 1089@var{port} specifies the RTP port to use. 1090 1091The following URL options are supported: 1092 1093@table @option 1094 1095@item ttl=@var{n} 1096Set the TTL (Time-To-Live) value (for multicast only). 1097 1098@item rtcpport=@var{n} 1099Set the remote RTCP port to @var{n}. 1100 1101@item localrtpport=@var{n} 1102Set the local RTP port to @var{n}. 1103 1104@item localrtcpport=@var{n}' 1105Set the local RTCP port to @var{n}. 1106 1107@item pkt_size=@var{n} 1108Set max packet size (in bytes) to @var{n}. 1109 1110@item buffer_size=@var{size} 1111Set the maximum UDP socket buffer size in bytes. 1112 1113@item connect=0|1 1114Do a @code{connect()} on the UDP socket (if set to 1) or not (if set 1115to 0). 1116 1117@item sources=@var{ip}[,@var{ip}] 1118List allowed source IP addresses. 1119 1120@item block=@var{ip}[,@var{ip}] 1121List disallowed (blocked) source IP addresses. 1122 1123@item write_to_source=0|1 1124Send packets to the source address of the latest received packet (if 1125set to 1) or to a default remote address (if set to 0). 1126 1127@item localport=@var{n} 1128Set the local RTP port to @var{n}. 1129 1130@item localaddr=@var{addr} 1131Local IP address of a network interface used for sending packets or joining 1132multicast groups. 1133 1134@item timeout=@var{n} 1135Set timeout (in microseconds) of socket I/O operations to @var{n}. 1136 1137This is a deprecated option. Instead, @option{localrtpport} should be 1138used. 1139 1140@end table 1141 1142Important notes: 1143 1144@enumerate 1145 1146@item 1147If @option{rtcpport} is not set the RTCP port will be set to the RTP 1148port value plus 1. 1149 1150@item 1151If @option{localrtpport} (the local RTP port) is not set any available 1152port will be used for the local RTP and RTCP ports. 1153 1154@item 1155If @option{localrtcpport} (the local RTCP port) is not set it will be 1156set to the local RTP port value plus 1. 1157@end enumerate 1158 1159@section rtsp 1160 1161Real-Time Streaming Protocol. 1162 1163RTSP is not technically a protocol handler in libavformat, it is a demuxer 1164and muxer. The demuxer supports both normal RTSP (with data transferred 1165over RTP; this is used by e.g. Apple and Microsoft) and Real-RTSP (with 1166data transferred over RDT). 1167 1168The muxer can be used to send a stream using RTSP ANNOUNCE to a server 1169supporting it (currently Darwin Streaming Server and Mischa Spiegelmock's 1170@uref{https://github.com/revmischa/rtsp-server, RTSP server}). 1171 1172The required syntax for a RTSP url is: 1173@example 1174rtsp://@var{hostname}[:@var{port}]/@var{path} 1175@end example 1176 1177Options can be set on the @command{ffmpeg}/@command{ffplay} command 1178line, or set in code via @code{AVOption}s or in 1179@code{avformat_open_input}. 1180 1181The following options are supported. 1182 1183@table @option 1184@item initial_pause 1185Do not start playing the stream immediately if set to 1. Default value 1186is 0. 1187 1188@item rtsp_transport 1189Set RTSP transport protocols. 1190 1191It accepts the following values: 1192@table @samp 1193@item udp 1194Use UDP as lower transport protocol. 1195 1196@item tcp 1197Use TCP (interleaving within the RTSP control channel) as lower 1198transport protocol. 1199 1200@item udp_multicast 1201Use UDP multicast as lower transport protocol. 1202 1203@item http 1204Use HTTP tunneling as lower transport protocol, which is useful for 1205passing proxies. 1206@end table 1207 1208Multiple lower transport protocols may be specified, in that case they are 1209tried one at a time (if the setup of one fails, the next one is tried). 1210For the muxer, only the @samp{tcp} and @samp{udp} options are supported. 1211 1212@item rtsp_flags 1213Set RTSP flags. 1214 1215The following values are accepted: 1216@table @samp 1217@item filter_src 1218Accept packets only from negotiated peer address and port. 1219@item listen 1220Act as a server, listening for an incoming connection. 1221@item prefer_tcp 1222Try TCP for RTP transport first, if TCP is available as RTSP RTP transport. 1223@end table 1224 1225Default value is @samp{none}. 1226 1227@item allowed_media_types 1228Set media types to accept from the server. 1229 1230The following flags are accepted: 1231@table @samp 1232@item video 1233@item audio 1234@item data 1235@end table 1236 1237By default it accepts all media types. 1238 1239@item min_port 1240Set minimum local UDP port. Default value is 5000. 1241 1242@item max_port 1243Set maximum local UDP port. Default value is 65000. 1244 1245@item listen_timeout 1246Set maximum timeout (in seconds) to establish an initial connection. Setting 1247@option{listen_timeout} > 0 sets @option{rtsp_flags} to @samp{listen}. Default is -1 1248which means an infinite timeout when @samp{listen} mode is set. 1249 1250@item reorder_queue_size 1251Set number of packets to buffer for handling of reordered packets. 1252 1253@item timeout 1254Set socket TCP I/O timeout in microseconds. 1255 1256@item user_agent 1257Override User-Agent header. If not specified, it defaults to the 1258libavformat identifier string. 1259@end table 1260 1261When receiving data over UDP, the demuxer tries to reorder received packets 1262(since they may arrive out of order, or packets may get lost totally). This 1263can be disabled by setting the maximum demuxing delay to zero (via 1264the @code{max_delay} field of AVFormatContext). 1265 1266When watching multi-bitrate Real-RTSP streams with @command{ffplay}, the 1267streams to display can be chosen with @code{-vst} @var{n} and 1268@code{-ast} @var{n} for video and audio respectively, and can be switched 1269on the fly by pressing @code{v} and @code{a}. 1270 1271@subsection Examples 1272 1273The following examples all make use of the @command{ffplay} and 1274@command{ffmpeg} tools. 1275 1276@itemize 1277@item 1278Watch a stream over UDP, with a max reordering delay of 0.5 seconds: 1279@example 1280ffplay -max_delay 500000 -rtsp_transport udp rtsp://server/video.mp4 1281@end example 1282 1283@item 1284Watch a stream tunneled over HTTP: 1285@example 1286ffplay -rtsp_transport http rtsp://server/video.mp4 1287@end example 1288 1289@item 1290Send a stream in realtime to a RTSP server, for others to watch: 1291@example 1292ffmpeg -re -i @var{input} -f rtsp -muxdelay 0.1 rtsp://server/live.sdp 1293@end example 1294 1295@item 1296Receive a stream in realtime: 1297@example 1298ffmpeg -rtsp_flags listen -i rtsp://ownaddress/live.sdp @var{output} 1299@end example 1300@end itemize 1301 1302@section sap 1303 1304Session Announcement Protocol (RFC 2974). This is not technically a 1305protocol handler in libavformat, it is a muxer and demuxer. 1306It is used for signalling of RTP streams, by announcing the SDP for the 1307streams regularly on a separate port. 1308 1309@subsection Muxer 1310 1311The syntax for a SAP url given to the muxer is: 1312@example 1313sap://@var{destination}[:@var{port}][?@var{options}] 1314@end example 1315 1316The RTP packets are sent to @var{destination} on port @var{port}, 1317or to port 5004 if no port is specified. 1318@var{options} is a @code{&}-separated list. The following options 1319are supported: 1320 1321@table @option 1322 1323@item announce_addr=@var{address} 1324Specify the destination IP address for sending the announcements to. 1325If omitted, the announcements are sent to the commonly used SAP 1326announcement multicast address 224.2.127.254 (sap.mcast.net), or 1327ff0e::2:7ffe if @var{destination} is an IPv6 address. 1328 1329@item announce_port=@var{port} 1330Specify the port to send the announcements on, defaults to 13319875 if not specified. 1332 1333@item ttl=@var{ttl} 1334Specify the time to live value for the announcements and RTP packets, 1335defaults to 255. 1336 1337@item same_port=@var{0|1} 1338If set to 1, send all RTP streams on the same port pair. If zero (the 1339default), all streams are sent on unique ports, with each stream on a 1340port 2 numbers higher than the previous. 1341VLC/Live555 requires this to be set to 1, to be able to receive the stream. 1342The RTP stack in libavformat for receiving requires all streams to be sent 1343on unique ports. 1344@end table 1345 1346Example command lines follow. 1347 1348To broadcast a stream on the local subnet, for watching in VLC: 1349 1350@example 1351ffmpeg -re -i @var{input} -f sap sap://224.0.0.255?same_port=1 1352@end example 1353 1354Similarly, for watching in @command{ffplay}: 1355 1356@example 1357ffmpeg -re -i @var{input} -f sap sap://224.0.0.255 1358@end example 1359 1360And for watching in @command{ffplay}, over IPv6: 1361 1362@example 1363ffmpeg -re -i @var{input} -f sap sap://[ff0e::1:2:3:4] 1364@end example 1365 1366@subsection Demuxer 1367 1368The syntax for a SAP url given to the demuxer is: 1369@example 1370sap://[@var{address}][:@var{port}] 1371@end example 1372 1373@var{address} is the multicast address to listen for announcements on, 1374if omitted, the default 224.2.127.254 (sap.mcast.net) is used. @var{port} 1375is the port that is listened on, 9875 if omitted. 1376 1377The demuxers listens for announcements on the given address and port. 1378Once an announcement is received, it tries to receive that particular stream. 1379 1380Example command lines follow. 1381 1382To play back the first stream announced on the normal SAP multicast address: 1383 1384@example 1385ffplay sap:// 1386@end example 1387 1388To play back the first stream announced on one the default IPv6 SAP multicast address: 1389 1390@example 1391ffplay sap://[ff0e::2:7ffe] 1392@end example 1393 1394@section sctp 1395 1396Stream Control Transmission Protocol. 1397 1398The accepted URL syntax is: 1399@example 1400sctp://@var{host}:@var{port}[?@var{options}] 1401@end example 1402 1403The protocol accepts the following options: 1404@table @option 1405@item listen 1406If set to any value, listen for an incoming connection. Outgoing connection is done by default. 1407 1408@item max_streams 1409Set the maximum number of streams. By default no limit is set. 1410@end table 1411 1412@section srt 1413 1414Haivision Secure Reliable Transport Protocol via libsrt. 1415 1416The supported syntax for a SRT URL is: 1417@example 1418srt://@var{hostname}:@var{port}[?@var{options}] 1419@end example 1420 1421@var{options} contains a list of &-separated options of the form 1422@var{key}=@var{val}. 1423 1424or 1425 1426@example 1427@var{options} srt://@var{hostname}:@var{port} 1428@end example 1429 1430@var{options} contains a list of '-@var{key} @var{val}' 1431options. 1432 1433This protocol accepts the following options. 1434 1435@table @option 1436@item connect_timeout=@var{milliseconds} 1437Connection timeout; SRT cannot connect for RTT > 1500 msec 1438(2 handshake exchanges) with the default connect timeout of 14393 seconds. This option applies to the caller and rendezvous 1440connection modes. The connect timeout is 10 times the value 1441set for the rendezvous mode (which can be used as a 1442workaround for this connection problem with earlier versions). 1443 1444@item ffs=@var{bytes} 1445Flight Flag Size (Window Size), in bytes. FFS is actually an 1446internal parameter and you should set it to not less than 1447@option{recv_buffer_size} and @option{mss}. The default value 1448is relatively large, therefore unless you set a very large receiver buffer, 1449you do not need to change this option. Default value is 25600. 1450 1451@item inputbw=@var{bytes/seconds} 1452Sender nominal input rate, in bytes per seconds. Used along with 1453@option{oheadbw}, when @option{maxbw} is set to relative (0), to 1454calculate maximum sending rate when recovery packets are sent 1455along with the main media stream: 1456@option{inputbw} * (100 + @option{oheadbw}) / 100 1457if @option{inputbw} is not set while @option{maxbw} is set to 1458relative (0), the actual input rate is evaluated inside 1459the library. Default value is 0. 1460 1461@item iptos=@var{tos} 1462IP Type of Service. Applies to sender only. Default value is 0xB8. 1463 1464@item ipttl=@var{ttl} 1465IP Time To Live. Applies to sender only. Default value is 64. 1466 1467@item latency=@var{microseconds} 1468Timestamp-based Packet Delivery Delay. 1469Used to absorb bursts of missed packet retransmissions. 1470This flag sets both @option{rcvlatency} and @option{peerlatency} 1471to the same value. Note that prior to version 1.3.0 1472this is the only flag to set the latency, however 1473this is effectively equivalent to setting @option{peerlatency}, 1474when side is sender and @option{rcvlatency} 1475when side is receiver, and the bidirectional stream 1476sending is not supported. 1477 1478@item listen_timeout=@var{microseconds} 1479Set socket listen timeout. 1480 1481@item maxbw=@var{bytes/seconds} 1482Maximum sending bandwidth, in bytes per seconds. 1483-1 infinite (CSRTCC limit is 30mbps) 14840 relative to input rate (see @option{inputbw}) 1485>0 absolute limit value 1486Default value is 0 (relative) 1487 1488@item mode=@var{caller|listener|rendezvous} 1489Connection mode. 1490@option{caller} opens client connection. 1491@option{listener} starts server to listen for incoming connections. 1492@option{rendezvous} use Rendez-Vous connection mode. 1493Default value is caller. 1494 1495@item mss=@var{bytes} 1496Maximum Segment Size, in bytes. Used for buffer allocation 1497and rate calculation using a packet counter assuming fully 1498filled packets. The smallest MSS between the peers is 1499used. This is 1500 by default in the overall internet. 1500This is the maximum size of the UDP packet and can be 1501only decreased, unless you have some unusual dedicated 1502network settings. Default value is 1500. 1503 1504@item nakreport=@var{1|0} 1505If set to 1, Receiver will send `UMSG_LOSSREPORT` messages 1506periodically until a lost packet is retransmitted or 1507intentionally dropped. Default value is 1. 1508 1509@item oheadbw=@var{percents} 1510Recovery bandwidth overhead above input rate, in percents. 1511See @option{inputbw}. Default value is 25%. 1512 1513@item passphrase=@var{string} 1514HaiCrypt Encryption/Decryption Passphrase string, length 1515from 10 to 79 characters. The passphrase is the shared 1516secret between the sender and the receiver. It is used 1517to generate the Key Encrypting Key using PBKDF2 1518(Password-Based Key Derivation Function). It is used 1519only if @option{pbkeylen} is non-zero. It is used on 1520the receiver only if the received data is encrypted. 1521The configured passphrase cannot be recovered (write-only). 1522 1523@item enforced_encryption=@var{1|0} 1524If true, both connection parties must have the same password 1525set (including empty, that is, with no encryption). If the 1526password doesn't match or only one side is unencrypted, 1527the connection is rejected. Default is true. 1528 1529@item kmrefreshrate=@var{packets} 1530The number of packets to be transmitted after which the 1531encryption key is switched to a new key. Default is -1. 1532-1 means auto (0x1000000 in srt library). The range for 1533this option is integers in the 0 - @code{INT_MAX}. 1534 1535@item kmpreannounce=@var{packets} 1536The interval between when a new encryption key is sent and 1537when switchover occurs. This value also applies to the 1538subsequent interval between when switchover occurs and 1539when the old encryption key is decommissioned. Default is -1. 1540-1 means auto (0x1000 in srt library). The range for 1541this option is integers in the 0 - @code{INT_MAX}. 1542 1543@item snddropdelay=@var{microseconds} 1544The sender's extra delay before dropping packets. This delay is 1545added to the default drop delay time interval value. 1546 1547Special value -1: Do not drop packets on the sender at all. 1548 1549@item payload_size=@var{bytes} 1550Sets the maximum declared size of a packet transferred 1551during the single call to the sending function in Live 1552mode. Use 0 if this value isn't used (which is default in 1553file mode). 1554Default is -1 (automatic), which typically means MPEG-TS; 1555if you are going to use SRT 1556to send any different kind of payload, such as, for example, 1557wrapping a live stream in very small frames, then you can 1558use a bigger maximum frame size, though not greater than 15591456 bytes. 1560 1561@item pkt_size=@var{bytes} 1562Alias for @samp{payload_size}. 1563 1564@item peerlatency=@var{microseconds} 1565The latency value (as described in @option{rcvlatency}) that is 1566set by the sender side as a minimum value for the receiver. 1567 1568@item pbkeylen=@var{bytes} 1569Sender encryption key length, in bytes. 1570Only can be set to 0, 16, 24 and 32. 1571Enable sender encryption if not 0. 1572Not required on receiver (set to 0), 1573key size obtained from sender in HaiCrypt handshake. 1574Default value is 0. 1575 1576@item rcvlatency=@var{microseconds} 1577The time that should elapse since the moment when the 1578packet was sent and the moment when it's delivered to 1579the receiver application in the receiving function. 1580This time should be a buffer time large enough to cover 1581the time spent for sending, unexpectedly extended RTT 1582time, and the time needed to retransmit the lost UDP 1583packet. The effective latency value will be the maximum 1584of this options' value and the value of @option{peerlatency} 1585set by the peer side. Before version 1.3.0 this option 1586is only available as @option{latency}. 1587 1588@item recv_buffer_size=@var{bytes} 1589Set UDP receive buffer size, expressed in bytes. 1590 1591@item send_buffer_size=@var{bytes} 1592Set UDP send buffer size, expressed in bytes. 1593 1594@item timeout=@var{microseconds} 1595Set raise error timeouts for read, write and connect operations. Note that the 1596SRT library has internal timeouts which can be controlled separately, the 1597value set here is only a cap on those. 1598 1599@item tlpktdrop=@var{1|0} 1600Too-late Packet Drop. When enabled on receiver, it skips 1601missing packets that have not been delivered in time and 1602delivers the following packets to the application when 1603their time-to-play has come. It also sends a fake ACK to 1604the sender. When enabled on sender and enabled on the 1605receiving peer, the sender drops the older packets that 1606have no chance of being delivered in time. It was 1607automatically enabled in the sender if the receiver 1608supports it. 1609 1610@item sndbuf=@var{bytes} 1611Set send buffer size, expressed in bytes. 1612 1613@item rcvbuf=@var{bytes} 1614Set receive buffer size, expressed in bytes. 1615 1616Receive buffer must not be greater than @option{ffs}. 1617 1618@item lossmaxttl=@var{packets} 1619The value up to which the Reorder Tolerance may grow. When 1620Reorder Tolerance is > 0, then packet loss report is delayed 1621until that number of packets come in. Reorder Tolerance 1622increases every time a "belated" packet has come, but it 1623wasn't due to retransmission (that is, when UDP packets tend 1624to come out of order), with the difference between the latest 1625sequence and this packet's sequence, and not more than the 1626value of this option. By default it's 0, which means that this 1627mechanism is turned off, and the loss report is always sent 1628immediately upon experiencing a "gap" in sequences. 1629 1630@item minversion 1631The minimum SRT version that is required from the peer. A connection 1632to a peer that does not satisfy the minimum version requirement 1633will be rejected. 1634 1635The version format in hex is 0xXXYYZZ for x.y.z in human readable 1636form. 1637 1638@item streamid=@var{string} 1639A string limited to 512 characters that can be set on the socket prior 1640to connecting. This stream ID will be able to be retrieved by the 1641listener side from the socket that is returned from srt_accept and 1642was connected by a socket with that set stream ID. SRT does not enforce 1643any special interpretation of the contents of this string. 1644This option doesn’t make sense in Rendezvous connection; the result 1645might be that simply one side will override the value from the other 1646side and it’s the matter of luck which one would win 1647 1648@item srt_streamid=@var{string} 1649Alias for @samp{streamid} to avoid conflict with ffmpeg command line option. 1650 1651@item smoother=@var{live|file} 1652The type of Smoother used for the transmission for that socket, which 1653is responsible for the transmission and congestion control. The Smoother 1654type must be exactly the same on both connecting parties, otherwise 1655the connection is rejected. 1656 1657@item messageapi=@var{1|0} 1658When set, this socket uses the Message API, otherwise it uses Buffer 1659API. Note that in live mode (see @option{transtype}) there’s only 1660message API available. In File mode you can chose to use one of two modes: 1661 1662Stream API (default, when this option is false). In this mode you may 1663send as many data as you wish with one sending instruction, or even use 1664dedicated functions that read directly from a file. The internal facility 1665will take care of any speed and congestion control. When receiving, you 1666can also receive as many data as desired, the data not extracted will be 1667waiting for the next call. There is no boundary between data portions in 1668the Stream mode. 1669 1670Message API. In this mode your single sending instruction passes exactly 1671one piece of data that has boundaries (a message). Contrary to Live mode, 1672this message may span across multiple UDP packets and the only size 1673limitation is that it shall fit as a whole in the sending buffer. The 1674receiver shall use as large buffer as necessary to receive the message, 1675otherwise the message will not be given up. When the message is not 1676complete (not all packets received or there was a packet loss) it will 1677not be given up. 1678 1679@item transtype=@var{live|file} 1680Sets the transmission type for the socket, in particular, setting this 1681option sets multiple other parameters to their default values as required 1682for a particular transmission type. 1683 1684live: Set options as for live transmission. In this mode, you should 1685send by one sending instruction only so many data that fit in one UDP packet, 1686and limited to the value defined first in @option{payload_size} (1316 is 1687default in this mode). There is no speed control in this mode, only the 1688bandwidth control, if configured, in order to not exceed the bandwidth with 1689the overhead transmission (retransmitted and control packets). 1690 1691file: Set options as for non-live transmission. See @option{messageapi} 1692for further explanations 1693 1694@item linger=@var{seconds} 1695The number of seconds that the socket waits for unsent data when closing. 1696Default is -1. -1 means auto (off with 0 seconds in live mode, on with 180 1697seconds in file mode). The range for this option is integers in the 16980 - @code{INT_MAX}. 1699 1700@item tsbpd=@var{1|0} 1701When true, use Timestamp-based Packet Delivery mode. The default behavior 1702depends on the transmission type: enabled in live mode, disabled in file 1703mode. 1704 1705@end table 1706 1707For more information see: @url{https://github.com/Haivision/srt}. 1708 1709@section srtp 1710 1711Secure Real-time Transport Protocol. 1712 1713The accepted options are: 1714@table @option 1715@item srtp_in_suite 1716@item srtp_out_suite 1717Select input and output encoding suites. 1718 1719Supported values: 1720@table @samp 1721@item AES_CM_128_HMAC_SHA1_80 1722@item SRTP_AES128_CM_HMAC_SHA1_80 1723@item AES_CM_128_HMAC_SHA1_32 1724@item SRTP_AES128_CM_HMAC_SHA1_32 1725@end table 1726 1727@item srtp_in_params 1728@item srtp_out_params 1729Set input and output encoding parameters, which are expressed by a 1730base64-encoded representation of a binary block. The first 16 bytes of 1731this binary block are used as master key, the following 14 bytes are 1732used as master salt. 1733@end table 1734 1735@section subfile 1736 1737Virtually extract a segment of a file or another stream. 1738The underlying stream must be seekable. 1739 1740Accepted options: 1741@table @option 1742@item start 1743Start offset of the extracted segment, in bytes. 1744@item end 1745End offset of the extracted segment, in bytes. 1746If set to 0, extract till end of file. 1747@end table 1748 1749Examples: 1750 1751Extract a chapter from a DVD VOB file (start and end sectors obtained 1752externally and multiplied by 2048): 1753@example 1754subfile,,start,153391104,end,268142592,,:/media/dvd/VIDEO_TS/VTS_08_1.VOB 1755@end example 1756 1757Play an AVI file directly from a TAR archive: 1758@example 1759subfile,,start,183241728,end,366490624,,:archive.tar 1760@end example 1761 1762Play a MPEG-TS file from start offset till end: 1763@example 1764subfile,,start,32815239,end,0,,:video.ts 1765@end example 1766 1767@section tee 1768 1769Writes the output to multiple protocols. The individual outputs are separated 1770by | 1771 1772@example 1773tee:file://path/to/local/this.avi|file://path/to/local/that.avi 1774@end example 1775 1776@section tcp 1777 1778Transmission Control Protocol. 1779 1780The required syntax for a TCP url is: 1781@example 1782tcp://@var{hostname}:@var{port}[?@var{options}] 1783@end example 1784 1785@var{options} contains a list of &-separated options of the form 1786@var{key}=@var{val}. 1787 1788The list of supported options follows. 1789 1790@table @option 1791@item listen=@var{2|1|0} 1792Listen for an incoming connection. 0 disables listen, 1 enables listen in 1793single client mode, 2 enables listen in multi-client mode. Default value is 0. 1794 1795@item timeout=@var{microseconds} 1796Set raise error timeout, expressed in microseconds. 1797 1798This option is only relevant in read mode: if no data arrived in more 1799than this time interval, raise error. 1800 1801@item listen_timeout=@var{milliseconds} 1802Set listen timeout, expressed in milliseconds. 1803 1804@item recv_buffer_size=@var{bytes} 1805Set receive buffer size, expressed bytes. 1806 1807@item send_buffer_size=@var{bytes} 1808Set send buffer size, expressed bytes. 1809 1810@item tcp_nodelay=@var{1|0} 1811Set TCP_NODELAY to disable Nagle's algorithm. Default value is 0. 1812 1813@emph{Remark: Writing to the socket is currently not optimized to minimize system calls and reduces the efficiency / effect of TCP_NODELAY.} 1814 1815@item tcp_mss=@var{bytes} 1816Set maximum segment size for outgoing TCP packets, expressed in bytes. 1817@end table 1818 1819The following example shows how to setup a listening TCP connection 1820with @command{ffmpeg}, which is then accessed with @command{ffplay}: 1821@example 1822ffmpeg -i @var{input} -f @var{format} tcp://@var{hostname}:@var{port}?listen 1823ffplay tcp://@var{hostname}:@var{port} 1824@end example 1825 1826@section tls 1827 1828Transport Layer Security (TLS) / Secure Sockets Layer (SSL) 1829 1830The required syntax for a TLS/SSL url is: 1831@example 1832tls://@var{hostname}:@var{port}[?@var{options}] 1833@end example 1834 1835The following parameters can be set via command line options 1836(or in code via @code{AVOption}s): 1837 1838@table @option 1839 1840@item ca_file, cafile=@var{filename} 1841A file containing certificate authority (CA) root certificates to treat 1842as trusted. If the linked TLS library contains a default this might not 1843need to be specified for verification to work, but not all libraries and 1844setups have defaults built in. 1845The file must be in OpenSSL PEM format. 1846 1847@item tls_verify=@var{1|0} 1848If enabled, try to verify the peer that we are communicating with. 1849Note, if using OpenSSL, this currently only makes sure that the 1850peer certificate is signed by one of the root certificates in the CA 1851database, but it does not validate that the certificate actually 1852matches the host name we are trying to connect to. (With other backends, 1853the host name is validated as well.) 1854 1855This is disabled by default since it requires a CA database to be 1856provided by the caller in many cases. 1857 1858@item cert_file, cert=@var{filename} 1859A file containing a certificate to use in the handshake with the peer. 1860(When operating as server, in listen mode, this is more often required 1861by the peer, while client certificates only are mandated in certain 1862setups.) 1863 1864@item key_file, key=@var{filename} 1865A file containing the private key for the certificate. 1866 1867@item listen=@var{1|0} 1868If enabled, listen for connections on the provided port, and assume 1869the server role in the handshake instead of the client role. 1870 1871@item http_proxy 1872The HTTP proxy to tunnel through, e.g. @code{http://example.com:1234}. 1873The proxy must support the CONNECT method. 1874 1875@end table 1876 1877Example command lines: 1878 1879To create a TLS/SSL server that serves an input stream. 1880 1881@example 1882ffmpeg -i @var{input} -f @var{format} tls://@var{hostname}:@var{port}?listen&cert=@var{server.crt}&key=@var{server.key} 1883@end example 1884 1885To play back a stream from the TLS/SSL server using @command{ffplay}: 1886 1887@example 1888ffplay tls://@var{hostname}:@var{port} 1889@end example 1890 1891@section udp 1892 1893User Datagram Protocol. 1894 1895The required syntax for an UDP URL is: 1896@example 1897udp://@var{hostname}:@var{port}[?@var{options}] 1898@end example 1899 1900@var{options} contains a list of &-separated options of the form @var{key}=@var{val}. 1901 1902In case threading is enabled on the system, a circular buffer is used 1903to store the incoming data, which allows one to reduce loss of data due to 1904UDP socket buffer overruns. The @var{fifo_size} and 1905@var{overrun_nonfatal} options are related to this buffer. 1906 1907The list of supported options follows. 1908 1909@table @option 1910@item buffer_size=@var{size} 1911Set the UDP maximum socket buffer size in bytes. This is used to set either 1912the receive or send buffer size, depending on what the socket is used for. 1913Default is 32 KB for output, 384 KB for input. See also @var{fifo_size}. 1914 1915@item bitrate=@var{bitrate} 1916If set to nonzero, the output will have the specified constant bitrate if the 1917input has enough packets to sustain it. 1918 1919@item burst_bits=@var{bits} 1920When using @var{bitrate} this specifies the maximum number of bits in 1921packet bursts. 1922 1923@item localport=@var{port} 1924Override the local UDP port to bind with. 1925 1926@item localaddr=@var{addr} 1927Local IP address of a network interface used for sending packets or joining 1928multicast groups. 1929 1930@item pkt_size=@var{size} 1931Set the size in bytes of UDP packets. 1932 1933@item reuse=@var{1|0} 1934Explicitly allow or disallow reusing UDP sockets. 1935 1936@item ttl=@var{ttl} 1937Set the time to live value (for multicast only). 1938 1939@item connect=@var{1|0} 1940Initialize the UDP socket with @code{connect()}. In this case, the 1941destination address can't be changed with ff_udp_set_remote_url later. 1942If the destination address isn't known at the start, this option can 1943be specified in ff_udp_set_remote_url, too. 1944This allows finding out the source address for the packets with getsockname, 1945and makes writes return with AVERROR(ECONNREFUSED) if "destination 1946unreachable" is received. 1947For receiving, this gives the benefit of only receiving packets from 1948the specified peer address/port. 1949 1950@item sources=@var{address}[,@var{address}] 1951Only receive packets sent from the specified addresses. In case of multicast, 1952also subscribe to multicast traffic coming from these addresses only. 1953 1954@item block=@var{address}[,@var{address}] 1955Ignore packets sent from the specified addresses. In case of multicast, also 1956exclude the source addresses in the multicast subscription. 1957 1958@item fifo_size=@var{units} 1959Set the UDP receiving circular buffer size, expressed as a number of 1960packets with size of 188 bytes. If not specified defaults to 7*4096. 1961 1962@item overrun_nonfatal=@var{1|0} 1963Survive in case of UDP receiving circular buffer overrun. Default 1964value is 0. 1965 1966@item timeout=@var{microseconds} 1967Set raise error timeout, expressed in microseconds. 1968 1969This option is only relevant in read mode: if no data arrived in more 1970than this time interval, raise error. 1971 1972@item broadcast=@var{1|0} 1973Explicitly allow or disallow UDP broadcasting. 1974 1975Note that broadcasting may not work properly on networks having 1976a broadcast storm protection. 1977@end table 1978 1979@subsection Examples 1980 1981@itemize 1982@item 1983Use @command{ffmpeg} to stream over UDP to a remote endpoint: 1984@example 1985ffmpeg -i @var{input} -f @var{format} udp://@var{hostname}:@var{port} 1986@end example 1987 1988@item 1989Use @command{ffmpeg} to stream in mpegts format over UDP using 188 1990sized UDP packets, using a large input buffer: 1991@example 1992ffmpeg -i @var{input} -f mpegts udp://@var{hostname}:@var{port}?pkt_size=188&buffer_size=65535 1993@end example 1994 1995@item 1996Use @command{ffmpeg} to receive over UDP from a remote endpoint: 1997@example 1998ffmpeg -i udp://[@var{multicast-address}]:@var{port} ... 1999@end example 2000@end itemize 2001 2002@section unix 2003 2004Unix local socket 2005 2006The required syntax for a Unix socket URL is: 2007 2008@example 2009unix://@var{filepath} 2010@end example 2011 2012The following parameters can be set via command line options 2013(or in code via @code{AVOption}s): 2014 2015@table @option 2016@item timeout 2017Timeout in ms. 2018@item listen 2019Create the Unix socket in listening mode. 2020@end table 2021 2022@section zmq 2023 2024ZeroMQ asynchronous messaging using the libzmq library. 2025 2026This library supports unicast streaming to multiple clients without relying on 2027an external server. 2028 2029The required syntax for streaming or connecting to a stream is: 2030@example 2031zmq:tcp://ip-address:port 2032@end example 2033 2034Example: 2035Create a localhost stream on port 5555: 2036@example 2037ffmpeg -re -i input -f mpegts zmq:tcp://127.0.0.1:5555 2038@end example 2039 2040Multiple clients may connect to the stream using: 2041@example 2042ffplay zmq:tcp://127.0.0.1:5555 2043@end example 2044 2045Streaming to multiple clients is implemented using a ZeroMQ Pub-Sub pattern. 2046The server side binds to a port and publishes data. Clients connect to the 2047server (via IP address/port) and subscribe to the stream. The order in which 2048the server and client start generally does not matter. 2049 2050ffmpeg must be compiled with the --enable-libzmq option to support 2051this protocol. 2052 2053Options can be set on the @command{ffmpeg}/@command{ffplay} command 2054line. The following options are supported: 2055 2056@table @option 2057 2058@item pkt_size 2059Forces the maximum packet size for sending/receiving data. The default value is 2060131,072 bytes. On the server side, this sets the maximum size of sent packets 2061via ZeroMQ. On the clients, it sets an internal buffer size for receiving 2062packets. Note that pkt_size on the clients should be equal to or greater than 2063pkt_size on the server. Otherwise the received message may be truncated causing 2064decoding errors. 2065 2066@end table 2067 2068@c man end PROTOCOLS 2069