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.

917 lines
26KB

  1. @chapter Protocols
  2. @c man begin PROTOCOLS
  3. Protocols are configured elements in FFmpeg which allow to access
  4. resources which require the use of a particular protocol.
  5. When you configure your FFmpeg build, all the supported protocols are
  6. enabled by default. You can list all available ones using the
  7. configure option "--list-protocols".
  8. You can disable all the protocols using the configure option
  9. "--disable-protocols", and selectively enable a protocol using the
  10. option "--enable-protocol=@var{PROTOCOL}", or you can disable a
  11. particular protocol using the option
  12. "--disable-protocol=@var{PROTOCOL}".
  13. The option "-protocols" of the ff* tools will display the list of
  14. supported protocols.
  15. A description of the currently available protocols follows.
  16. @section bluray
  17. Read BluRay playlist.
  18. The accepted options are:
  19. @table @option
  20. @item angle
  21. BluRay angle
  22. @item chapter
  23. Start chapter (1...N)
  24. @item playlist
  25. Playlist to read (BDMV/PLAYLIST/?????.mpls)
  26. @end table
  27. Examples:
  28. Read longest playlist from BluRay mounted to /mnt/bluray:
  29. @example
  30. bluray:/mnt/bluray
  31. @end example
  32. Read angle 2 of playlist 4 from BluRay mounted to /mnt/bluray, start from chapter 2:
  33. @example
  34. -playlist 4 -angle 2 -chapter 2 bluray:/mnt/bluray
  35. @end example
  36. @section cache
  37. Caching wrapper for input stream.
  38. Cache the input stream to temporary file. It brings seeking capability to live streams.
  39. @example
  40. cache:@var{URL}
  41. @end example
  42. @section concat
  43. Physical concatenation protocol.
  44. Allow to read and seek from many resource in sequence as if they were
  45. a unique resource.
  46. A URL accepted by this protocol has the syntax:
  47. @example
  48. concat:@var{URL1}|@var{URL2}|...|@var{URLN}
  49. @end example
  50. where @var{URL1}, @var{URL2}, ..., @var{URLN} are the urls of the
  51. resource to be concatenated, each one possibly specifying a distinct
  52. protocol.
  53. For example to read a sequence of files @file{split1.mpeg},
  54. @file{split2.mpeg}, @file{split3.mpeg} with @command{ffplay} use the
  55. command:
  56. @example
  57. ffplay concat:split1.mpeg\|split2.mpeg\|split3.mpeg
  58. @end example
  59. Note that you may need to escape the character "|" which is special for
  60. many shells.
  61. @section crypto
  62. AES-encrypted stream reading protocol.
  63. The accepted options are:
  64. @table @option
  65. @item key
  66. Set the AES decryption key binary block from given hexadecimal representation.
  67. @item iv
  68. Set the AES decryption initialization vector binary block from given hexadecimal representation.
  69. @end table
  70. Accepted URL formats:
  71. @example
  72. crypto:@var{URL}
  73. crypto+@var{URL}
  74. @end example
  75. @section data
  76. Data in-line in the URI. See @url{http://en.wikipedia.org/wiki/Data_URI_scheme}.
  77. For example, to convert a GIF file given inline with @command{ffmpeg}:
  78. @example
  79. ffmpeg -i "data:image/gif;base64,R0lGODdhCAAIAMIEAAAAAAAA//8AAP//AP///////////////ywAAAAACAAIAAADF0gEDLojDgdGiJdJqUX02iB4E8Q9jUMkADs=" smiley.png
  80. @end example
  81. @section file
  82. File access protocol.
  83. Allow to read from or read to a file.
  84. For example to read from a file @file{input.mpeg} with @command{ffmpeg}
  85. use the command:
  86. @example
  87. ffmpeg -i file:input.mpeg output.mpeg
  88. @end example
  89. The ff* tools default to the file protocol, that is a resource
  90. specified with the name "FILE.mpeg" is interpreted as the URL
  91. "file:FILE.mpeg".
  92. @section ftp
  93. FTP (File Transfer Protocol).
  94. Allow to read from or write to remote resources using FTP protocol.
  95. Following syntax is required.
  96. @example
  97. ftp://[user[:password]@@]server[:port]/path/to/remote/resource.mpeg
  98. @end example
  99. This protocol accepts the following options.
  100. @table @option
  101. @item timeout
  102. Set timeout of socket I/O operations used by the underlying low level
  103. operation. By default it is set to -1, which means that the timeout is
  104. not specified.
  105. @item ftp-anonymous-password
  106. Password used when login as anonymous user. Typically an e-mail address
  107. should be used.
  108. @item ftp-write-seekable
  109. Control seekability of connection during encoding. If set to 1 the
  110. resource is supposed to be seekable, if set to 0 it is assumed not
  111. to be seekable. Default value is 0.
  112. @end table
  113. NOTE: Protocol can be used as output, but it is recommended to not do
  114. it, unless special care is taken (tests, customized server configuration
  115. etc.). Different FTP servers behave in different way during seek
  116. operation. ff* tools may produce incomplete content due to server limitations.
  117. @section gopher
  118. Gopher protocol.
  119. @section hls
  120. Read Apple HTTP Live Streaming compliant segmented stream as
  121. a uniform one. The M3U8 playlists describing the segments can be
  122. remote HTTP resources or local files, accessed using the standard
  123. file protocol.
  124. The nested protocol is declared by specifying
  125. "+@var{proto}" after the hls URI scheme name, where @var{proto}
  126. is either "file" or "http".
  127. @example
  128. hls+http://host/path/to/remote/resource.m3u8
  129. hls+file://path/to/local/resource.m3u8
  130. @end example
  131. Using this protocol is discouraged - the hls demuxer should work
  132. just as well (if not, please report the issues) and is more complete.
  133. To use the hls demuxer instead, simply use the direct URLs to the
  134. m3u8 files.
  135. @section http
  136. HTTP (Hyper Text Transfer Protocol).
  137. This protocol accepts the following options.
  138. @table @option
  139. @item seekable
  140. Control seekability of connection. If set to 1 the resource is
  141. supposed to be seekable, if set to 0 it is assumed not to be seekable,
  142. if set to -1 it will try to autodetect if it is seekable. Default
  143. value is -1.
  144. @item chunked_post
  145. If set to 1 use chunked transfer-encoding for posts, default is 1.
  146. @item headers
  147. Set custom HTTP headers, can override built in default headers. The
  148. value must be a string encoding the headers.
  149. @item content_type
  150. Force a content type.
  151. @item user-agent
  152. Override User-Agent header. If not specified the protocol will use a
  153. string describing the libavformat build.
  154. @item multiple_requests
  155. Use persistent connections if set to 1. By default it is 0.
  156. @item post_data
  157. Set custom HTTP post data.
  158. @item timeout
  159. Set timeout of socket I/O operations used by the underlying low level
  160. operation. By default it is set to -1, which means that the timeout is
  161. not specified.
  162. @item mime_type
  163. Set MIME type.
  164. @item icy
  165. If set to 1 request ICY (SHOUTcast) metadata from the server. If the server
  166. supports this, the metadata has to be retrieved by the application by reading
  167. the @option{icy_metadata_headers} and @option{icy_metadata_packet} options.
  168. The default is 0.
  169. @item icy_metadata_headers
  170. If the server supports ICY metadata, this contains the ICY specific HTTP reply
  171. headers, separated with newline characters.
  172. @item icy_metadata_packet
  173. If the server supports ICY metadata, and @option{icy} was set to 1, this
  174. contains the last non-empty metadata packet sent by the server.
  175. @item cookies
  176. Set the cookies to be sent in future requests. The format of each cookie is the
  177. same as the value of a Set-Cookie HTTP response field. Multiple cookies can be
  178. delimited by a newline character.
  179. @end table
  180. @subsection HTTP Cookies
  181. Some HTTP requests will be denied unless cookie values are passed in with the
  182. request. The @option{cookies} option allows these cookies to be specified. At
  183. the very least, each cookie must specify a value along with a path and domain.
  184. HTTP requests that match both the domain and path will automatically include the
  185. cookie value in the HTTP Cookie header field. Multiple cookies can be delimited
  186. by a newline.
  187. The required syntax to play a stream specifying a cookie is:
  188. @example
  189. ffplay -cookies "nlqptid=nltid=tsn; path=/; domain=somedomain.com;" http://somedomain.com/somestream.m3u8
  190. @end example
  191. @section mmst
  192. MMS (Microsoft Media Server) protocol over TCP.
  193. @section mmsh
  194. MMS (Microsoft Media Server) protocol over HTTP.
  195. The required syntax is:
  196. @example
  197. mmsh://@var{server}[:@var{port}][/@var{app}][/@var{playpath}]
  198. @end example
  199. @section md5
  200. MD5 output protocol.
  201. Computes the MD5 hash of the data to be written, and on close writes
  202. this to the designated output or stdout if none is specified. It can
  203. be used to test muxers without writing an actual file.
  204. Some examples follow.
  205. @example
  206. # Write the MD5 hash of the encoded AVI file to the file output.avi.md5.
  207. ffmpeg -i input.flv -f avi -y md5:output.avi.md5
  208. # Write the MD5 hash of the encoded AVI file to stdout.
  209. ffmpeg -i input.flv -f avi -y md5:
  210. @end example
  211. Note that some formats (typically MOV) require the output protocol to
  212. be seekable, so they will fail with the MD5 output protocol.
  213. @section pipe
  214. UNIX pipe access protocol.
  215. Allow to read and write from UNIX pipes.
  216. The accepted syntax is:
  217. @example
  218. pipe:[@var{number}]
  219. @end example
  220. @var{number} is the number corresponding to the file descriptor of the
  221. pipe (e.g. 0 for stdin, 1 for stdout, 2 for stderr). If @var{number}
  222. is not specified, by default the stdout file descriptor will be used
  223. for writing, stdin for reading.
  224. For example to read from stdin with @command{ffmpeg}:
  225. @example
  226. cat test.wav | ffmpeg -i pipe:0
  227. # ...this is the same as...
  228. cat test.wav | ffmpeg -i pipe:
  229. @end example
  230. For writing to stdout with @command{ffmpeg}:
  231. @example
  232. ffmpeg -i test.wav -f avi pipe:1 | cat > test.avi
  233. # ...this is the same as...
  234. ffmpeg -i test.wav -f avi pipe: | cat > test.avi
  235. @end example
  236. Note that some formats (typically MOV), require the output protocol to
  237. be seekable, so they will fail with the pipe output protocol.
  238. @section rtmp
  239. Real-Time Messaging Protocol.
  240. The Real-Time Messaging Protocol (RTMP) is used for streaming multimedia
  241. content across a TCP/IP network.
  242. The required syntax is:
  243. @example
  244. rtmp://@var{server}[:@var{port}][/@var{app}][/@var{instance}][/@var{playpath}]
  245. @end example
  246. The accepted parameters are:
  247. @table @option
  248. @item server
  249. The address of the RTMP server.
  250. @item port
  251. The number of the TCP port to use (by default is 1935).
  252. @item app
  253. It is the name of the application to access. It usually corresponds to
  254. the path where the application is installed on the RTMP server
  255. (e.g. @file{/ondemand/}, @file{/flash/live/}, etc.). You can override
  256. the value parsed from the URI through the @code{rtmp_app} option, too.
  257. @item playpath
  258. It is the path or name of the resource to play with reference to the
  259. application specified in @var{app}, may be prefixed by "mp4:". You
  260. can override the value parsed from the URI through the @code{rtmp_playpath}
  261. option, too.
  262. @item listen
  263. Act as a server, listening for an incoming connection.
  264. @item timeout
  265. Maximum time to wait for the incoming connection. Implies listen.
  266. @end table
  267. Additionally, the following parameters can be set via command line options
  268. (or in code via @code{AVOption}s):
  269. @table @option
  270. @item rtmp_app
  271. Name of application to connect on the RTMP server. This option
  272. overrides the parameter specified in the URI.
  273. @item rtmp_buffer
  274. Set the client buffer time in milliseconds. The default is 3000.
  275. @item rtmp_conn
  276. Extra arbitrary AMF connection parameters, parsed from a string,
  277. e.g. like @code{B:1 S:authMe O:1 NN:code:1.23 NS:flag:ok O:0}.
  278. Each value is prefixed by a single character denoting the type,
  279. B for Boolean, N for number, S for string, O for object, or Z for null,
  280. followed by a colon. For Booleans the data must be either 0 or 1 for
  281. FALSE or TRUE, respectively. Likewise for Objects the data must be 0 or
  282. 1 to end or begin an object, respectively. Data items in subobjects may
  283. be named, by prefixing the type with 'N' and specifying the name before
  284. the value (i.e. @code{NB:myFlag:1}). This option may be used multiple
  285. times to construct arbitrary AMF sequences.
  286. @item rtmp_flashver
  287. Version of the Flash plugin used to run the SWF player. The default
  288. is LNX 9,0,124,2.
  289. @item rtmp_flush_interval
  290. Number of packets flushed in the same request (RTMPT only). The default
  291. is 10.
  292. @item rtmp_live
  293. Specify that the media is a live stream. No resuming or seeking in
  294. live streams is possible. The default value is @code{any}, which means the
  295. subscriber first tries to play the live stream specified in the
  296. playpath. If a live stream of that name is not found, it plays the
  297. recorded stream. The other possible values are @code{live} and
  298. @code{recorded}.
  299. @item rtmp_pageurl
  300. URL of the web page in which the media was embedded. By default no
  301. value will be sent.
  302. @item rtmp_playpath
  303. Stream identifier to play or to publish. This option overrides the
  304. parameter specified in the URI.
  305. @item rtmp_subscribe
  306. Name of live stream to subscribe to. By default no value will be sent.
  307. It is only sent if the option is specified or if rtmp_live
  308. is set to live.
  309. @item rtmp_swfhash
  310. SHA256 hash of the decompressed SWF file (32 bytes).
  311. @item rtmp_swfsize
  312. Size of the decompressed SWF file, required for SWFVerification.
  313. @item rtmp_swfurl
  314. URL of the SWF player for the media. By default no value will be sent.
  315. @item rtmp_swfverify
  316. URL to player swf file, compute hash/size automatically.
  317. @item rtmp_tcurl
  318. URL of the target stream. Defaults to proto://host[:port]/app.
  319. @end table
  320. For example to read with @command{ffplay} a multimedia resource named
  321. "sample" from the application "vod" from an RTMP server "myserver":
  322. @example
  323. ffplay rtmp://myserver/vod/sample
  324. @end example
  325. @section rtmpe
  326. Encrypted Real-Time Messaging Protocol.
  327. The Encrypted Real-Time Messaging Protocol (RTMPE) is used for
  328. streaming multimedia content within standard cryptographic primitives,
  329. consisting of Diffie-Hellman key exchange and HMACSHA256, generating
  330. a pair of RC4 keys.
  331. @section rtmps
  332. Real-Time Messaging Protocol over a secure SSL connection.
  333. The Real-Time Messaging Protocol (RTMPS) is used for streaming
  334. multimedia content across an encrypted connection.
  335. @section rtmpt
  336. Real-Time Messaging Protocol tunneled through HTTP.
  337. The Real-Time Messaging Protocol tunneled through HTTP (RTMPT) is used
  338. for streaming multimedia content within HTTP requests to traverse
  339. firewalls.
  340. @section rtmpte
  341. Encrypted Real-Time Messaging Protocol tunneled through HTTP.
  342. The Encrypted Real-Time Messaging Protocol tunneled through HTTP (RTMPTE)
  343. is used for streaming multimedia content within HTTP requests to traverse
  344. firewalls.
  345. @section rtmpts
  346. Real-Time Messaging Protocol tunneled through HTTPS.
  347. The Real-Time Messaging Protocol tunneled through HTTPS (RTMPTS) is used
  348. for streaming multimedia content within HTTPS requests to traverse
  349. firewalls.
  350. @section rtmp, rtmpe, rtmps, rtmpt, rtmpte
  351. Real-Time Messaging Protocol and its variants supported through
  352. librtmp.
  353. Requires the presence of the librtmp headers and library during
  354. configuration. You need to explicitly configure the build with
  355. "--enable-librtmp". If enabled this will replace the native RTMP
  356. protocol.
  357. This protocol provides most client functions and a few server
  358. functions needed to support RTMP, RTMP tunneled in HTTP (RTMPT),
  359. encrypted RTMP (RTMPE), RTMP over SSL/TLS (RTMPS) and tunneled
  360. variants of these encrypted types (RTMPTE, RTMPTS).
  361. The required syntax is:
  362. @example
  363. @var{rtmp_proto}://@var{server}[:@var{port}][/@var{app}][/@var{playpath}] @var{options}
  364. @end example
  365. where @var{rtmp_proto} is one of the strings "rtmp", "rtmpt", "rtmpe",
  366. "rtmps", "rtmpte", "rtmpts" corresponding to each RTMP variant, and
  367. @var{server}, @var{port}, @var{app} and @var{playpath} have the same
  368. meaning as specified for the RTMP native protocol.
  369. @var{options} contains a list of space-separated options of the form
  370. @var{key}=@var{val}.
  371. See the librtmp manual page (man 3 librtmp) for more information.
  372. For example, to stream a file in real-time to an RTMP server using
  373. @command{ffmpeg}:
  374. @example
  375. ffmpeg -re -i myfile -f flv rtmp://myserver/live/mystream
  376. @end example
  377. To play the same stream using @command{ffplay}:
  378. @example
  379. ffplay "rtmp://myserver/live/mystream live=1"
  380. @end example
  381. @section rtp
  382. Real-Time Protocol.
  383. @section rtsp
  384. RTSP is not technically a protocol handler in libavformat, it is a demuxer
  385. and muxer. The demuxer supports both normal RTSP (with data transferred
  386. over RTP; this is used by e.g. Apple and Microsoft) and Real-RTSP (with
  387. data transferred over RDT).
  388. The muxer can be used to send a stream using RTSP ANNOUNCE to a server
  389. supporting it (currently Darwin Streaming Server and Mischa Spiegelmock's
  390. @uref{http://github.com/revmischa/rtsp-server, RTSP server}).
  391. The required syntax for a RTSP url is:
  392. @example
  393. rtsp://@var{hostname}[:@var{port}]/@var{path}
  394. @end example
  395. The following options (set on the @command{ffmpeg}/@command{ffplay} command
  396. line, or set in code via @code{AVOption}s or in @code{avformat_open_input}),
  397. are supported:
  398. Flags for @code{rtsp_transport}:
  399. @table @option
  400. @item udp
  401. Use UDP as lower transport protocol.
  402. @item tcp
  403. Use TCP (interleaving within the RTSP control channel) as lower
  404. transport protocol.
  405. @item udp_multicast
  406. Use UDP multicast as lower transport protocol.
  407. @item http
  408. Use HTTP tunneling as lower transport protocol, which is useful for
  409. passing proxies.
  410. @end table
  411. Multiple lower transport protocols may be specified, in that case they are
  412. tried one at a time (if the setup of one fails, the next one is tried).
  413. For the muxer, only the @code{tcp} and @code{udp} options are supported.
  414. Flags for @code{rtsp_flags}:
  415. @table @option
  416. @item filter_src
  417. Accept packets only from negotiated peer address and port.
  418. @item listen
  419. Act as a server, listening for an incoming connection.
  420. @end table
  421. When receiving data over UDP, the demuxer tries to reorder received packets
  422. (since they may arrive out of order, or packets may get lost totally). This
  423. can be disabled by setting the maximum demuxing delay to zero (via
  424. the @code{max_delay} field of AVFormatContext).
  425. When watching multi-bitrate Real-RTSP streams with @command{ffplay}, the
  426. streams to display can be chosen with @code{-vst} @var{n} and
  427. @code{-ast} @var{n} for video and audio respectively, and can be switched
  428. on the fly by pressing @code{v} and @code{a}.
  429. Example command lines:
  430. To watch a stream over UDP, with a max reordering delay of 0.5 seconds:
  431. @example
  432. ffplay -max_delay 500000 -rtsp_transport udp rtsp://server/video.mp4
  433. @end example
  434. To watch a stream tunneled over HTTP:
  435. @example
  436. ffplay -rtsp_transport http rtsp://server/video.mp4
  437. @end example
  438. To send a stream in realtime to a RTSP server, for others to watch:
  439. @example
  440. ffmpeg -re -i @var{input} -f rtsp -muxdelay 0.1 rtsp://server/live.sdp
  441. @end example
  442. To receive a stream in realtime:
  443. @example
  444. ffmpeg -rtsp_flags listen -i rtsp://ownaddress/live.sdp @var{output}
  445. @end example
  446. @table @option
  447. @item stimeout
  448. Socket IO timeout in micro seconds.
  449. @end table
  450. @section sap
  451. Session Announcement Protocol (RFC 2974). This is not technically a
  452. protocol handler in libavformat, it is a muxer and demuxer.
  453. It is used for signalling of RTP streams, by announcing the SDP for the
  454. streams regularly on a separate port.
  455. @subsection Muxer
  456. The syntax for a SAP url given to the muxer is:
  457. @example
  458. sap://@var{destination}[:@var{port}][?@var{options}]
  459. @end example
  460. The RTP packets are sent to @var{destination} on port @var{port},
  461. or to port 5004 if no port is specified.
  462. @var{options} is a @code{&}-separated list. The following options
  463. are supported:
  464. @table @option
  465. @item announce_addr=@var{address}
  466. Specify the destination IP address for sending the announcements to.
  467. If omitted, the announcements are sent to the commonly used SAP
  468. announcement multicast address 224.2.127.254 (sap.mcast.net), or
  469. ff0e::2:7ffe if @var{destination} is an IPv6 address.
  470. @item announce_port=@var{port}
  471. Specify the port to send the announcements on, defaults to
  472. 9875 if not specified.
  473. @item ttl=@var{ttl}
  474. Specify the time to live value for the announcements and RTP packets,
  475. defaults to 255.
  476. @item same_port=@var{0|1}
  477. If set to 1, send all RTP streams on the same port pair. If zero (the
  478. default), all streams are sent on unique ports, with each stream on a
  479. port 2 numbers higher than the previous.
  480. VLC/Live555 requires this to be set to 1, to be able to receive the stream.
  481. The RTP stack in libavformat for receiving requires all streams to be sent
  482. on unique ports.
  483. @end table
  484. Example command lines follow.
  485. To broadcast a stream on the local subnet, for watching in VLC:
  486. @example
  487. ffmpeg -re -i @var{input} -f sap sap://224.0.0.255?same_port=1
  488. @end example
  489. Similarly, for watching in @command{ffplay}:
  490. @example
  491. ffmpeg -re -i @var{input} -f sap sap://224.0.0.255
  492. @end example
  493. And for watching in @command{ffplay}, over IPv6:
  494. @example
  495. ffmpeg -re -i @var{input} -f sap sap://[ff0e::1:2:3:4]
  496. @end example
  497. @subsection Demuxer
  498. The syntax for a SAP url given to the demuxer is:
  499. @example
  500. sap://[@var{address}][:@var{port}]
  501. @end example
  502. @var{address} is the multicast address to listen for announcements on,
  503. if omitted, the default 224.2.127.254 (sap.mcast.net) is used. @var{port}
  504. is the port that is listened on, 9875 if omitted.
  505. The demuxers listens for announcements on the given address and port.
  506. Once an announcement is received, it tries to receive that particular stream.
  507. Example command lines follow.
  508. To play back the first stream announced on the normal SAP multicast address:
  509. @example
  510. ffplay sap://
  511. @end example
  512. To play back the first stream announced on one the default IPv6 SAP multicast address:
  513. @example
  514. ffplay sap://[ff0e::2:7ffe]
  515. @end example
  516. @section sctp
  517. Stream Control Transmission Protocol.
  518. The accepted URL syntax is:
  519. @example
  520. sctp://@var{host}:@var{port}[?@var{options}]
  521. @end example
  522. The protocol accepts the following options:
  523. @table @option
  524. @item listen
  525. If set to any value, listen for an incoming connection. Outgoing connection is done by default.
  526. @item max_streams
  527. Set the maximum number of streams. By default no limit is set.
  528. @end table
  529. @section srtp
  530. Secure Real-time Transport Protocol.
  531. The accepted options are:
  532. @table @option
  533. @item srtp_in_suite
  534. @item srtp_out_suite
  535. Select input and output encoding suites.
  536. Supported values:
  537. @table @samp
  538. @item AES_CM_128_HMAC_SHA1_80
  539. @item SRTP_AES128_CM_HMAC_SHA1_80
  540. @item AES_CM_128_HMAC_SHA1_32
  541. @item SRTP_AES128_CM_HMAC_SHA1_32
  542. @end table
  543. @item srtp_in_params
  544. @item srtp_out_params
  545. Set input and output encoding parameters, which are expressed by a
  546. base64-encoded representation of a binary block. The first 16 bytes of
  547. this binary block are used as master key, the following 14 bytes are
  548. used as master salt.
  549. @end table
  550. @section tcp
  551. Trasmission Control Protocol.
  552. The required syntax for a TCP url is:
  553. @example
  554. tcp://@var{hostname}:@var{port}[?@var{options}]
  555. @end example
  556. @table @option
  557. @item listen
  558. Listen for an incoming connection
  559. @item timeout=@var{microseconds}
  560. In read mode: if no data arrived in more than this time interval, raise error.
  561. In write mode: if socket cannot be written in more than this time interval, raise error.
  562. This also sets timeout on TCP connection establishing.
  563. @example
  564. ffmpeg -i @var{input} -f @var{format} tcp://@var{hostname}:@var{port}?listen
  565. ffplay tcp://@var{hostname}:@var{port}
  566. @end example
  567. @end table
  568. @section tls
  569. Transport Layer Security/Secure Sockets Layer
  570. The required syntax for a TLS/SSL url is:
  571. @example
  572. tls://@var{hostname}:@var{port}[?@var{options}]
  573. @end example
  574. @table @option
  575. @item listen
  576. Act as a server, listening for an incoming connection.
  577. @item cafile=@var{filename}
  578. Certificate authority file. The file must be in OpenSSL PEM format.
  579. @item cert=@var{filename}
  580. Certificate file. The file must be in OpenSSL PEM format.
  581. @item key=@var{filename}
  582. Private key file.
  583. @item verify=@var{0|1}
  584. Verify the peer's certificate.
  585. @end table
  586. Example command lines:
  587. To create a TLS/SSL server that serves an input stream.
  588. @example
  589. ffmpeg -i @var{input} -f @var{format} tls://@var{hostname}:@var{port}?listen&cert=@var{server.crt}&key=@var{server.key}
  590. @end example
  591. To play back a stream from the TLS/SSL server using @command{ffplay}:
  592. @example
  593. ffplay tls://@var{hostname}:@var{port}
  594. @end example
  595. @section udp
  596. User Datagram Protocol.
  597. The required syntax for a UDP url is:
  598. @example
  599. udp://@var{hostname}:@var{port}[?@var{options}]
  600. @end example
  601. @var{options} contains a list of &-separated options of the form @var{key}=@var{val}.
  602. In case threading is enabled on the system, a circular buffer is used
  603. to store the incoming data, which allows to reduce loss of data due to
  604. UDP socket buffer overruns. The @var{fifo_size} and
  605. @var{overrun_nonfatal} options are related to this buffer.
  606. The list of supported options follows.
  607. @table @option
  608. @item buffer_size=@var{size}
  609. Set the UDP socket buffer size in bytes. This is used both for the
  610. receiving and the sending buffer size.
  611. @item localport=@var{port}
  612. Override the local UDP port to bind with.
  613. @item localaddr=@var{addr}
  614. Choose the local IP address. This is useful e.g. if sending multicast
  615. and the host has multiple interfaces, where the user can choose
  616. which interface to send on by specifying the IP address of that interface.
  617. @item pkt_size=@var{size}
  618. Set the size in bytes of UDP packets.
  619. @item reuse=@var{1|0}
  620. Explicitly allow or disallow reusing UDP sockets.
  621. @item ttl=@var{ttl}
  622. Set the time to live value (for multicast only).
  623. @item connect=@var{1|0}
  624. Initialize the UDP socket with @code{connect()}. In this case, the
  625. destination address can't be changed with ff_udp_set_remote_url later.
  626. If the destination address isn't known at the start, this option can
  627. be specified in ff_udp_set_remote_url, too.
  628. This allows finding out the source address for the packets with getsockname,
  629. and makes writes return with AVERROR(ECONNREFUSED) if "destination
  630. unreachable" is received.
  631. For receiving, this gives the benefit of only receiving packets from
  632. the specified peer address/port.
  633. @item sources=@var{address}[,@var{address}]
  634. Only receive packets sent to the multicast group from one of the
  635. specified sender IP addresses.
  636. @item block=@var{address}[,@var{address}]
  637. Ignore packets sent to the multicast group from the specified
  638. sender IP addresses.
  639. @item fifo_size=@var{units}
  640. Set the UDP receiving circular buffer size, expressed as a number of
  641. packets with size of 188 bytes. If not specified defaults to 7*4096.
  642. @item overrun_nonfatal=@var{1|0}
  643. Survive in case of UDP receiving circular buffer overrun. Default
  644. value is 0.
  645. @item timeout=@var{microseconds}
  646. In read mode: if no data arrived in more than this time interval, raise error.
  647. @end table
  648. Some usage examples of the UDP protocol with @command{ffmpeg} follow.
  649. To stream over UDP to a remote endpoint:
  650. @example
  651. ffmpeg -i @var{input} -f @var{format} udp://@var{hostname}:@var{port}
  652. @end example
  653. To stream in mpegts format over UDP using 188 sized UDP packets, using a large input buffer:
  654. @example
  655. ffmpeg -i @var{input} -f mpegts udp://@var{hostname}:@var{port}?pkt_size=188&buffer_size=65535
  656. @end example
  657. To receive over UDP from a remote endpoint:
  658. @example
  659. ffmpeg -i udp://[@var{multicast-address}]:@var{port}
  660. @end example
  661. @c man end PROTOCOLS