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.

840 lines
24KB

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