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.

1448 lines
40KB

  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. @end table
  141. @section ftp
  142. FTP (File Transfer Protocol).
  143. Read from or write to remote resources using FTP protocol.
  144. Following syntax is required.
  145. @example
  146. ftp://[user[:password]@@]server[:port]/path/to/remote/resource.mpeg
  147. @end example
  148. This protocol accepts the following options.
  149. @table @option
  150. @item timeout
  151. Set timeout in microseconds of socket I/O operations used by the underlying low level
  152. operation. By default it is set to -1, which means that the timeout is
  153. not specified.
  154. @item ftp-anonymous-password
  155. Password used when login as anonymous user. Typically an e-mail address
  156. should be used.
  157. @item ftp-write-seekable
  158. Control seekability of connection during encoding. If set to 1 the
  159. resource is supposed to be seekable, if set to 0 it is assumed not
  160. to be seekable. Default value is 0.
  161. @end table
  162. NOTE: Protocol can be used as output, but it is recommended to not do
  163. it, unless special care is taken (tests, customized server configuration
  164. etc.). Different FTP servers behave in different way during seek
  165. operation. ff* tools may produce incomplete content due to server limitations.
  166. This protocol accepts the following options:
  167. @table @option
  168. @item follow
  169. If set to 1, the protocol will retry reading at the end of the file, allowing
  170. reading files that still are being written. In order for this to terminate,
  171. you either need to use the rw_timeout option, or use the interrupt callback
  172. (for API users).
  173. @end table
  174. @section gopher
  175. Gopher protocol.
  176. @section hls
  177. Read Apple HTTP Live Streaming compliant segmented stream as
  178. a uniform one. The M3U8 playlists describing the segments can be
  179. remote HTTP resources or local files, accessed using the standard
  180. file protocol.
  181. The nested protocol is declared by specifying
  182. "+@var{proto}" after the hls URI scheme name, where @var{proto}
  183. is either "file" or "http".
  184. @example
  185. hls+http://host/path/to/remote/resource.m3u8
  186. hls+file://path/to/local/resource.m3u8
  187. @end example
  188. Using this protocol is discouraged - the hls demuxer should work
  189. just as well (if not, please report the issues) and is more complete.
  190. To use the hls demuxer instead, simply use the direct URLs to the
  191. m3u8 files.
  192. @section http
  193. HTTP (Hyper Text Transfer Protocol).
  194. This protocol accepts the following options:
  195. @table @option
  196. @item seekable
  197. Control seekability of connection. If set to 1 the resource is
  198. supposed to be seekable, if set to 0 it is assumed not to be seekable,
  199. if set to -1 it will try to autodetect if it is seekable. Default
  200. value is -1.
  201. @item chunked_post
  202. If set to 1 use chunked Transfer-Encoding for posts, default is 1.
  203. @item content_type
  204. Set a specific content type for the POST messages or for listen mode.
  205. @item http_proxy
  206. set HTTP proxy to tunnel through e.g. http://example.com:1234
  207. @item headers
  208. Set custom HTTP headers, can override built in default headers. The
  209. value must be a string encoding the headers.
  210. @item multiple_requests
  211. Use persistent connections if set to 1, default is 0.
  212. @item post_data
  213. Set custom HTTP post data.
  214. @item user_agent
  215. Override the User-Agent header. If not specified the protocol will use a
  216. string describing the libavformat build. ("Lavf/<version>")
  217. @item user-agent
  218. This is a deprecated option, you can use user_agent instead it.
  219. @item timeout
  220. Set timeout in microseconds of socket I/O operations used by the underlying low level
  221. operation. By default it is set to -1, which means that the timeout is
  222. not specified.
  223. @item reconnect_at_eof
  224. If set then eof is treated like an error and causes reconnection, this is useful
  225. for live / endless streams.
  226. @item reconnect_streamed
  227. If set then even streamed/non seekable streams will be reconnected on errors.
  228. @item reconnect_delay_max
  229. Sets the maximum delay in seconds after which to give up reconnecting
  230. @item mime_type
  231. Export the MIME type.
  232. @item icy
  233. If set to 1 request ICY (SHOUTcast) metadata from the server. If the server
  234. supports this, the metadata has to be retrieved by the application by reading
  235. the @option{icy_metadata_headers} and @option{icy_metadata_packet} options.
  236. The default is 1.
  237. @item icy_metadata_headers
  238. If the server supports ICY metadata, this contains the ICY-specific HTTP reply
  239. headers, separated by newline characters.
  240. @item icy_metadata_packet
  241. If the server supports ICY metadata, and @option{icy} was set to 1, this
  242. contains the last non-empty metadata packet sent by the server. It should be
  243. polled in regular intervals by applications interested in mid-stream metadata
  244. updates.
  245. @item cookies
  246. Set the cookies to be sent in future requests. The format of each cookie is the
  247. same as the value of a Set-Cookie HTTP response field. Multiple cookies can be
  248. delimited by a newline character.
  249. @item offset
  250. Set initial byte offset.
  251. @item end_offset
  252. Try to limit the request to bytes preceding this offset.
  253. @item method
  254. When used as a client option it sets the HTTP method for the request.
  255. When used as a server option it sets the HTTP method that is going to be
  256. expected from the client(s).
  257. If the expected and the received HTTP method do not match the client will
  258. be given a Bad Request response.
  259. When unset the HTTP method is not checked for now. This will be replaced by
  260. autodetection in the future.
  261. @item listen
  262. If set to 1 enables experimental HTTP server. This can be used to send data when
  263. used as an output option, or read data from a client with HTTP POST when used as
  264. an input option.
  265. If set to 2 enables experimental multi-client HTTP server. This is not yet implemented
  266. in ffmpeg.c or ffserver.c and thus must not be used as a command line option.
  267. @example
  268. # Server side (sending):
  269. ffmpeg -i somefile.ogg -c copy -listen 1 -f ogg http://@var{server}:@var{port}
  270. # Client side (receiving):
  271. ffmpeg -i http://@var{server}:@var{port} -c copy somefile.ogg
  272. # Client can also be done with wget:
  273. wget http://@var{server}:@var{port} -O somefile.ogg
  274. # Server side (receiving):
  275. ffmpeg -listen 1 -i http://@var{server}:@var{port} -c copy somefile.ogg
  276. # Client side (sending):
  277. ffmpeg -i somefile.ogg -chunked_post 0 -c copy -f ogg http://@var{server}:@var{port}
  278. # Client can also be done with wget:
  279. wget --post-file=somefile.ogg http://@var{server}:@var{port}
  280. @end example
  281. @end table
  282. @subsection HTTP Cookies
  283. Some HTTP requests will be denied unless cookie values are passed in with the
  284. request. The @option{cookies} option allows these cookies to be specified. At
  285. the very least, each cookie must specify a value along with a path and domain.
  286. HTTP requests that match both the domain and path will automatically include the
  287. cookie value in the HTTP Cookie header field. Multiple cookies can be delimited
  288. by a newline.
  289. The required syntax to play a stream specifying a cookie is:
  290. @example
  291. ffplay -cookies "nlqptid=nltid=tsn; path=/; domain=somedomain.com;" http://somedomain.com/somestream.m3u8
  292. @end example
  293. @section Icecast
  294. Icecast protocol (stream to Icecast servers)
  295. This protocol accepts the following options:
  296. @table @option
  297. @item ice_genre
  298. Set the stream genre.
  299. @item ice_name
  300. Set the stream name.
  301. @item ice_description
  302. Set the stream description.
  303. @item ice_url
  304. Set the stream website URL.
  305. @item ice_public
  306. Set if the stream should be public.
  307. The default is 0 (not public).
  308. @item user_agent
  309. Override the User-Agent header. If not specified a string of the form
  310. "Lavf/<version>" will be used.
  311. @item password
  312. Set the Icecast mountpoint password.
  313. @item content_type
  314. Set the stream content type. This must be set if it is different from
  315. audio/mpeg.
  316. @item legacy_icecast
  317. This enables support for Icecast versions < 2.4.0, that do not support the
  318. HTTP PUT method but the SOURCE method.
  319. @end table
  320. @example
  321. icecast://[@var{username}[:@var{password}]@@]@var{server}:@var{port}/@var{mountpoint}
  322. @end example
  323. @section mmst
  324. MMS (Microsoft Media Server) protocol over TCP.
  325. @section mmsh
  326. MMS (Microsoft Media Server) protocol over HTTP.
  327. The required syntax is:
  328. @example
  329. mmsh://@var{server}[:@var{port}][/@var{app}][/@var{playpath}]
  330. @end example
  331. @section md5
  332. MD5 output protocol.
  333. Computes the MD5 hash of the data to be written, and on close writes
  334. this to the designated output or stdout if none is specified. It can
  335. be used to test muxers without writing an actual file.
  336. Some examples follow.
  337. @example
  338. # Write the MD5 hash of the encoded AVI file to the file output.avi.md5.
  339. ffmpeg -i input.flv -f avi -y md5:output.avi.md5
  340. # Write the MD5 hash of the encoded AVI file to stdout.
  341. ffmpeg -i input.flv -f avi -y md5:
  342. @end example
  343. Note that some formats (typically MOV) require the output protocol to
  344. be seekable, so they will fail with the MD5 output protocol.
  345. @section pipe
  346. UNIX pipe access protocol.
  347. Read and write from UNIX pipes.
  348. The accepted syntax is:
  349. @example
  350. pipe:[@var{number}]
  351. @end example
  352. @var{number} is the number corresponding to the file descriptor of the
  353. pipe (e.g. 0 for stdin, 1 for stdout, 2 for stderr). If @var{number}
  354. is not specified, by default the stdout file descriptor will be used
  355. for writing, stdin for reading.
  356. For example to read from stdin with @command{ffmpeg}:
  357. @example
  358. cat test.wav | ffmpeg -i pipe:0
  359. # ...this is the same as...
  360. cat test.wav | ffmpeg -i pipe:
  361. @end example
  362. For writing to stdout with @command{ffmpeg}:
  363. @example
  364. ffmpeg -i test.wav -f avi pipe:1 | cat > test.avi
  365. # ...this is the same as...
  366. ffmpeg -i test.wav -f avi pipe: | cat > test.avi
  367. @end example
  368. This protocol accepts the following options:
  369. @table @option
  370. @item blocksize
  371. Set I/O operation maximum block size, in bytes. Default value is
  372. @code{INT_MAX}, which results in not limiting the requested block size.
  373. Setting this value reasonably low improves user termination request reaction
  374. time, which is valuable if data transmission is slow.
  375. @end table
  376. Note that some formats (typically MOV), require the output protocol to
  377. be seekable, so they will fail with the pipe output protocol.
  378. @section prompeg
  379. Pro-MPEG Code of Practice #3 Release 2 FEC protocol.
  380. The Pro-MPEG CoP#3 FEC is a 2D parity-check forward error correction mechanism
  381. for MPEG-2 Transport Streams sent over RTP.
  382. This protocol must be used in conjunction with the @code{rtp_mpegts} muxer and
  383. the @code{rtp} protocol.
  384. The required syntax is:
  385. @example
  386. -f rtp_mpegts -fec prompeg=@var{option}=@var{val}... rtp://@var{hostname}:@var{port}
  387. @end example
  388. The destination UDP ports are @code{port + 2} for the column FEC stream
  389. and @code{port + 4} for the row FEC stream.
  390. This protocol accepts the following options:
  391. @table @option
  392. @item l=@var{n}
  393. The number of columns (4-20, LxD <= 100)
  394. @item d=@var{n}
  395. The number of rows (4-20, LxD <= 100)
  396. @end table
  397. Example usage:
  398. @example
  399. -f rtp_mpegts -fec prompeg=l=8:d=4 rtp://@var{hostname}:@var{port}
  400. @end example
  401. @section rtmp
  402. Real-Time Messaging Protocol.
  403. The Real-Time Messaging Protocol (RTMP) is used for streaming multimedia
  404. content across a TCP/IP network.
  405. The required syntax is:
  406. @example
  407. rtmp://[@var{username}:@var{password}@@]@var{server}[:@var{port}][/@var{app}][/@var{instance}][/@var{playpath}]
  408. @end example
  409. The accepted parameters are:
  410. @table @option
  411. @item username
  412. An optional username (mostly for publishing).
  413. @item password
  414. An optional password (mostly for publishing).
  415. @item server
  416. The address of the RTMP server.
  417. @item port
  418. The number of the TCP port to use (by default is 1935).
  419. @item app
  420. It is the name of the application to access. It usually corresponds to
  421. the path where the application is installed on the RTMP server
  422. (e.g. @file{/ondemand/}, @file{/flash/live/}, etc.). You can override
  423. the value parsed from the URI through the @code{rtmp_app} option, too.
  424. @item playpath
  425. It is the path or name of the resource to play with reference to the
  426. application specified in @var{app}, may be prefixed by "mp4:". You
  427. can override the value parsed from the URI through the @code{rtmp_playpath}
  428. option, too.
  429. @item listen
  430. Act as a server, listening for an incoming connection.
  431. @item timeout
  432. Maximum time to wait for the incoming connection. Implies listen.
  433. @end table
  434. Additionally, the following parameters can be set via command line options
  435. (or in code via @code{AVOption}s):
  436. @table @option
  437. @item rtmp_app
  438. Name of application to connect on the RTMP server. This option
  439. overrides the parameter specified in the URI.
  440. @item rtmp_buffer
  441. Set the client buffer time in milliseconds. The default is 3000.
  442. @item rtmp_conn
  443. Extra arbitrary AMF connection parameters, parsed from a string,
  444. e.g. like @code{B:1 S:authMe O:1 NN:code:1.23 NS:flag:ok O:0}.
  445. Each value is prefixed by a single character denoting the type,
  446. B for Boolean, N for number, S for string, O for object, or Z for null,
  447. followed by a colon. For Booleans the data must be either 0 or 1 for
  448. FALSE or TRUE, respectively. Likewise for Objects the data must be 0 or
  449. 1 to end or begin an object, respectively. Data items in subobjects may
  450. be named, by prefixing the type with 'N' and specifying the name before
  451. the value (i.e. @code{NB:myFlag:1}). This option may be used multiple
  452. times to construct arbitrary AMF sequences.
  453. @item rtmp_flashver
  454. Version of the Flash plugin used to run the SWF player. The default
  455. is LNX 9,0,124,2. (When publishing, the default is FMLE/3.0 (compatible;
  456. <libavformat version>).)
  457. @item rtmp_flush_interval
  458. Number of packets flushed in the same request (RTMPT only). The default
  459. is 10.
  460. @item rtmp_live
  461. Specify that the media is a live stream. No resuming or seeking in
  462. live streams is possible. The default value is @code{any}, which means the
  463. subscriber first tries to play the live stream specified in the
  464. playpath. If a live stream of that name is not found, it plays the
  465. recorded stream. The other possible values are @code{live} and
  466. @code{recorded}.
  467. @item rtmp_pageurl
  468. URL of the web page in which the media was embedded. By default no
  469. value will be sent.
  470. @item rtmp_playpath
  471. Stream identifier to play or to publish. This option overrides the
  472. parameter specified in the URI.
  473. @item rtmp_subscribe
  474. Name of live stream to subscribe to. By default no value will be sent.
  475. It is only sent if the option is specified or if rtmp_live
  476. is set to live.
  477. @item rtmp_swfhash
  478. SHA256 hash of the decompressed SWF file (32 bytes).
  479. @item rtmp_swfsize
  480. Size of the decompressed SWF file, required for SWFVerification.
  481. @item rtmp_swfurl
  482. URL of the SWF player for the media. By default no value will be sent.
  483. @item rtmp_swfverify
  484. URL to player swf file, compute hash/size automatically.
  485. @item rtmp_tcurl
  486. URL of the target stream. Defaults to proto://host[:port]/app.
  487. @end table
  488. For example to read with @command{ffplay} a multimedia resource named
  489. "sample" from the application "vod" from an RTMP server "myserver":
  490. @example
  491. ffplay rtmp://myserver/vod/sample
  492. @end example
  493. To publish to a password protected server, passing the playpath and
  494. app names separately:
  495. @example
  496. ffmpeg -re -i <input> -f flv -rtmp_playpath some/long/path -rtmp_app long/app/name rtmp://username:password@@myserver/
  497. @end example
  498. @section rtmpe
  499. Encrypted Real-Time Messaging Protocol.
  500. The Encrypted Real-Time Messaging Protocol (RTMPE) is used for
  501. streaming multimedia content within standard cryptographic primitives,
  502. consisting of Diffie-Hellman key exchange and HMACSHA256, generating
  503. a pair of RC4 keys.
  504. @section rtmps
  505. Real-Time Messaging Protocol over a secure SSL connection.
  506. The Real-Time Messaging Protocol (RTMPS) is used for streaming
  507. multimedia content across an encrypted connection.
  508. @section rtmpt
  509. Real-Time Messaging Protocol tunneled through HTTP.
  510. The Real-Time Messaging Protocol tunneled through HTTP (RTMPT) is used
  511. for streaming multimedia content within HTTP requests to traverse
  512. firewalls.
  513. @section rtmpte
  514. Encrypted Real-Time Messaging Protocol tunneled through HTTP.
  515. The Encrypted Real-Time Messaging Protocol tunneled through HTTP (RTMPTE)
  516. is used for streaming multimedia content within HTTP requests to traverse
  517. firewalls.
  518. @section rtmpts
  519. Real-Time Messaging Protocol tunneled through HTTPS.
  520. The Real-Time Messaging Protocol tunneled through HTTPS (RTMPTS) is used
  521. for streaming multimedia content within HTTPS requests to traverse
  522. firewalls.
  523. @section libsmbclient
  524. libsmbclient permits one to manipulate CIFS/SMB network resources.
  525. Following syntax is required.
  526. @example
  527. smb://[[domain:]user[:password@@]]server[/share[/path[/file]]]
  528. @end example
  529. This protocol accepts the following options.
  530. @table @option
  531. @item timeout
  532. Set timeout in milliseconds of socket I/O operations used by the underlying
  533. low level operation. By default it is set to -1, which means that the timeout
  534. is not specified.
  535. @item truncate
  536. Truncate existing files on write, if set to 1. A value of 0 prevents
  537. truncating. Default value is 1.
  538. @item workgroup
  539. Set the workgroup used for making connections. By default workgroup is not specified.
  540. @end table
  541. For more information see: @url{http://www.samba.org/}.
  542. @section libssh
  543. Secure File Transfer Protocol via libssh
  544. Read from or write to remote resources using SFTP protocol.
  545. Following syntax is required.
  546. @example
  547. sftp://[user[:password]@@]server[:port]/path/to/remote/resource.mpeg
  548. @end example
  549. This protocol accepts the following options.
  550. @table @option
  551. @item timeout
  552. Set timeout of socket I/O operations used by the underlying low level
  553. operation. By default it is set to -1, which means that the timeout
  554. is not specified.
  555. @item truncate
  556. Truncate existing files on write, if set to 1. A value of 0 prevents
  557. truncating. Default value is 1.
  558. @item private_key
  559. Specify the path of the file containing private key to use during authorization.
  560. By default libssh searches for keys in the @file{~/.ssh/} directory.
  561. @end table
  562. Example: Play a file stored on remote server.
  563. @example
  564. ffplay sftp://user:password@@server_address:22/home/user/resource.mpeg
  565. @end example
  566. @section librtmp rtmp, rtmpe, rtmps, rtmpt, rtmpte
  567. Real-Time Messaging Protocol and its variants supported through
  568. librtmp.
  569. Requires the presence of the librtmp headers and library during
  570. configuration. You need to explicitly configure the build with
  571. "--enable-librtmp". If enabled this will replace the native RTMP
  572. protocol.
  573. This protocol provides most client functions and a few server
  574. functions needed to support RTMP, RTMP tunneled in HTTP (RTMPT),
  575. encrypted RTMP (RTMPE), RTMP over SSL/TLS (RTMPS) and tunneled
  576. variants of these encrypted types (RTMPTE, RTMPTS).
  577. The required syntax is:
  578. @example
  579. @var{rtmp_proto}://@var{server}[:@var{port}][/@var{app}][/@var{playpath}] @var{options}
  580. @end example
  581. where @var{rtmp_proto} is one of the strings "rtmp", "rtmpt", "rtmpe",
  582. "rtmps", "rtmpte", "rtmpts" corresponding to each RTMP variant, and
  583. @var{server}, @var{port}, @var{app} and @var{playpath} have the same
  584. meaning as specified for the RTMP native protocol.
  585. @var{options} contains a list of space-separated options of the form
  586. @var{key}=@var{val}.
  587. See the librtmp manual page (man 3 librtmp) for more information.
  588. For example, to stream a file in real-time to an RTMP server using
  589. @command{ffmpeg}:
  590. @example
  591. ffmpeg -re -i myfile -f flv rtmp://myserver/live/mystream
  592. @end example
  593. To play the same stream using @command{ffplay}:
  594. @example
  595. ffplay "rtmp://myserver/live/mystream live=1"
  596. @end example
  597. @section rtp
  598. Real-time Transport Protocol.
  599. The required syntax for an RTP URL is:
  600. rtp://@var{hostname}[:@var{port}][?@var{option}=@var{val}...]
  601. @var{port} specifies the RTP port to use.
  602. The following URL options are supported:
  603. @table @option
  604. @item ttl=@var{n}
  605. Set the TTL (Time-To-Live) value (for multicast only).
  606. @item rtcpport=@var{n}
  607. Set the remote RTCP port to @var{n}.
  608. @item localrtpport=@var{n}
  609. Set the local RTP port to @var{n}.
  610. @item localrtcpport=@var{n}'
  611. Set the local RTCP port to @var{n}.
  612. @item pkt_size=@var{n}
  613. Set max packet size (in bytes) to @var{n}.
  614. @item connect=0|1
  615. Do a @code{connect()} on the UDP socket (if set to 1) or not (if set
  616. to 0).
  617. @item sources=@var{ip}[,@var{ip}]
  618. List allowed source IP addresses.
  619. @item block=@var{ip}[,@var{ip}]
  620. List disallowed (blocked) source IP addresses.
  621. @item write_to_source=0|1
  622. Send packets to the source address of the latest received packet (if
  623. set to 1) or to a default remote address (if set to 0).
  624. @item localport=@var{n}
  625. Set the local RTP port to @var{n}.
  626. This is a deprecated option. Instead, @option{localrtpport} should be
  627. used.
  628. @end table
  629. Important notes:
  630. @enumerate
  631. @item
  632. If @option{rtcpport} is not set the RTCP port will be set to the RTP
  633. port value plus 1.
  634. @item
  635. If @option{localrtpport} (the local RTP port) is not set any available
  636. port will be used for the local RTP and RTCP ports.
  637. @item
  638. If @option{localrtcpport} (the local RTCP port) is not set it will be
  639. set to the local RTP port value plus 1.
  640. @end enumerate
  641. @section rtsp
  642. Real-Time Streaming Protocol.
  643. RTSP is not technically a protocol handler in libavformat, it is a demuxer
  644. and muxer. The demuxer supports both normal RTSP (with data transferred
  645. over RTP; this is used by e.g. Apple and Microsoft) and Real-RTSP (with
  646. data transferred over RDT).
  647. The muxer can be used to send a stream using RTSP ANNOUNCE to a server
  648. supporting it (currently Darwin Streaming Server and Mischa Spiegelmock's
  649. @uref{https://github.com/revmischa/rtsp-server, RTSP server}).
  650. The required syntax for a RTSP url is:
  651. @example
  652. rtsp://@var{hostname}[:@var{port}]/@var{path}
  653. @end example
  654. Options can be set on the @command{ffmpeg}/@command{ffplay} command
  655. line, or set in code via @code{AVOption}s or in
  656. @code{avformat_open_input}.
  657. The following options are supported.
  658. @table @option
  659. @item initial_pause
  660. Do not start playing the stream immediately if set to 1. Default value
  661. is 0.
  662. @item rtsp_transport
  663. Set RTSP transport protocols.
  664. It accepts the following values:
  665. @table @samp
  666. @item udp
  667. Use UDP as lower transport protocol.
  668. @item tcp
  669. Use TCP (interleaving within the RTSP control channel) as lower
  670. transport protocol.
  671. @item udp_multicast
  672. Use UDP multicast as lower transport protocol.
  673. @item http
  674. Use HTTP tunneling as lower transport protocol, which is useful for
  675. passing proxies.
  676. @end table
  677. Multiple lower transport protocols may be specified, in that case they are
  678. tried one at a time (if the setup of one fails, the next one is tried).
  679. For the muxer, only the @samp{tcp} and @samp{udp} options are supported.
  680. @item rtsp_flags
  681. Set RTSP flags.
  682. The following values are accepted:
  683. @table @samp
  684. @item filter_src
  685. Accept packets only from negotiated peer address and port.
  686. @item listen
  687. Act as a server, listening for an incoming connection.
  688. @item prefer_tcp
  689. Try TCP for RTP transport first, if TCP is available as RTSP RTP transport.
  690. @end table
  691. Default value is @samp{none}.
  692. @item allowed_media_types
  693. Set media types to accept from the server.
  694. The following flags are accepted:
  695. @table @samp
  696. @item video
  697. @item audio
  698. @item data
  699. @end table
  700. By default it accepts all media types.
  701. @item min_port
  702. Set minimum local UDP port. Default value is 5000.
  703. @item max_port
  704. Set maximum local UDP port. Default value is 65000.
  705. @item timeout
  706. Set maximum timeout (in seconds) to wait for incoming connections.
  707. A value of -1 means infinite (default). This option implies the
  708. @option{rtsp_flags} set to @samp{listen}.
  709. @item reorder_queue_size
  710. Set number of packets to buffer for handling of reordered packets.
  711. @item stimeout
  712. Set socket TCP I/O timeout in microseconds.
  713. @item user-agent
  714. Override User-Agent header. If not specified, it defaults to the
  715. libavformat identifier string.
  716. @end table
  717. When receiving data over UDP, the demuxer tries to reorder received packets
  718. (since they may arrive out of order, or packets may get lost totally). This
  719. can be disabled by setting the maximum demuxing delay to zero (via
  720. the @code{max_delay} field of AVFormatContext).
  721. When watching multi-bitrate Real-RTSP streams with @command{ffplay}, the
  722. streams to display can be chosen with @code{-vst} @var{n} and
  723. @code{-ast} @var{n} for video and audio respectively, and can be switched
  724. on the fly by pressing @code{v} and @code{a}.
  725. @subsection Examples
  726. The following examples all make use of the @command{ffplay} and
  727. @command{ffmpeg} tools.
  728. @itemize
  729. @item
  730. Watch a stream over UDP, with a max reordering delay of 0.5 seconds:
  731. @example
  732. ffplay -max_delay 500000 -rtsp_transport udp rtsp://server/video.mp4
  733. @end example
  734. @item
  735. Watch a stream tunneled over HTTP:
  736. @example
  737. ffplay -rtsp_transport http rtsp://server/video.mp4
  738. @end example
  739. @item
  740. Send a stream in realtime to a RTSP server, for others to watch:
  741. @example
  742. ffmpeg -re -i @var{input} -f rtsp -muxdelay 0.1 rtsp://server/live.sdp
  743. @end example
  744. @item
  745. Receive a stream in realtime:
  746. @example
  747. ffmpeg -rtsp_flags listen -i rtsp://ownaddress/live.sdp @var{output}
  748. @end example
  749. @end itemize
  750. @section sap
  751. Session Announcement Protocol (RFC 2974). This is not technically a
  752. protocol handler in libavformat, it is a muxer and demuxer.
  753. It is used for signalling of RTP streams, by announcing the SDP for the
  754. streams regularly on a separate port.
  755. @subsection Muxer
  756. The syntax for a SAP url given to the muxer is:
  757. @example
  758. sap://@var{destination}[:@var{port}][?@var{options}]
  759. @end example
  760. The RTP packets are sent to @var{destination} on port @var{port},
  761. or to port 5004 if no port is specified.
  762. @var{options} is a @code{&}-separated list. The following options
  763. are supported:
  764. @table @option
  765. @item announce_addr=@var{address}
  766. Specify the destination IP address for sending the announcements to.
  767. If omitted, the announcements are sent to the commonly used SAP
  768. announcement multicast address 224.2.127.254 (sap.mcast.net), or
  769. ff0e::2:7ffe if @var{destination} is an IPv6 address.
  770. @item announce_port=@var{port}
  771. Specify the port to send the announcements on, defaults to
  772. 9875 if not specified.
  773. @item ttl=@var{ttl}
  774. Specify the time to live value for the announcements and RTP packets,
  775. defaults to 255.
  776. @item same_port=@var{0|1}
  777. If set to 1, send all RTP streams on the same port pair. If zero (the
  778. default), all streams are sent on unique ports, with each stream on a
  779. port 2 numbers higher than the previous.
  780. VLC/Live555 requires this to be set to 1, to be able to receive the stream.
  781. The RTP stack in libavformat for receiving requires all streams to be sent
  782. on unique ports.
  783. @end table
  784. Example command lines follow.
  785. To broadcast a stream on the local subnet, for watching in VLC:
  786. @example
  787. ffmpeg -re -i @var{input} -f sap sap://224.0.0.255?same_port=1
  788. @end example
  789. Similarly, for watching in @command{ffplay}:
  790. @example
  791. ffmpeg -re -i @var{input} -f sap sap://224.0.0.255
  792. @end example
  793. And for watching in @command{ffplay}, over IPv6:
  794. @example
  795. ffmpeg -re -i @var{input} -f sap sap://[ff0e::1:2:3:4]
  796. @end example
  797. @subsection Demuxer
  798. The syntax for a SAP url given to the demuxer is:
  799. @example
  800. sap://[@var{address}][:@var{port}]
  801. @end example
  802. @var{address} is the multicast address to listen for announcements on,
  803. if omitted, the default 224.2.127.254 (sap.mcast.net) is used. @var{port}
  804. is the port that is listened on, 9875 if omitted.
  805. The demuxers listens for announcements on the given address and port.
  806. Once an announcement is received, it tries to receive that particular stream.
  807. Example command lines follow.
  808. To play back the first stream announced on the normal SAP multicast address:
  809. @example
  810. ffplay sap://
  811. @end example
  812. To play back the first stream announced on one the default IPv6 SAP multicast address:
  813. @example
  814. ffplay sap://[ff0e::2:7ffe]
  815. @end example
  816. @section sctp
  817. Stream Control Transmission Protocol.
  818. The accepted URL syntax is:
  819. @example
  820. sctp://@var{host}:@var{port}[?@var{options}]
  821. @end example
  822. The protocol accepts the following options:
  823. @table @option
  824. @item listen
  825. If set to any value, listen for an incoming connection. Outgoing connection is done by default.
  826. @item max_streams
  827. Set the maximum number of streams. By default no limit is set.
  828. @end table
  829. @section srtp
  830. Secure Real-time Transport Protocol.
  831. The accepted options are:
  832. @table @option
  833. @item srtp_in_suite
  834. @item srtp_out_suite
  835. Select input and output encoding suites.
  836. Supported values:
  837. @table @samp
  838. @item AES_CM_128_HMAC_SHA1_80
  839. @item SRTP_AES128_CM_HMAC_SHA1_80
  840. @item AES_CM_128_HMAC_SHA1_32
  841. @item SRTP_AES128_CM_HMAC_SHA1_32
  842. @end table
  843. @item srtp_in_params
  844. @item srtp_out_params
  845. Set input and output encoding parameters, which are expressed by a
  846. base64-encoded representation of a binary block. The first 16 bytes of
  847. this binary block are used as master key, the following 14 bytes are
  848. used as master salt.
  849. @end table
  850. @section subfile
  851. Virtually extract a segment of a file or another stream.
  852. The underlying stream must be seekable.
  853. Accepted options:
  854. @table @option
  855. @item start
  856. Start offset of the extracted segment, in bytes.
  857. @item end
  858. End offset of the extracted segment, in bytes.
  859. @end table
  860. Examples:
  861. Extract a chapter from a DVD VOB file (start and end sectors obtained
  862. externally and multiplied by 2048):
  863. @example
  864. subfile,,start,153391104,end,268142592,,:/media/dvd/VIDEO_TS/VTS_08_1.VOB
  865. @end example
  866. Play an AVI file directly from a TAR archive:
  867. @example
  868. subfile,,start,183241728,end,366490624,,:archive.tar
  869. @end example
  870. @section tee
  871. Writes the output to multiple protocols. The individual outputs are separated
  872. by |
  873. @example
  874. tee:file://path/to/local/this.avi|file://path/to/local/that.avi
  875. @end example
  876. @section tcp
  877. Transmission Control Protocol.
  878. The required syntax for a TCP url is:
  879. @example
  880. tcp://@var{hostname}:@var{port}[?@var{options}]
  881. @end example
  882. @var{options} contains a list of &-separated options of the form
  883. @var{key}=@var{val}.
  884. The list of supported options follows.
  885. @table @option
  886. @item listen=@var{1|0}
  887. Listen for an incoming connection. Default value is 0.
  888. @item timeout=@var{microseconds}
  889. Set raise error timeout, expressed in microseconds.
  890. This option is only relevant in read mode: if no data arrived in more
  891. than this time interval, raise error.
  892. @item listen_timeout=@var{milliseconds}
  893. Set listen timeout, expressed in milliseconds.
  894. @item recv_buffer_size=@var{bytes}
  895. Set receive buffer size, expressed bytes.
  896. @item send_buffer_size=@var{bytes}
  897. Set send buffer size, expressed bytes.
  898. @end table
  899. The following example shows how to setup a listening TCP connection
  900. with @command{ffmpeg}, which is then accessed with @command{ffplay}:
  901. @example
  902. ffmpeg -i @var{input} -f @var{format} tcp://@var{hostname}:@var{port}?listen
  903. ffplay tcp://@var{hostname}:@var{port}
  904. @end example
  905. @section tls
  906. Transport Layer Security (TLS) / Secure Sockets Layer (SSL)
  907. The required syntax for a TLS/SSL url is:
  908. @example
  909. tls://@var{hostname}:@var{port}[?@var{options}]
  910. @end example
  911. The following parameters can be set via command line options
  912. (or in code via @code{AVOption}s):
  913. @table @option
  914. @item ca_file, cafile=@var{filename}
  915. A file containing certificate authority (CA) root certificates to treat
  916. as trusted. If the linked TLS library contains a default this might not
  917. need to be specified for verification to work, but not all libraries and
  918. setups have defaults built in.
  919. The file must be in OpenSSL PEM format.
  920. @item tls_verify=@var{1|0}
  921. If enabled, try to verify the peer that we are communicating with.
  922. Note, if using OpenSSL, this currently only makes sure that the
  923. peer certificate is signed by one of the root certificates in the CA
  924. database, but it does not validate that the certificate actually
  925. matches the host name we are trying to connect to. (With GnuTLS,
  926. the host name is validated as well.)
  927. This is disabled by default since it requires a CA database to be
  928. provided by the caller in many cases.
  929. @item cert_file, cert=@var{filename}
  930. A file containing a certificate to use in the handshake with the peer.
  931. (When operating as server, in listen mode, this is more often required
  932. by the peer, while client certificates only are mandated in certain
  933. setups.)
  934. @item key_file, key=@var{filename}
  935. A file containing the private key for the certificate.
  936. @item listen=@var{1|0}
  937. If enabled, listen for connections on the provided port, and assume
  938. the server role in the handshake instead of the client role.
  939. @end table
  940. Example command lines:
  941. To create a TLS/SSL server that serves an input stream.
  942. @example
  943. ffmpeg -i @var{input} -f @var{format} tls://@var{hostname}:@var{port}?listen&cert=@var{server.crt}&key=@var{server.key}
  944. @end example
  945. To play back a stream from the TLS/SSL server using @command{ffplay}:
  946. @example
  947. ffplay tls://@var{hostname}:@var{port}
  948. @end example
  949. @section udp
  950. User Datagram Protocol.
  951. The required syntax for an UDP URL is:
  952. @example
  953. udp://@var{hostname}:@var{port}[?@var{options}]
  954. @end example
  955. @var{options} contains a list of &-separated options of the form @var{key}=@var{val}.
  956. In case threading is enabled on the system, a circular buffer is used
  957. to store the incoming data, which allows one to reduce loss of data due to
  958. UDP socket buffer overruns. The @var{fifo_size} and
  959. @var{overrun_nonfatal} options are related to this buffer.
  960. The list of supported options follows.
  961. @table @option
  962. @item buffer_size=@var{size}
  963. Set the UDP maximum socket buffer size in bytes. This is used to set either
  964. the receive or send buffer size, depending on what the socket is used for.
  965. Default is 64KB. See also @var{fifo_size}.
  966. @item bitrate=@var{bitrate}
  967. If set to nonzero, the output will have the specified constant bitrate if the
  968. input has enough packets to sustain it.
  969. @item burst_bits=@var{bits}
  970. When using @var{bitrate} this specifies the maximum number of bits in
  971. packet bursts.
  972. @item localport=@var{port}
  973. Override the local UDP port to bind with.
  974. @item localaddr=@var{addr}
  975. Choose the local IP address. This is useful e.g. if sending multicast
  976. and the host has multiple interfaces, where the user can choose
  977. which interface to send on by specifying the IP address of that interface.
  978. @item pkt_size=@var{size}
  979. Set the size in bytes of UDP packets.
  980. @item reuse=@var{1|0}
  981. Explicitly allow or disallow reusing UDP sockets.
  982. @item ttl=@var{ttl}
  983. Set the time to live value (for multicast only).
  984. @item connect=@var{1|0}
  985. Initialize the UDP socket with @code{connect()}. In this case, the
  986. destination address can't be changed with ff_udp_set_remote_url later.
  987. If the destination address isn't known at the start, this option can
  988. be specified in ff_udp_set_remote_url, too.
  989. This allows finding out the source address for the packets with getsockname,
  990. and makes writes return with AVERROR(ECONNREFUSED) if "destination
  991. unreachable" is received.
  992. For receiving, this gives the benefit of only receiving packets from
  993. the specified peer address/port.
  994. @item sources=@var{address}[,@var{address}]
  995. Only receive packets sent to the multicast group from one of the
  996. specified sender IP addresses.
  997. @item block=@var{address}[,@var{address}]
  998. Ignore packets sent to the multicast group from the specified
  999. sender IP addresses.
  1000. @item fifo_size=@var{units}
  1001. Set the UDP receiving circular buffer size, expressed as a number of
  1002. packets with size of 188 bytes. If not specified defaults to 7*4096.
  1003. @item overrun_nonfatal=@var{1|0}
  1004. Survive in case of UDP receiving circular buffer overrun. Default
  1005. value is 0.
  1006. @item timeout=@var{microseconds}
  1007. Set raise error timeout, expressed in microseconds.
  1008. This option is only relevant in read mode: if no data arrived in more
  1009. than this time interval, raise error.
  1010. @item broadcast=@var{1|0}
  1011. Explicitly allow or disallow UDP broadcasting.
  1012. Note that broadcasting may not work properly on networks having
  1013. a broadcast storm protection.
  1014. @end table
  1015. @subsection Examples
  1016. @itemize
  1017. @item
  1018. Use @command{ffmpeg} to stream over UDP to a remote endpoint:
  1019. @example
  1020. ffmpeg -i @var{input} -f @var{format} udp://@var{hostname}:@var{port}
  1021. @end example
  1022. @item
  1023. Use @command{ffmpeg} to stream in mpegts format over UDP using 188
  1024. sized UDP packets, using a large input buffer:
  1025. @example
  1026. ffmpeg -i @var{input} -f mpegts udp://@var{hostname}:@var{port}?pkt_size=188&buffer_size=65535
  1027. @end example
  1028. @item
  1029. Use @command{ffmpeg} to receive over UDP from a remote endpoint:
  1030. @example
  1031. ffmpeg -i udp://[@var{multicast-address}]:@var{port} ...
  1032. @end example
  1033. @end itemize
  1034. @section unix
  1035. Unix local socket
  1036. The required syntax for a Unix socket URL is:
  1037. @example
  1038. unix://@var{filepath}
  1039. @end example
  1040. The following parameters can be set via command line options
  1041. (or in code via @code{AVOption}s):
  1042. @table @option
  1043. @item timeout
  1044. Timeout in ms.
  1045. @item listen
  1046. Create the Unix socket in listening mode.
  1047. @end table
  1048. @c man end PROTOCOLS