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.

1719 lines
51KB

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