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.

1460 lines
41KB

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