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