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.

1813 lines
54KB

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