You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1977 lines
60KB

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