Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | RSS feed

  1. =head1 NAME
  2.  
  3. ffmpeg-protocols - FFmpeg protocols
  4.  
  5. =head1 DESCRIPTION
  6.  
  7.  
  8. This document describes the input and output protocols provided by the
  9. libavformat library.
  10.  
  11.  
  12.  
  13. =head1 PROTOCOLS
  14.  
  15.  
  16. Protocols are configured elements in FFmpeg that enable access to
  17. resources that require specific protocols.
  18.  
  19. When you configure your FFmpeg build, all the supported protocols are
  20. enabled by default. You can list all available ones using the
  21. configure option "--list-protocols".
  22.  
  23. You can disable all the protocols using the configure option
  24. "--disable-protocols", and selectively enable a protocol using the
  25. option "--enable-protocol=I<PROTOCOL>", or you can disable a
  26. particular protocol using the option
  27. "--disable-protocol=I<PROTOCOL>".
  28.  
  29. The option "-protocols" of the ff* tools will display the list of
  30. supported protocols.
  31.  
  32. A description of the currently available protocols follows.
  33.  
  34.  
  35. =head2 bluray
  36.  
  37.  
  38. Read BluRay playlist.
  39.  
  40. The accepted options are:
  41.  
  42. =over 4
  43.  
  44.  
  45.  
  46. =item B<angle>
  47.  
  48. BluRay angle
  49.  
  50.  
  51. =item B<chapter>
  52.  
  53. Start chapter (1...N)
  54.  
  55.  
  56. =item B<playlist>
  57.  
  58. Playlist to read (BDMV/PLAYLIST/?????.mpls)
  59.  
  60.  
  61. =back
  62.  
  63.  
  64. Examples:
  65.  
  66. Read longest playlist from BluRay mounted to /mnt/bluray:
  67.        
  68.         bluray:/mnt/bluray
  69.  
  70.  
  71. Read angle 2 of playlist 4 from BluRay mounted to /mnt/bluray, start from chapter 2:
  72.        
  73.         -playlist 4 -angle 2 -chapter 2 bluray:/mnt/bluray
  74.  
  75.  
  76.  
  77. =head2 cache
  78.  
  79.  
  80. Caching wrapper for input stream.
  81.  
  82. Cache the input stream to temporary file. It brings seeking capability to live streams.
  83.  
  84.        
  85.         cache:<URL>
  86.  
  87.  
  88.  
  89. =head2 concat
  90.  
  91.  
  92. Physical concatenation protocol.
  93.  
  94. Allow to read and seek from many resource in sequence as if they were
  95. a unique resource.
  96.  
  97. A URL accepted by this protocol has the syntax:
  98.        
  99.         concat:<URL1>|<URL2>|...|<URLN>
  100.  
  101.  
  102. where I<URL1>, I<URL2>, ..., I<URLN> are the urls of the
  103. resource to be concatenated, each one possibly specifying a distinct
  104. protocol.
  105.  
  106. For example to read a sequence of files F<split1.mpeg>,
  107. F<split2.mpeg>, F<split3.mpeg> with B<ffplay> use the
  108. command:
  109.        
  110.         ffplay concat:split1.mpeg\|split2.mpeg\|split3.mpeg
  111.  
  112.  
  113. Note that you may need to escape the character "|" which is special for
  114. many shells.
  115.  
  116.  
  117. =head2 crypto
  118.  
  119.  
  120. AES-encrypted stream reading protocol.
  121.  
  122. The accepted options are:
  123.  
  124. =over 4
  125.  
  126.  
  127. =item B<key>
  128.  
  129. Set the AES decryption key binary block from given hexadecimal representation.
  130.  
  131.  
  132. =item B<iv>
  133.  
  134. Set the AES decryption initialization vector binary block from given hexadecimal representation.
  135.  
  136. =back
  137.  
  138.  
  139. Accepted URL formats:
  140.        
  141.         crypto:<URL>
  142.         crypto+<URL>
  143.  
  144.  
  145.  
  146. =head2 data
  147.  
  148.  
  149. Data in-line in the URI. See E<lt>B<http://en.wikipedia.org/wiki/Data_URI_scheme>E<gt>.
  150.  
  151. For example, to convert a GIF file given inline with B<ffmpeg>:
  152.        
  153.         ffmpeg -i "data:image/gif;base64,R0lGODdhCAAIAMIEAAAAAAAA//8AAP//AP///////////////ywAAAAACAAIAAADF0gEDLojDgdGiJdJqUX02iB4E8Q9jUMkADs=" smiley.png
  154.  
  155.  
  156.  
  157. =head2 file
  158.  
  159.  
  160. File access protocol.
  161.  
  162. Allow to read from or read to a file.
  163.  
  164. For example to read from a file F<input.mpeg> with B<ffmpeg>
  165. use the command:
  166.        
  167.         ffmpeg -i file:input.mpeg output.mpeg
  168.  
  169.  
  170. The ff* tools default to the file protocol, that is a resource
  171. specified with the name "FILE.mpeg" is interpreted as the URL
  172. "file:FILE.mpeg".
  173.  
  174. This protocol accepts the following options:
  175.  
  176.  
  177. =over 4
  178.  
  179.  
  180. =item B<truncate>
  181.  
  182. Truncate existing files on write, if set to 1. A value of 0 prevents
  183. truncating. Default value is 1.
  184.  
  185.  
  186. =item B<blocksize>
  187.  
  188. Set I/O operation maximum block size, in bytes. Default value is
  189. C<INT_MAX>, which results in not limiting the requested block size.
  190. Setting this value reasonably low improves user termination request reaction
  191. time, which is valuable for files on slow medium.
  192.  
  193. =back
  194.  
  195.  
  196.  
  197. =head2 ftp
  198.  
  199.  
  200. FTP (File Transfer Protocol).
  201.  
  202. Allow to read from or write to remote resources using FTP protocol.
  203.  
  204. Following syntax is required.
  205.        
  206.         ftp://[user[:password]@]server[:port]/path/to/remote/resource.mpeg
  207.  
  208.  
  209. This protocol accepts the following options.
  210.  
  211.  
  212. =over 4
  213.  
  214.  
  215. =item B<timeout>
  216.  
  217. Set timeout of socket I/O operations used by the underlying low level
  218. operation. By default it is set to -1, which means that the timeout is
  219. not specified.
  220.  
  221.  
  222. =item B<ftp-anonymous-password>
  223.  
  224. Password used when login as anonymous user. Typically an e-mail address
  225. should be used.
  226.  
  227.  
  228. =item B<ftp-write-seekable>
  229.  
  230. Control seekability of connection during encoding. If set to 1 the
  231. resource is supposed to be seekable, if set to 0 it is assumed not
  232. to be seekable. Default value is 0.
  233.  
  234. =back
  235.  
  236.  
  237. NOTE: Protocol can be used as output, but it is recommended to not do
  238. it, unless special care is taken (tests, customized server configuration
  239. etc.). Different FTP servers behave in different way during seek
  240. operation. ff* tools may produce incomplete content due to server limitations.
  241.  
  242.  
  243. =head2 gopher
  244.  
  245.  
  246. Gopher protocol.
  247.  
  248.  
  249. =head2 hls
  250.  
  251.  
  252. Read Apple HTTP Live Streaming compliant segmented stream as
  253. a uniform one. The M3U8 playlists describing the segments can be
  254. remote HTTP resources or local files, accessed using the standard
  255. file protocol.
  256. The nested protocol is declared by specifying
  257. "+I<proto>" after the hls URI scheme name, where I<proto>
  258. is either "file" or "http".
  259.  
  260.        
  261.         hls+http://host/path/to/remote/resource.m3u8
  262.         hls+file://path/to/local/resource.m3u8
  263.  
  264.  
  265. Using this protocol is discouraged - the hls demuxer should work
  266. just as well (if not, please report the issues) and is more complete.
  267. To use the hls demuxer instead, simply use the direct URLs to the
  268. m3u8 files.
  269.  
  270.  
  271. =head2 http
  272.  
  273.  
  274. HTTP (Hyper Text Transfer Protocol).
  275.  
  276. This protocol accepts the following options.
  277.  
  278.  
  279. =over 4
  280.  
  281.  
  282. =item B<seekable>
  283.  
  284. Control seekability of connection. If set to 1 the resource is
  285. supposed to be seekable, if set to 0 it is assumed not to be seekable,
  286. if set to -1 it will try to autodetect if it is seekable. Default
  287. value is -1.
  288.  
  289.  
  290. =item B<chunked_post>
  291.  
  292. If set to 1 use chunked transfer-encoding for posts, default is 1.
  293.  
  294.  
  295. =item B<headers>
  296.  
  297. Set custom HTTP headers, can override built in default headers. The
  298. value must be a string encoding the headers.
  299.  
  300.  
  301. =item B<content_type>
  302.  
  303. Force a content type.
  304.  
  305.  
  306. =item B<user-agent>
  307.  
  308. Override User-Agent header. If not specified the protocol will use a
  309. string describing the libavformat build.
  310.  
  311.  
  312. =item B<multiple_requests>
  313.  
  314. Use persistent connections if set to 1. By default it is 0.
  315.  
  316.  
  317. =item B<post_data>
  318.  
  319. Set custom HTTP post data.
  320.  
  321.  
  322. =item B<timeout>
  323.  
  324. Set timeout of socket I/O operations used by the underlying low level
  325. operation. By default it is set to -1, which means that the timeout is
  326. not specified.
  327.  
  328.  
  329. =item B<mime_type>
  330.  
  331. Set MIME type.
  332.  
  333.  
  334. =item B<icy>
  335.  
  336. If set to 1 request ICY (SHOUTcast) metadata from the server. If the server
  337. supports this, the metadata has to be retrieved by the application by reading
  338. the B<icy_metadata_headers> and B<icy_metadata_packet> options.
  339. The default is 0.
  340.  
  341.  
  342. =item B<icy_metadata_headers>
  343.  
  344. If the server supports ICY metadata, this contains the ICY specific HTTP reply
  345. headers, separated with newline characters.
  346.  
  347.  
  348. =item B<icy_metadata_packet>
  349.  
  350. If the server supports ICY metadata, and B<icy> was set to 1, this
  351. contains the last non-empty metadata packet sent by the server.
  352.  
  353.  
  354. =item B<cookies>
  355.  
  356. Set the cookies to be sent in future requests. The format of each cookie is the
  357. same as the value of a Set-Cookie HTTP response field. Multiple cookies can be
  358. delimited by a newline character.
  359.  
  360. =back
  361.  
  362.  
  363.  
  364. =head3 HTTP Cookies
  365.  
  366.  
  367. Some HTTP requests will be denied unless cookie values are passed in with the
  368. request. The B<cookies> option allows these cookies to be specified. At
  369. the very least, each cookie must specify a value along with a path and domain.
  370. HTTP requests that match both the domain and path will automatically include the
  371. cookie value in the HTTP Cookie header field. Multiple cookies can be delimited
  372. by a newline.
  373.  
  374. The required syntax to play a stream specifying a cookie is:
  375.        
  376.         ffplay -cookies "nlqptid=nltid=tsn; path=/; domain=somedomain.com;" http://somedomain.com/somestream.m3u8
  377.  
  378.  
  379.  
  380. =head2 mmst
  381.  
  382.  
  383. MMS (Microsoft Media Server) protocol over TCP.
  384.  
  385.  
  386. =head2 mmsh
  387.  
  388.  
  389. MMS (Microsoft Media Server) protocol over HTTP.
  390.  
  391. The required syntax is:
  392.        
  393.         mmsh://<server>[:<port>][/<app>][/<playpath>]
  394.  
  395.  
  396.  
  397. =head2 md5
  398.  
  399.  
  400. MD5 output protocol.
  401.  
  402. Computes the MD5 hash of the data to be written, and on close writes
  403. this to the designated output or stdout if none is specified. It can
  404. be used to test muxers without writing an actual file.
  405.  
  406. Some examples follow.
  407.        
  408.         # Write the MD5 hash of the encoded AVI file to the file output.avi.md5.
  409.         ffmpeg -i input.flv -f avi -y md5:output.avi.md5
  410.        
  411.         # Write the MD5 hash of the encoded AVI file to stdout.
  412.         ffmpeg -i input.flv -f avi -y md5:
  413.  
  414.  
  415. Note that some formats (typically MOV) require the output protocol to
  416. be seekable, so they will fail with the MD5 output protocol.
  417.  
  418.  
  419. =head2 pipe
  420.  
  421.  
  422. UNIX pipe access protocol.
  423.  
  424. Allow to read and write from UNIX pipes.
  425.  
  426. The accepted syntax is:
  427.        
  428.         pipe:[<number>]
  429.  
  430.  
  431. I<number> is the number corresponding to the file descriptor of the
  432. pipe (e.g. 0 for stdin, 1 for stdout, 2 for stderr).  If I<number>
  433. is not specified, by default the stdout file descriptor will be used
  434. for writing, stdin for reading.
  435.  
  436. For example to read from stdin with B<ffmpeg>:
  437.        
  438.         cat test.wav | ffmpeg -i pipe:0
  439.         # ...this is the same as...
  440.         cat test.wav | ffmpeg -i pipe:
  441.  
  442.  
  443. For writing to stdout with B<ffmpeg>:
  444.        
  445.         ffmpeg -i test.wav -f avi pipe:1 | cat > test.avi
  446.         # ...this is the same as...
  447.         ffmpeg -i test.wav -f avi pipe: | cat > test.avi
  448.  
  449.  
  450. This protocol accepts the following options:
  451.  
  452.  
  453. =over 4
  454.  
  455.  
  456. =item B<blocksize>
  457.  
  458. Set I/O operation maximum block size, in bytes. Default value is
  459. C<INT_MAX>, which results in not limiting the requested block size.
  460. Setting this value reasonably low improves user termination request reaction
  461. time, which is valuable if data transmission is slow.
  462.  
  463. =back
  464.  
  465.  
  466. Note that some formats (typically MOV), require the output protocol to
  467. be seekable, so they will fail with the pipe output protocol.
  468.  
  469.  
  470. =head2 rtmp
  471.  
  472.  
  473. Real-Time Messaging Protocol.
  474.  
  475. The Real-Time Messaging Protocol (RTMP) is used for streaming multimedia
  476. content across a TCP/IP network.
  477.  
  478. The required syntax is:
  479.        
  480.         rtmp://[<username>:<password>@]<server>[:<port>][/<app>][/<instance>][/<playpath>]
  481.  
  482.  
  483. The accepted parameters are:
  484.  
  485. =over 4
  486.  
  487.  
  488.  
  489. =item B<username>
  490.  
  491. An optional username (mostly for publishing).
  492.  
  493.  
  494. =item B<password>
  495.  
  496. An optional password (mostly for publishing).
  497.  
  498.  
  499. =item B<server>
  500.  
  501. The address of the RTMP server.
  502.  
  503.  
  504. =item B<port>
  505.  
  506. The number of the TCP port to use (by default is 1935).
  507.  
  508.  
  509. =item B<app>
  510.  
  511. It is the name of the application to access. It usually corresponds to
  512. the path where the application is installed on the RTMP server
  513. (e.g. F</ondemand/>, F</flash/live/>, etc.). You can override
  514. the value parsed from the URI through the C<rtmp_app> option, too.
  515.  
  516.  
  517. =item B<playpath>
  518.  
  519. It is the path or name of the resource to play with reference to the
  520. application specified in I<app>, may be prefixed by "mp4:". You
  521. can override the value parsed from the URI through the C<rtmp_playpath>
  522. option, too.
  523.  
  524.  
  525. =item B<listen>
  526.  
  527. Act as a server, listening for an incoming connection.
  528.  
  529.  
  530. =item B<timeout>
  531.  
  532. Maximum time to wait for the incoming connection. Implies listen.
  533.  
  534. =back
  535.  
  536.  
  537. Additionally, the following parameters can be set via command line options
  538. (or in code via C<AVOption>s):
  539.  
  540. =over 4
  541.  
  542.  
  543.  
  544. =item B<rtmp_app>
  545.  
  546. Name of application to connect on the RTMP server. This option
  547. overrides the parameter specified in the URI.
  548.  
  549.  
  550. =item B<rtmp_buffer>
  551.  
  552. Set the client buffer time in milliseconds. The default is 3000.
  553.  
  554.  
  555. =item B<rtmp_conn>
  556.  
  557. Extra arbitrary AMF connection parameters, parsed from a string,
  558. e.g. like C<B:1 S:authMe O:1 NN:code:1.23 NS:flag:ok O:0>.
  559. Each value is prefixed by a single character denoting the type,
  560. B for Boolean, N for number, S for string, O for object, or Z for null,
  561. followed by a colon. For Booleans the data must be either 0 or 1 for
  562. FALSE or TRUE, respectively.  Likewise for Objects the data must be 0 or
  563. 1 to end or begin an object, respectively. Data items in subobjects may
  564. be named, by prefixing the type with 'N' and specifying the name before
  565. the value (i.e. C<NB:myFlag:1>). This option may be used multiple
  566. times to construct arbitrary AMF sequences.
  567.  
  568.  
  569. =item B<rtmp_flashver>
  570.  
  571. Version of the Flash plugin used to run the SWF player. The default
  572. is LNX 9,0,124,2. (When publishing, the default is FMLE/3.0 (compatible;
  573. E<lt>libavformat versionE<gt>).)
  574.  
  575.  
  576. =item B<rtmp_flush_interval>
  577.  
  578. Number of packets flushed in the same request (RTMPT only). The default
  579. is 10.
  580.  
  581.  
  582. =item B<rtmp_live>
  583.  
  584. Specify that the media is a live stream. No resuming or seeking in
  585. live streams is possible. The default value is C<any>, which means the
  586. subscriber first tries to play the live stream specified in the
  587. playpath. If a live stream of that name is not found, it plays the
  588. recorded stream. The other possible values are C<live> and
  589. C<recorded>.
  590.  
  591.  
  592. =item B<rtmp_pageurl>
  593.  
  594. URL of the web page in which the media was embedded. By default no
  595. value will be sent.
  596.  
  597.  
  598. =item B<rtmp_playpath>
  599.  
  600. Stream identifier to play or to publish. This option overrides the
  601. parameter specified in the URI.
  602.  
  603.  
  604. =item B<rtmp_subscribe>
  605.  
  606. Name of live stream to subscribe to. By default no value will be sent.
  607. It is only sent if the option is specified or if rtmp_live
  608. is set to live.
  609.  
  610.  
  611. =item B<rtmp_swfhash>
  612.  
  613. SHA256 hash of the decompressed SWF file (32 bytes).
  614.  
  615.  
  616. =item B<rtmp_swfsize>
  617.  
  618. Size of the decompressed SWF file, required for SWFVerification.
  619.  
  620.  
  621. =item B<rtmp_swfurl>
  622.  
  623. URL of the SWF player for the media. By default no value will be sent.
  624.  
  625.  
  626. =item B<rtmp_swfverify>
  627.  
  628. URL to player swf file, compute hash/size automatically.
  629.  
  630.  
  631. =item B<rtmp_tcurl>
  632.  
  633. URL of the target stream. Defaults to proto://host[:port]/app.
  634.  
  635.  
  636. =back
  637.  
  638.  
  639. For example to read with B<ffplay> a multimedia resource named
  640. "sample" from the application "vod" from an RTMP server "myserver":
  641.        
  642.         ffplay rtmp://myserver/vod/sample
  643.  
  644.  
  645. To publish to a password protected server, passing the playpath and
  646. app names separately:
  647.        
  648.         ffmpeg -re -i <input> -f flv -rtmp_playpath some/long/path -rtmp_app long/app/name rtmp://username:password@myserver/
  649.  
  650.  
  651.  
  652. =head2 rtmpe
  653.  
  654.  
  655. Encrypted Real-Time Messaging Protocol.
  656.  
  657. The Encrypted Real-Time Messaging Protocol (RTMPE) is used for
  658. streaming multimedia content within standard cryptographic primitives,
  659. consisting of Diffie-Hellman key exchange and HMACSHA256, generating
  660. a pair of RC4 keys.
  661.  
  662.  
  663. =head2 rtmps
  664.  
  665.  
  666. Real-Time Messaging Protocol over a secure SSL connection.
  667.  
  668. The Real-Time Messaging Protocol (RTMPS) is used for streaming
  669. multimedia content across an encrypted connection.
  670.  
  671.  
  672. =head2 rtmpt
  673.  
  674.  
  675. Real-Time Messaging Protocol tunneled through HTTP.
  676.  
  677. The Real-Time Messaging Protocol tunneled through HTTP (RTMPT) is used
  678. for streaming multimedia content within HTTP requests to traverse
  679. firewalls.
  680.  
  681.  
  682. =head2 rtmpte
  683.  
  684.  
  685. Encrypted Real-Time Messaging Protocol tunneled through HTTP.
  686.  
  687. The Encrypted Real-Time Messaging Protocol tunneled through HTTP (RTMPTE)
  688. is used for streaming multimedia content within HTTP requests to traverse
  689. firewalls.
  690.  
  691.  
  692. =head2 rtmpts
  693.  
  694.  
  695. Real-Time Messaging Protocol tunneled through HTTPS.
  696.  
  697. The Real-Time Messaging Protocol tunneled through HTTPS (RTMPTS) is used
  698. for streaming multimedia content within HTTPS requests to traverse
  699. firewalls.
  700.  
  701.  
  702. =head2 libssh
  703.  
  704.  
  705. Secure File Transfer Protocol via libssh
  706.  
  707. Allow to read from or write to remote resources using SFTP protocol.
  708.  
  709. Following syntax is required.
  710.  
  711.        
  712.         sftp://[user[:password]@]server[:port]/path/to/remote/resource.mpeg
  713.  
  714.  
  715. This protocol accepts the following options.
  716.  
  717.  
  718. =over 4
  719.  
  720.  
  721. =item B<timeout>
  722.  
  723. Set timeout of socket I/O operations used by the underlying low level
  724. operation. By default it is set to -1, which means that the timeout
  725. is not specified.
  726.  
  727.  
  728. =item B<truncate>
  729.  
  730. Truncate existing files on write, if set to 1. A value of 0 prevents
  731. truncating. Default value is 1.
  732.  
  733.  
  734. =back
  735.  
  736.  
  737. Example: Play a file stored on remote server.
  738.  
  739.        
  740.         ffplay sftp://user:password@server_address:22/home/user/resource.mpeg
  741.  
  742.  
  743.  
  744. =head2 librtmp rtmp, rtmpe, rtmps, rtmpt, rtmpte
  745.  
  746.  
  747. Real-Time Messaging Protocol and its variants supported through
  748. librtmp.
  749.  
  750. Requires the presence of the librtmp headers and library during
  751. configuration. You need to explicitly configure the build with
  752. "--enable-librtmp". If enabled this will replace the native RTMP
  753. protocol.
  754.  
  755. This protocol provides most client functions and a few server
  756. functions needed to support RTMP, RTMP tunneled in HTTP (RTMPT),
  757. encrypted RTMP (RTMPE), RTMP over SSL/TLS (RTMPS) and tunneled
  758. variants of these encrypted types (RTMPTE, RTMPTS).
  759.  
  760. The required syntax is:
  761.        
  762.         <rtmp_proto>://<server>[:<port>][/<app>][/<playpath>] <options>
  763.  
  764.  
  765. where I<rtmp_proto> is one of the strings "rtmp", "rtmpt", "rtmpe",
  766. "rtmps", "rtmpte", "rtmpts" corresponding to each RTMP variant, and
  767. I<server>, I<port>, I<app> and I<playpath> have the same
  768. meaning as specified for the RTMP native protocol.
  769. I<options> contains a list of space-separated options of the form
  770. I<key>=I<val>.
  771.  
  772. See the librtmp manual page (man 3 librtmp) for more information.
  773.  
  774. For example, to stream a file in real-time to an RTMP server using
  775. B<ffmpeg>:
  776.        
  777.         ffmpeg -re -i myfile -f flv rtmp://myserver/live/mystream
  778.  
  779.  
  780. To play the same stream using B<ffplay>:
  781.        
  782.         ffplay "rtmp://myserver/live/mystream live=1"
  783.  
  784.  
  785.  
  786. =head2 rtp
  787.  
  788.  
  789. Real-time Transport Protocol.
  790.  
  791. The required syntax for an RTP URL is:
  792. rtp://I<hostname>[:I<port>][?I<option>=I<val>...]
  793.  
  794. I<port> specifies the RTP port to use.
  795.  
  796. The following URL options are supported:
  797.  
  798.  
  799. =over 4
  800.  
  801.  
  802.  
  803. =item B<ttl=>I<n>
  804.  
  805. Set the TTL (Time-To-Live) value (for multicast only).
  806.  
  807.  
  808. =item B<rtcpport=>I<n>
  809.  
  810. Set the remote RTCP port to I<n>.
  811.  
  812.  
  813. =item B<localrtpport=>I<n>
  814.  
  815. Set the local RTP port to I<n>.
  816.  
  817.  
  818. =item B<localrtcpport=>I<n>B<'>
  819.  
  820. Set the local RTCP port to I<n>.
  821.  
  822.  
  823. =item B<pkt_size=>I<n>
  824.  
  825. Set max packet size (in bytes) to I<n>.
  826.  
  827.  
  828. =item B<connect=0|1>
  829.  
  830. Do a C<connect()> on the UDP socket (if set to 1) or not (if set
  831. to 0).
  832.  
  833.  
  834. =item B<sources=>I<ip>B<[,>I<ip>B<]>
  835.  
  836. List allowed source IP addresses.
  837.  
  838.  
  839. =item B<block=>I<ip>B<[,>I<ip>B<]>
  840.  
  841. List disallowed (blocked) source IP addresses.
  842.  
  843.  
  844. =item B<write_to_source=0|1>
  845.  
  846. Send packets to the source address of the latest received packet (if
  847. set to 1) or to a default remote address (if set to 0).
  848.  
  849.  
  850. =item B<localport=>I<n>
  851.  
  852. Set the local RTP port to I<n>.
  853.  
  854. This is a deprecated option. Instead, B<localrtpport> should be
  855. used.
  856.  
  857.  
  858. =back
  859.  
  860.  
  861. Important notes:
  862.  
  863.  
  864. =over 4
  865.  
  866.  
  867.  
  868. =item 1.
  869.  
  870. If B<rtcpport> is not set the RTCP port will be set to the RTP
  871. port value plus 1.
  872.  
  873.  
  874. =item 2.
  875.  
  876. If B<localrtpport> (the local RTP port) is not set any available
  877. port will be used for the local RTP and RTCP ports.
  878.  
  879.  
  880. =item 3.
  881.  
  882. If B<localrtcpport> (the local RTCP port) is not set it will be
  883. set to the the local RTP port value plus 1.
  884.  
  885. =back
  886.  
  887.  
  888.  
  889. =head2 rtsp
  890.  
  891.  
  892. RTSP is not technically a protocol handler in libavformat, it is a demuxer
  893. and muxer. The demuxer supports both normal RTSP (with data transferred
  894. over RTP; this is used by e.g. Apple and Microsoft) and Real-RTSP (with
  895. data transferred over RDT).
  896.  
  897. The muxer can be used to send a stream using RTSP ANNOUNCE to a server
  898. supporting it (currently Darwin Streaming Server and Mischa Spiegelmock's
  899. E<lt>B<http://github.com/revmischa/rtsp-server>E<gt>).
  900.  
  901. The required syntax for a RTSP url is:
  902.        
  903.         rtsp://<hostname>[:<port>]/<path>
  904.  
  905.  
  906. The following options (set on the B<ffmpeg>/B<ffplay> command
  907. line, or set in code via C<AVOption>s or in C<avformat_open_input>),
  908. are supported:
  909.  
  910. Flags for C<rtsp_transport>:
  911.  
  912.  
  913. =over 4
  914.  
  915.  
  916.  
  917. =item B<udp>
  918.  
  919. Use UDP as lower transport protocol.
  920.  
  921.  
  922. =item B<tcp>
  923.  
  924. Use TCP (interleaving within the RTSP control channel) as lower
  925. transport protocol.
  926.  
  927.  
  928. =item B<udp_multicast>
  929.  
  930. Use UDP multicast as lower transport protocol.
  931.  
  932.  
  933. =item B<http>
  934.  
  935. Use HTTP tunneling as lower transport protocol, which is useful for
  936. passing proxies.
  937.  
  938. =back
  939.  
  940.  
  941. Multiple lower transport protocols may be specified, in that case they are
  942. tried one at a time (if the setup of one fails, the next one is tried).
  943. For the muxer, only the C<tcp> and C<udp> options are supported.
  944.  
  945. Flags for C<rtsp_flags>:
  946.  
  947.  
  948. =over 4
  949.  
  950.  
  951. =item B<filter_src>
  952.  
  953. Accept packets only from negotiated peer address and port.
  954.  
  955. =item B<listen>
  956.  
  957. Act as a server, listening for an incoming connection.
  958.  
  959. =back
  960.  
  961.  
  962. When receiving data over UDP, the demuxer tries to reorder received packets
  963. (since they may arrive out of order, or packets may get lost totally). This
  964. can be disabled by setting the maximum demuxing delay to zero (via
  965. the C<max_delay> field of AVFormatContext).
  966.  
  967. When watching multi-bitrate Real-RTSP streams with B<ffplay>, the
  968. streams to display can be chosen with C<-vst> I<n> and
  969. C<-ast> I<n> for video and audio respectively, and can be switched
  970. on the fly by pressing C<v> and C<a>.
  971.  
  972. Example command lines:
  973.  
  974. To watch a stream over UDP, with a max reordering delay of 0.5 seconds:
  975.  
  976.        
  977.         ffplay -max_delay 500000 -rtsp_transport udp rtsp://server/video.mp4
  978.  
  979.  
  980. To watch a stream tunneled over HTTP:
  981.  
  982.        
  983.         ffplay -rtsp_transport http rtsp://server/video.mp4
  984.  
  985.  
  986. To send a stream in realtime to a RTSP server, for others to watch:
  987.  
  988.        
  989.         ffmpeg -re -i <input> -f rtsp -muxdelay 0.1 rtsp://server/live.sdp
  990.  
  991.  
  992. To receive a stream in realtime:
  993.  
  994.        
  995.         ffmpeg -rtsp_flags listen -i rtsp://ownaddress/live.sdp <output>
  996.  
  997.  
  998.  
  999. =over 4
  1000.  
  1001.  
  1002. =item B<stimeout>
  1003.  
  1004. Socket IO timeout in micro seconds.
  1005.  
  1006. =back
  1007.  
  1008.  
  1009.  
  1010. =head2 sap
  1011.  
  1012.  
  1013. Session Announcement Protocol (RFC 2974). This is not technically a
  1014. protocol handler in libavformat, it is a muxer and demuxer.
  1015. It is used for signalling of RTP streams, by announcing the SDP for the
  1016. streams regularly on a separate port.
  1017.  
  1018.  
  1019. =head3 Muxer
  1020.  
  1021.  
  1022. The syntax for a SAP url given to the muxer is:
  1023.        
  1024.         sap://<destination>[:<port>][?<options>]
  1025.  
  1026.  
  1027. The RTP packets are sent to I<destination> on port I<port>,
  1028. or to port 5004 if no port is specified.
  1029. I<options> is a C<&>-separated list. The following options
  1030. are supported:
  1031.  
  1032.  
  1033. =over 4
  1034.  
  1035.  
  1036.  
  1037. =item B<announce_addr=>I<address>
  1038.  
  1039. Specify the destination IP address for sending the announcements to.
  1040. If omitted, the announcements are sent to the commonly used SAP
  1041. announcement multicast address 224.2.127.254 (sap.mcast.net), or
  1042. ff0e::2:7ffe if I<destination> is an IPv6 address.
  1043.  
  1044.  
  1045. =item B<announce_port=>I<port>
  1046.  
  1047. Specify the port to send the announcements on, defaults to
  1048. 9875 if not specified.
  1049.  
  1050.  
  1051. =item B<ttl=>I<ttl>
  1052.  
  1053. Specify the time to live value for the announcements and RTP packets,
  1054. defaults to 255.
  1055.  
  1056.  
  1057. =item B<same_port=>I<0|1>
  1058.  
  1059. If set to 1, send all RTP streams on the same port pair. If zero (the
  1060. default), all streams are sent on unique ports, with each stream on a
  1061. port 2 numbers higher than the previous.
  1062. VLC/Live555 requires this to be set to 1, to be able to receive the stream.
  1063. The RTP stack in libavformat for receiving requires all streams to be sent
  1064. on unique ports.
  1065.  
  1066. =back
  1067.  
  1068.  
  1069. Example command lines follow.
  1070.  
  1071. To broadcast a stream on the local subnet, for watching in VLC:
  1072.  
  1073.        
  1074.         ffmpeg -re -i <input> -f sap sap://224.0.0.255?same_port=1
  1075.  
  1076.  
  1077. Similarly, for watching in B<ffplay>:
  1078.  
  1079.        
  1080.         ffmpeg -re -i <input> -f sap sap://224.0.0.255
  1081.  
  1082.  
  1083. And for watching in B<ffplay>, over IPv6:
  1084.  
  1085.        
  1086.         ffmpeg -re -i <input> -f sap sap://[ff0e::1:2:3:4]
  1087.  
  1088.  
  1089.  
  1090. =head3 Demuxer
  1091.  
  1092.  
  1093. The syntax for a SAP url given to the demuxer is:
  1094.        
  1095.         sap://[<address>][:<port>]
  1096.  
  1097.  
  1098. I<address> is the multicast address to listen for announcements on,
  1099. if omitted, the default 224.2.127.254 (sap.mcast.net) is used. I<port>
  1100. is the port that is listened on, 9875 if omitted.
  1101.  
  1102. The demuxers listens for announcements on the given address and port.
  1103. Once an announcement is received, it tries to receive that particular stream.
  1104.  
  1105. Example command lines follow.
  1106.  
  1107. To play back the first stream announced on the normal SAP multicast address:
  1108.  
  1109.        
  1110.         ffplay sap://
  1111.  
  1112.  
  1113. To play back the first stream announced on one the default IPv6 SAP multicast address:
  1114.  
  1115.        
  1116.         ffplay sap://[ff0e::2:7ffe]
  1117.  
  1118.  
  1119.  
  1120. =head2 sctp
  1121.  
  1122.  
  1123. Stream Control Transmission Protocol.
  1124.  
  1125. The accepted URL syntax is:
  1126.        
  1127.         sctp://<host>:<port>[?<options>]
  1128.  
  1129.  
  1130. The protocol accepts the following options:
  1131.  
  1132. =over 4
  1133.  
  1134.  
  1135. =item B<listen>
  1136.  
  1137. If set to any value, listen for an incoming connection. Outgoing connection is done by default.
  1138.  
  1139.  
  1140. =item B<max_streams>
  1141.  
  1142. Set the maximum number of streams. By default no limit is set.
  1143.  
  1144. =back
  1145.  
  1146.  
  1147.  
  1148. =head2 srtp
  1149.  
  1150.  
  1151. Secure Real-time Transport Protocol.
  1152.  
  1153. The accepted options are:
  1154.  
  1155. =over 4
  1156.  
  1157.  
  1158. =item B<srtp_in_suite>
  1159.  
  1160.  
  1161. =item B<srtp_out_suite>
  1162.  
  1163. Select input and output encoding suites.
  1164.  
  1165. Supported values:
  1166.  
  1167. =over 4
  1168.  
  1169.  
  1170. =item B<AES_CM_128_HMAC_SHA1_80>
  1171.  
  1172.  
  1173. =item B<SRTP_AES128_CM_HMAC_SHA1_80>
  1174.  
  1175.  
  1176. =item B<AES_CM_128_HMAC_SHA1_32>
  1177.  
  1178.  
  1179. =item B<SRTP_AES128_CM_HMAC_SHA1_32>
  1180.  
  1181.  
  1182. =back
  1183.  
  1184.  
  1185.  
  1186. =item B<srtp_in_params>
  1187.  
  1188.  
  1189. =item B<srtp_out_params>
  1190.  
  1191. Set input and output encoding parameters, which are expressed by a
  1192. base64-encoded representation of a binary block. The first 16 bytes of
  1193. this binary block are used as master key, the following 14 bytes are
  1194. used as master salt.
  1195.  
  1196. =back
  1197.  
  1198.  
  1199.  
  1200. =head2 tcp
  1201.  
  1202.  
  1203. Trasmission Control Protocol.
  1204.  
  1205. The required syntax for a TCP url is:
  1206.        
  1207.         tcp://<hostname>:<port>[?<options>]
  1208.  
  1209.  
  1210.  
  1211. =over 4
  1212.  
  1213.  
  1214.  
  1215. =item B<listen>
  1216.  
  1217. Listen for an incoming connection
  1218.  
  1219.  
  1220. =item B<timeout=>I<microseconds>
  1221.  
  1222. In read mode: if no data arrived in more than this time interval, raise error.
  1223. In write mode: if socket cannot be written in more than this time interval, raise error.
  1224. This also sets timeout on TCP connection establishing.
  1225.  
  1226.        
  1227.         ffmpeg -i <input> -f <format> tcp://<hostname>:<port>?listen
  1228.         ffplay tcp://<hostname>:<port>
  1229.  
  1230.  
  1231.  
  1232. =back
  1233.  
  1234.  
  1235.  
  1236. =head2 tls
  1237.  
  1238.  
  1239. Transport Layer Security (TLS) / Secure Sockets Layer (SSL)
  1240.  
  1241. The required syntax for a TLS/SSL url is:
  1242.        
  1243.         tls://<hostname>:<port>[?<options>]
  1244.  
  1245.  
  1246. The following parameters can be set via command line options
  1247. (or in code via C<AVOption>s):
  1248.  
  1249.  
  1250. =over 4
  1251.  
  1252.  
  1253.  
  1254. =item B<ca_file, cafile=>I<filename>
  1255.  
  1256. A file containing certificate authority (CA) root certificates to treat
  1257. as trusted. If the linked TLS library contains a default this might not
  1258. need to be specified for verification to work, but not all libraries and
  1259. setups have defaults built in.
  1260. The file must be in OpenSSL PEM format.
  1261.  
  1262.  
  1263. =item B<tls_verify=>I<1|0>
  1264.  
  1265. If enabled, try to verify the peer that we are communicating with.
  1266. Note, if using OpenSSL, this currently only makes sure that the
  1267. peer certificate is signed by one of the root certificates in the CA
  1268. database, but it does not validate that the certificate actually
  1269. matches the host name we are trying to connect to. (With GnuTLS,
  1270. the host name is validated as well.)
  1271.  
  1272. This is disabled by default since it requires a CA database to be
  1273. provided by the caller in many cases.
  1274.  
  1275.  
  1276. =item B<cert_file, cert=>I<filename>
  1277.  
  1278. A file containing a certificate to use in the handshake with the peer.
  1279. (When operating as server, in listen mode, this is more often required
  1280. by the peer, while client certificates only are mandated in certain
  1281. setups.)
  1282.  
  1283.  
  1284. =item B<key_file, key=>I<filename>
  1285.  
  1286. A file containing the private key for the certificate.
  1287.  
  1288.  
  1289. =item B<listen=>I<1|0>
  1290.  
  1291. If enabled, listen for connections on the provided port, and assume
  1292. the server role in the handshake instead of the client role.
  1293.  
  1294.  
  1295. =back
  1296.  
  1297.  
  1298. Example command lines:
  1299.  
  1300. To create a TLS/SSL server that serves an input stream.
  1301.  
  1302.        
  1303.         ffmpeg -i <input> -f <format> tls://<hostname>:<port>?listen&cert=<server.crt>&key=<server.key>
  1304.  
  1305.  
  1306. To play back a stream from the TLS/SSL server using B<ffplay>:
  1307.  
  1308.        
  1309.         ffplay tls://<hostname>:<port>
  1310.  
  1311.  
  1312.  
  1313. =head2 udp
  1314.  
  1315.  
  1316. User Datagram Protocol.
  1317.  
  1318. The required syntax for a UDP url is:
  1319.        
  1320.         udp://<hostname>:<port>[?<options>]
  1321.  
  1322.  
  1323. I<options> contains a list of &-separated options of the form I<key>=I<val>.
  1324.  
  1325. In case threading is enabled on the system, a circular buffer is used
  1326. to store the incoming data, which allows to reduce loss of data due to
  1327. UDP socket buffer overruns. The I<fifo_size> and
  1328. I<overrun_nonfatal> options are related to this buffer.
  1329.  
  1330. The list of supported options follows.
  1331.  
  1332.  
  1333. =over 4
  1334.  
  1335.  
  1336.  
  1337. =item B<buffer_size=>I<size>
  1338.  
  1339. Set the UDP socket buffer size in bytes. This is used both for the
  1340. receiving and the sending buffer size.
  1341.  
  1342.  
  1343. =item B<localport=>I<port>
  1344.  
  1345. Override the local UDP port to bind with.
  1346.  
  1347.  
  1348. =item B<localaddr=>I<addr>
  1349.  
  1350. Choose the local IP address. This is useful e.g. if sending multicast
  1351. and the host has multiple interfaces, where the user can choose
  1352. which interface to send on by specifying the IP address of that interface.
  1353.  
  1354.  
  1355. =item B<pkt_size=>I<size>
  1356.  
  1357. Set the size in bytes of UDP packets.
  1358.  
  1359.  
  1360. =item B<reuse=>I<1|0>
  1361.  
  1362. Explicitly allow or disallow reusing UDP sockets.
  1363.  
  1364.  
  1365. =item B<ttl=>I<ttl>
  1366.  
  1367. Set the time to live value (for multicast only).
  1368.  
  1369.  
  1370. =item B<connect=>I<1|0>
  1371.  
  1372. Initialize the UDP socket with C<connect()>. In this case, the
  1373. destination address can't be changed with ff_udp_set_remote_url later.
  1374. If the destination address isn't known at the start, this option can
  1375. be specified in ff_udp_set_remote_url, too.
  1376. This allows finding out the source address for the packets with getsockname,
  1377. and makes writes return with AVERROR(ECONNREFUSED) if "destination
  1378. unreachable" is received.
  1379. For receiving, this gives the benefit of only receiving packets from
  1380. the specified peer address/port.
  1381.  
  1382.  
  1383. =item B<sources=>I<address>B<[,>I<address>B<]>
  1384.  
  1385. Only receive packets sent to the multicast group from one of the
  1386. specified sender IP addresses.
  1387.  
  1388.  
  1389. =item B<block=>I<address>B<[,>I<address>B<]>
  1390.  
  1391. Ignore packets sent to the multicast group from the specified
  1392. sender IP addresses.
  1393.  
  1394.  
  1395. =item B<fifo_size=>I<units>
  1396.  
  1397. Set the UDP receiving circular buffer size, expressed as a number of
  1398. packets with size of 188 bytes. If not specified defaults to 7*4096.
  1399.  
  1400.  
  1401. =item B<overrun_nonfatal=>I<1|0>
  1402.  
  1403. Survive in case of UDP receiving circular buffer overrun. Default
  1404. value is 0.
  1405.  
  1406.  
  1407. =item B<timeout=>I<microseconds>
  1408.  
  1409. In read mode: if no data arrived in more than this time interval, raise error.
  1410.  
  1411. =back
  1412.  
  1413.  
  1414. Some usage examples of the UDP protocol with B<ffmpeg> follow.
  1415.  
  1416. To stream over UDP to a remote endpoint:
  1417.        
  1418.         ffmpeg -i <input> -f <format> udp://<hostname>:<port>
  1419.  
  1420.  
  1421. To stream in mpegts format over UDP using 188 sized UDP packets, using a large input buffer:
  1422.        
  1423.         ffmpeg -i <input> -f mpegts udp://<hostname>:<port>?pkt_size=188&buffer_size=65535
  1424.  
  1425.  
  1426. To receive over UDP from a remote endpoint:
  1427.        
  1428.         ffmpeg -i udp://[<multicast-address>]:<port>
  1429.  
  1430.  
  1431.  
  1432. =head2 unix
  1433.  
  1434.  
  1435. Unix local socket
  1436.  
  1437. The required syntax for a Unix socket URL is:
  1438.  
  1439.        
  1440.         unix://<filepath>
  1441.  
  1442.  
  1443. The following parameters can be set via command line options
  1444. (or in code via C<AVOption>s):
  1445.  
  1446.  
  1447. =over 4
  1448.  
  1449.  
  1450. =item B<timeout>
  1451.  
  1452. Timeout in ms.
  1453.  
  1454. =item B<listen>
  1455.  
  1456. Create the Unix socket in listening mode.
  1457.  
  1458. =back
  1459.  
  1460.  
  1461.  
  1462.  
  1463. =head1 SEE ALSO
  1464.  
  1465.  
  1466.  
  1467. ffmpeg(1), ffplay(1), ffprobe(1), ffserver(1), libavformat(3)
  1468.  
  1469.  
  1470. =head1 AUTHORS
  1471.  
  1472.  
  1473. The FFmpeg developers.
  1474.  
  1475. For details about the authorship, see the Git history of the project
  1476. (git://source.ffmpeg.org/ffmpeg), e.g. by typing the command
  1477. B<git log> in the FFmpeg source directory, or browsing the
  1478. online repository at E<lt>B<http://source.ffmpeg.org>E<gt>.
  1479.  
  1480. Maintainers for the specific components are listed in the file
  1481. F<MAINTAINERS> in the source code tree.
  1482.  
  1483.  
  1484.  
  1485.