http: Improve options descriptions
[libav.git] / doc / protocols.texi
CommitLineData
1de4cfe6
SS
1@chapter Protocols
2@c man begin PROTOCOLS
3
f8a45fa1 4Protocols are configured elements in Libav which allow to access
1de4cfe6
SS
5resources which require the use of a particular protocol.
6
f8a45fa1 7When you configure your Libav build, all the supported protocols are
209e451a
SS
8enabled by default. You can list all available ones using the
9configure option "--list-protocols".
1de4cfe6
SS
10
11You can disable all the protocols using the configure option
12"--disable-protocols", and selectively enable a protocol using the
13option "--enable-protocol=@var{PROTOCOL}", or you can disable a
14particular protocol using the option
15"--disable-protocol=@var{PROTOCOL}".
16
202b5f6d 17The option "-protocols" of the av* tools will display the list of
209e451a 18supported protocols.
1de4cfe6
SS
19
20A description of the currently available protocols follows.
21
22@section concat
23
24Physical concatenation protocol.
25
209e451a
SS
26Allow to read and seek from many resource in sequence as if they were
27a unique resource.
1de4cfe6 28
2d7b5f09 29A URL accepted by this protocol has the syntax:
1de4cfe6
SS
30@example
31concat:@var{URL1}|@var{URL2}|...|@var{URLN}
32@end example
33
34where @var{URL1}, @var{URL2}, ..., @var{URLN} are the urls of the
35resource to be concatenated, each one possibly specifying a distinct
36protocol.
37
38For example to read a sequence of files @file{split1.mpeg},
90c9edba 39@file{split2.mpeg}, @file{split3.mpeg} with @command{avplay} use the
1de4cfe6
SS
40command:
41@example
266463da 42avplay concat:split1.mpeg\|split2.mpeg\|split3.mpeg
1de4cfe6
SS
43@end example
44
45Note that you may need to escape the character "|" which is special for
46many shells.
47
48@section file
49
50File access protocol.
51
52Allow to read from or read to a file.
53
d5837d7f 54For example to read from a file @file{input.mpeg} with @command{avconv}
1de4cfe6
SS
55use the command:
56@example
d5837d7f 57avconv -i file:input.mpeg output.mpeg
1de4cfe6
SS
58@end example
59
202b5f6d 60The av* tools default to the file protocol, that is a resource
209e451a
SS
61specified with the name "FILE.mpeg" is interpreted as the URL
62"file:FILE.mpeg".
1de4cfe6
SS
63
64@section gopher
65
66Gopher protocol.
67
3975ca89
MS
68@section hls
69
70Read Apple HTTP Live Streaming compliant segmented stream as
71a uniform one. The M3U8 playlists describing the segments can be
72remote HTTP resources or local files, accessed using the standard
73file protocol.
74The nested protocol is declared by specifying
75"+@var{proto}" after the hls URI scheme name, where @var{proto}
76is either "file" or "http".
77
78@example
79hls+http://host/path/to/remote/resource.m3u8
80hls+file://path/to/local/resource.m3u8
81@end example
82
9cb9c6c4
MS
83Using this protocol is discouraged - the hls demuxer should work
84just as well (if not, please report the issues) and is more complete.
85To use the hls demuxer instead, simply use the direct URLs to the
86m3u8 files.
87
1de4cfe6
SS
88@section http
89
209e451a 90HTTP (Hyper Text Transfer Protocol).
1de4cfe6 91
8075c3d8
LB
92This protocol accepts the following options:
93
94@table @option
fe568b3d
AG
95@item chunked_post
96If set to 1 use chunked Transfer-Encoding for posts, default is 1.
97
98@item headers
99Set custom HTTP headers, can override built in default headers. The
100value must be a string encoding the headers.
101
102@item multiple_requests
103Use persistent connections if set to 1, default is 0.
104
105@item post_data
106Set custom HTTP post data.
107
ddfc9890
CB
108@item user_agent
109Override the User-Agent header. If not specified a string of the form
110"Lavf/<version>" will be used.
111
e58c85b0
MN
112@item mime_type
113Export the MIME type.
114
8075c3d8
LB
115@item icy
116If set to 1 request ICY (SHOUTcast) metadata from the server. If the server
117supports this, the metadata has to be retrieved by the application by reading
118the @option{icy_metadata_headers} and @option{icy_metadata_packet} options.
119The default is 0.
120
121@item icy_metadata_headers
122If the server supports ICY metadata, this contains the ICY-specific HTTP reply
123headers, separated by newline characters.
124
125@item icy_metadata_packet
126If the server supports ICY metadata, and @option{icy} was set to 1, this
127contains the last non-empty metadata packet sent by the server. It should be
128polled in regular intervals by applications interested in mid-stream metadata
129updates.
2ec33d27
AH
130
131@item offset
132Set initial byte offset.
133
134@item end_offset
135Try to limit the request to bytes preceding this offset.
8075c3d8
LB
136@end table
137
1de4cfe6
SS
138@section mmst
139
140MMS (Microsoft Media Server) protocol over TCP.
141
f5ea69b2
RB
142@section mmsh
143
144MMS (Microsoft Media Server) protocol over HTTP.
145
146The required syntax is:
147@example
148mmsh://@var{server}[:@var{port}][/@var{app}][/@var{playpath}]
149@end example
150
1de4cfe6
SS
151@section md5
152
153MD5 output protocol.
154
209e451a
SS
155Computes the MD5 hash of the data to be written, and on close writes
156this to the designated output or stdout if none is specified. It can
157be used to test muxers without writing an actual file.
1de4cfe6
SS
158
159Some examples follow.
160@example
2d7b5f09 161# Write the MD5 hash of the encoded AVI file to the file output.avi.md5.
d5837d7f 162avconv -i input.flv -f avi -y md5:output.avi.md5
1de4cfe6 163
209e451a 164# Write the MD5 hash of the encoded AVI file to stdout.
d5837d7f 165avconv -i input.flv -f avi -y md5:
1de4cfe6
SS
166@end example
167
209e451a 168Note that some formats (typically MOV) require the output protocol to
1de4cfe6
SS
169be seekable, so they will fail with the MD5 output protocol.
170
171@section pipe
172
173UNIX pipe access protocol.
174
175Allow to read and write from UNIX pipes.
176
177The accepted syntax is:
178@example
179pipe:[@var{number}]
180@end example
181
182@var{number} is the number corresponding to the file descriptor of the
209e451a
SS
183pipe (e.g. 0 for stdin, 1 for stdout, 2 for stderr). If @var{number}
184is not specified, by default the stdout file descriptor will be used
185for writing, stdin for reading.
1de4cfe6 186
d5837d7f 187For example to read from stdin with @command{avconv}:
1de4cfe6 188@example
d5837d7f 189cat test.wav | avconv -i pipe:0
209e451a 190# ...this is the same as...
d5837d7f 191cat test.wav | avconv -i pipe:
1de4cfe6
SS
192@end example
193
d5837d7f 194For writing to stdout with @command{avconv}:
1de4cfe6 195@example
d5837d7f 196avconv -i test.wav -f avi pipe:1 | cat > test.avi
209e451a 197# ...this is the same as...
d5837d7f 198avconv -i test.wav -f avi pipe: | cat > test.avi
1de4cfe6
SS
199@end example
200
209e451a 201Note that some formats (typically MOV), require the output protocol to
1de4cfe6
SS
202be seekable, so they will fail with the pipe output protocol.
203
204@section rtmp
205
206Real-Time Messaging Protocol.
207
da9cea77
DB
208The Real-Time Messaging Protocol (RTMP) is used for streaming multimedia
209content across a TCP/IP network.
1de4cfe6
SS
210
211The required syntax is:
212@example
aa16a6b0 213rtmp://[@var{username}:@var{password}@@]@var{server}[:@var{port}][/@var{app}][/@var{instance}][/@var{playpath}]
1de4cfe6
SS
214@end example
215
209e451a 216The accepted parameters are:
1de4cfe6
SS
217@table @option
218
aa16a6b0
MS
219@item username
220An optional username (mostly for publishing).
221
222@item password
223An optional password (mostly for publishing).
224
1de4cfe6 225@item server
209e451a 226The address of the RTMP server.
1de4cfe6
SS
227
228@item port
209e451a 229The number of the TCP port to use (by default is 1935).
1de4cfe6
SS
230
231@item app
209e451a
SS
232It is the name of the application to access. It usually corresponds to
233the path where the application is installed on the RTMP server
b4c92e94
SP
234(e.g. @file{/ondemand/}, @file{/flash/live/}, etc.). You can override
235the value parsed from the URI through the @code{rtmp_app} option, too.
1de4cfe6
SS
236
237@item playpath
238It is the path or name of the resource to play with reference to the
b4c92e94
SP
239application specified in @var{app}, may be prefixed by "mp4:". You
240can override the value parsed from the URI through the @code{rtmp_playpath}
241option, too.
242
e5f2731c
JO
243@item listen
244Act as a server, listening for an incoming connection.
245
246@item timeout
247Maximum time to wait for the incoming connection. Implies listen.
b4c92e94
SP
248@end table
249
250Additionally, the following parameters can be set via command line options
251(or in code via @code{AVOption}s):
252@table @option
253
254@item rtmp_app
255Name of application to connect on the RTMP server. This option
256overrides the parameter specified in the URI.
257
8517e9c4
SP
258@item rtmp_buffer
259Set the client buffer time in milliseconds. The default is 3000.
260
8ee3e187
SP
261@item rtmp_conn
262Extra arbitrary AMF connection parameters, parsed from a string,
263e.g. like @code{B:1 S:authMe O:1 NN:code:1.23 NS:flag:ok O:0}.
264Each value is prefixed by a single character denoting the type,
265B for Boolean, N for number, S for string, O for object, or Z for null,
266followed by a colon. For Booleans the data must be either 0 or 1 for
267FALSE or TRUE, respectively. Likewise for Objects the data must be 0 or
2681 to end or begin an object, respectively. Data items in subobjects may
269be named, by prefixing the type with 'N' and specifying the name before
270the value (i.e. @code{NB:myFlag:1}). This option may be used multiple
271times to construct arbitrary AMF sequences.
272
b4c92e94
SP
273@item rtmp_flashver
274Version of the Flash plugin used to run the SWF player. The default
a435ca5b
MS
275is LNX 9,0,124,2. (When publishing, the default is FMLE/3.0 (compatible;
276<libavformat version>).)
b4c92e94 277
46743a85
SP
278@item rtmp_flush_interval
279Number of packets flushed in the same request (RTMPT only). The default
280is 10.
281
b4c92e94
SP
282@item rtmp_live
283Specify that the media is a live stream. No resuming or seeking in
284live streams is possible. The default value is @code{any}, which means the
285subscriber first tries to play the live stream specified in the
286playpath. If a live stream of that name is not found, it plays the
287recorded stream. The other possible values are @code{live} and
288@code{recorded}.
289
758377a2
SP
290@item rtmp_pageurl
291URL of the web page in which the media was embedded. By default no
292value will be sent.
293
b4c92e94
SP
294@item rtmp_playpath
295Stream identifier to play or to publish. This option overrides the
296parameter specified in the URI.
297
00cb52c6
SP
298@item rtmp_subscribe
299Name of live stream to subscribe to. By default no value will be sent.
300It is only sent if the option is specified or if rtmp_live
301is set to live.
302
635ac8e1
SP
303@item rtmp_swfhash
304SHA256 hash of the decompressed SWF file (32 bytes).
305
306@item rtmp_swfsize
307Size of the decompressed SWF file, required for SWFVerification.
308
b4c92e94
SP
309@item rtmp_swfurl
310URL of the SWF player for the media. By default no value will be sent.
311
93f257db
SP
312@item rtmp_swfverify
313URL to player swf file, compute hash/size automatically.
314
b4c92e94 315@item rtmp_tcurl
98df48db 316URL of the target stream. Defaults to proto://host[:port]/app.
1de4cfe6
SS
317
318@end table
319
90c9edba 320For example to read with @command{avplay} a multimedia resource named
1de4cfe6
SS
321"sample" from the application "vod" from an RTMP server "myserver":
322@example
266463da 323avplay rtmp://myserver/vod/sample
1de4cfe6
SS
324@end example
325
d175a573
MS
326To publish to a password protected server, passing the playpath and
327app names separately:
328@example
329avconv -re -i <input> -f flv -rtmp_playpath some/long/path -rtmp_app long/app/name rtmp://username:password@@myserver/
330@end example
331
acd554c1
SP
332@section rtmpe
333
334Encrypted Real-Time Messaging Protocol.
335
336The Encrypted Real-Time Messaging Protocol (RTMPE) is used for
337streaming multimedia content within standard cryptographic primitives,
338consisting of Diffie-Hellman key exchange and HMACSHA256, generating
339a pair of RC4 keys.
340
6aedabc9
SP
341@section rtmps
342
343Real-Time Messaging Protocol over a secure SSL connection.
344
345The Real-Time Messaging Protocol (RTMPS) is used for streaming
346multimedia content across an encrypted connection.
347
8e50c57d
SP
348@section rtmpt
349
350Real-Time Messaging Protocol tunneled through HTTP.
351
352The Real-Time Messaging Protocol tunneled through HTTP (RTMPT) is used
353for streaming multimedia content within HTTP requests to traverse
354firewalls.
355
08cd95e8
SP
356@section rtmpte
357
358Encrypted Real-Time Messaging Protocol tunneled through HTTP.
359
360The Encrypted Real-Time Messaging Protocol tunneled through HTTP (RTMPTE)
361is used for streaming multimedia content within HTTP requests to traverse
362firewalls.
363
86991ce2
SP
364@section rtmpts
365
366Real-Time Messaging Protocol tunneled through HTTPS.
367
368The Real-Time Messaging Protocol tunneled through HTTPS (RTMPTS) is used
369for streaming multimedia content within HTTPS requests to traverse
370firewalls.
371
3bea53db 372@section librtmp rtmp, rtmpe, rtmps, rtmpt, rtmpte
1de4cfe6
SS
373
374Real-Time Messaging Protocol and its variants supported through
375librtmp.
376
209e451a 377Requires the presence of the librtmp headers and library during
da9cea77 378configuration. You need to explicitly configure the build with
1de4cfe6
SS
379"--enable-librtmp". If enabled this will replace the native RTMP
380protocol.
381
382This protocol provides most client functions and a few server
383functions needed to support RTMP, RTMP tunneled in HTTP (RTMPT),
384encrypted RTMP (RTMPE), RTMP over SSL/TLS (RTMPS) and tunneled
385variants of these encrypted types (RTMPTE, RTMPTS).
386
387The required syntax is:
388@example
389@var{rtmp_proto}://@var{server}[:@var{port}][/@var{app}][/@var{playpath}] @var{options}
390@end example
391
392where @var{rtmp_proto} is one of the strings "rtmp", "rtmpt", "rtmpe",
393"rtmps", "rtmpte", "rtmpts" corresponding to each RTMP variant, and
394@var{server}, @var{port}, @var{app} and @var{playpath} have the same
209e451a 395meaning as specified for the RTMP native protocol.
1de4cfe6
SS
396@var{options} contains a list of space-separated options of the form
397@var{key}=@var{val}.
398
209e451a 399See the librtmp manual page (man 3 librtmp) for more information.
1de4cfe6
SS
400
401For example, to stream a file in real-time to an RTMP server using
d5837d7f 402@command{avconv}:
1de4cfe6 403@example
d5837d7f 404avconv -re -i myfile -f flv rtmp://myserver/live/mystream
1de4cfe6
SS
405@end example
406
90c9edba 407To play the same stream using @command{avplay}:
1de4cfe6 408@example
266463da 409avplay "rtmp://myserver/live/mystream live=1"
1de4cfe6
SS
410@end example
411
412@section rtp
413
414Real-Time Protocol.
415
92c5052d
MS
416@section rtsp
417
418RTSP is not technically a protocol handler in libavformat, it is a demuxer
419and muxer. The demuxer supports both normal RTSP (with data transferred
420over RTP; this is used by e.g. Apple and Microsoft) and Real-RTSP (with
421data transferred over RDT).
422
423The muxer can be used to send a stream using RTSP ANNOUNCE to a server
424supporting it (currently Darwin Streaming Server and Mischa Spiegelmock's
2cb6dec6 425@uref{http://github.com/revmischa/rtsp-server, RTSP server}).
92c5052d
MS
426
427The required syntax for a RTSP url is:
428@example
02a1a28c 429rtsp://@var{hostname}[:@var{port}]/@var{path}
92c5052d
MS
430@end example
431
90c9edba 432The following options (set on the @command{avconv}/@command{avplay} command
02a1a28c 433line, or set in code via @code{AVOption}s or in @code{avformat_open_input}),
92c5052d
MS
434are supported:
435
02a1a28c
MS
436Flags for @code{rtsp_transport}:
437
92c5052d
MS
438@table @option
439
440@item udp
441Use UDP as lower transport protocol.
442
443@item tcp
444Use TCP (interleaving within the RTSP control channel) as lower
445transport protocol.
446
02a1a28c 447@item udp_multicast
92c5052d
MS
448Use UDP multicast as lower transport protocol.
449
450@item http
451Use HTTP tunneling as lower transport protocol, which is useful for
452passing proxies.
453@end table
454
455Multiple lower transport protocols may be specified, in that case they are
456tried one at a time (if the setup of one fails, the next one is tried).
457For the muxer, only the @code{tcp} and @code{udp} options are supported.
458
02a1a28c
MS
459Flags for @code{rtsp_flags}:
460
461@table @option
462@item filter_src
463Accept packets only from negotiated peer address and port.
a8ad6ffa
JO
464@item listen
465Act as a server, listening for an incoming connection.
02a1a28c
MS
466@end table
467
92c5052d 468When receiving data over UDP, the demuxer tries to reorder received packets
ccfa8aa2
MS
469(since they may arrive out of order, or packets may get lost totally). This
470can be disabled by setting the maximum demuxing delay to zero (via
471the @code{max_delay} field of AVFormatContext).
92c5052d 472
90c9edba 473When watching multi-bitrate Real-RTSP streams with @command{avplay}, the
92c5052d
MS
474streams to display can be chosen with @code{-vst} @var{n} and
475@code{-ast} @var{n} for video and audio respectively, and can be switched
476on the fly by pressing @code{v} and @code{a}.
477
478Example command lines:
479
480To watch a stream over UDP, with a max reordering delay of 0.5 seconds:
481
482@example
02a1a28c 483avplay -max_delay 500000 -rtsp_transport udp rtsp://server/video.mp4
92c5052d
MS
484@end example
485
486To watch a stream tunneled over HTTP:
487
488@example
02a1a28c 489avplay -rtsp_transport http rtsp://server/video.mp4
92c5052d
MS
490@end example
491
492To send a stream in realtime to a RTSP server, for others to watch:
493
494@example
d5837d7f 495avconv -re -i @var{input} -f rtsp -muxdelay 0.1 rtsp://server/live.sdp
92c5052d
MS
496@end example
497
a8ad6ffa
JO
498To receive a stream in realtime:
499
500@example
501avconv -rtsp_flags listen -i rtsp://ownaddress/live.sdp @var{output}
502@end example
503
61c089a8
MS
504@section sap
505
506Session Announcement Protocol (RFC 2974). This is not technically a
01c8d258 507protocol handler in libavformat, it is a muxer and demuxer.
61c089a8
MS
508It is used for signalling of RTP streams, by announcing the SDP for the
509streams regularly on a separate port.
510
01c8d258
MS
511@subsection Muxer
512
61c089a8
MS
513The syntax for a SAP url given to the muxer is:
514@example
515sap://@var{destination}[:@var{port}][?@var{options}]
516@end example
517
518The RTP packets are sent to @var{destination} on port @var{port},
519or to port 5004 if no port is specified.
520@var{options} is a @code{&}-separated list. The following options
521are supported:
522
523@table @option
524
525@item announce_addr=@var{address}
526Specify the destination IP address for sending the announcements to.
527If omitted, the announcements are sent to the commonly used SAP
528announcement multicast address 224.2.127.254 (sap.mcast.net), or
529ff0e::2:7ffe if @var{destination} is an IPv6 address.
530
531@item announce_port=@var{port}
532Specify the port to send the announcements on, defaults to
5339875 if not specified.
534
535@item ttl=@var{ttl}
536Specify the time to live value for the announcements and RTP packets,
537defaults to 255.
538
539@item same_port=@var{0|1}
540If set to 1, send all RTP streams on the same port pair. If zero (the
541default), all streams are sent on unique ports, with each stream on a
542port 2 numbers higher than the previous.
543VLC/Live555 requires this to be set to 1, to be able to receive the stream.
01c8d258
MS
544The RTP stack in libavformat for receiving requires all streams to be sent
545on unique ports.
61c089a8
MS
546@end table
547
548Example command lines follow.
549
550To broadcast a stream on the local subnet, for watching in VLC:
551
552@example
d5837d7f 553avconv -re -i @var{input} -f sap sap://224.0.0.255?same_port=1
61c089a8
MS
554@end example
555
266463da 556Similarly, for watching in avplay:
01c8d258
MS
557
558@example
d5837d7f 559avconv -re -i @var{input} -f sap sap://224.0.0.255
01c8d258
MS
560@end example
561
266463da 562And for watching in avplay, over IPv6:
01c8d258
MS
563
564@example
d5837d7f 565avconv -re -i @var{input} -f sap sap://[ff0e::1:2:3:4]
01c8d258
MS
566@end example
567
568@subsection Demuxer
569
570The syntax for a SAP url given to the demuxer is:
571@example
572sap://[@var{address}][:@var{port}]
573@end example
574
575@var{address} is the multicast address to listen for announcements on,
576if omitted, the default 224.2.127.254 (sap.mcast.net) is used. @var{port}
577is the port that is listened on, 9875 if omitted.
578
579The demuxers listens for announcements on the given address and port.
580Once an announcement is received, it tries to receive that particular stream.
581
582Example command lines follow.
583
584To play back the first stream announced on the normal SAP multicast address:
585
586@example
266463da 587avplay sap://
01c8d258
MS
588@end example
589
590To play back the first stream announced on one the default IPv6 SAP multicast address:
591
592@example
266463da 593avplay sap://[ff0e::2:7ffe]
01c8d258
MS
594@end example
595
1de4cfe6
SS
596@section tcp
597
598Trasmission Control Protocol.
599
3d42d493
LB
600The required syntax for a TCP url is:
601@example
602tcp://@var{hostname}:@var{port}[?@var{options}]
603@end example
604
605@table @option
606
607@item listen
608Listen for an incoming connection
609
610@example
d5837d7f 611avconv -i @var{input} -f @var{format} tcp://@var{hostname}:@var{port}?listen
266463da 612avplay tcp://@var{hostname}:@var{port}
3d42d493
LB
613@end example
614
615@end table
616
8b09d917
MS
617@section tls
618
619Transport Layer Security (TLS) / Secure Sockets Layer (SSL)
620
621The required syntax for a TLS url is:
622@example
623tls://@var{hostname}:@var{port}
624@end example
625
626The following parameters can be set via command line options
627(or in code via @code{AVOption}s):
628
629@table @option
630
631@item ca_file
632A file containing certificate authority (CA) root certificates to treat
633as trusted. If the linked TLS library contains a default this might not
634need to be specified for verification to work, but not all libraries and
635setups have defaults built in.
636
637@item tls_verify=@var{1|0}
638If enabled, try to verify the peer that we are communicating with.
639Note, if using OpenSSL, this currently only makes sure that the
640peer certificate is signed by one of the root certificates in the CA
641database, but it does not validate that the certificate actually
642matches the host name we are trying to connect to. (With GnuTLS,
643the host name is validated as well.)
644
645This is disabled by default since it requires a CA database to be
646provided by the caller in many cases.
647
705b748e
MS
648@item cert_file
649A file containing a certificate to use in the handshake with the peer.
650(When operating as server, in listen mode, this is more often required
651by the peer, while client certificates only are mandated in certain
652setups.)
653
654@item key_file
655A file containing the private key for the certificate.
656
657@item listen=@var{1|0}
658If enabled, listen for connections on the provided port, and assume
659the server role in the handshake instead of the client role.
660
8b09d917
MS
661@end table
662
1de4cfe6
SS
663@section udp
664
665User Datagram Protocol.
666
0fb226b3
SS
667The required syntax for a UDP url is:
668@example
669udp://@var{hostname}:@var{port}[?@var{options}]
670@end example
671
a5f88736 672@var{options} contains a list of &-separated options of the form @var{key}=@var{val}.
0fb226b3
SS
673Follow the list of supported options.
674
675@table @option
676
677@item buffer_size=@var{size}
678set the UDP buffer size in bytes
679
680@item localport=@var{port}
681override the local UDP port to bind with
682
65ac5137
MS
683@item localaddr=@var{addr}
684Choose the local IP address. This is useful e.g. if sending multicast
685and the host has multiple interfaces, where the user can choose
686which interface to send on by specifying the IP address of that interface.
687
0fb226b3
SS
688@item pkt_size=@var{size}
689set the size in bytes of UDP packets
690
691@item reuse=@var{1|0}
692explicitly allow or disallow reusing UDP sockets
693
694@item ttl=@var{ttl}
695set the time to live value (for multicast only)
f6833fc1
MS
696
697@item connect=@var{1|0}
698Initialize the UDP socket with @code{connect()}. In this case, the
4ec153bb 699destination address can't be changed with ff_udp_set_remote_url later.
21a569f3 700If the destination address isn't known at the start, this option can
4ec153bb 701be specified in ff_udp_set_remote_url, too.
f6833fc1
MS
702This allows finding out the source address for the packets with getsockname,
703and makes writes return with AVERROR(ECONNREFUSED) if "destination
704unreachable" is received.
21a569f3
MS
705For receiving, this gives the benefit of only receiving packets from
706the specified peer address/port.
75d339e0
MS
707
708@item sources=@var{address}[,@var{address}]
709Only receive packets sent to the multicast group from one of the
710specified sender IP addresses.
711
712@item block=@var{address}[,@var{address}]
713Ignore packets sent to the multicast group from the specified
714sender IP addresses.
0fb226b3
SS
715@end table
716
d5837d7f 717Some usage examples of the udp protocol with @command{avconv} follow.
0fb226b3
SS
718
719To stream over UDP to a remote endpoint:
720@example
d5837d7f 721avconv -i @var{input} -f @var{format} udp://@var{hostname}:@var{port}
0fb226b3
SS
722@end example
723
724To stream in mpegts format over UDP using 188 sized UDP packets, using a large input buffer:
725@example
d5837d7f 726avconv -i @var{input} -f mpegts udp://@var{hostname}:@var{port}?pkt_size=188&buffer_size=65535
0fb226b3
SS
727@end example
728
729To receive over UDP from a remote endpoint:
730@example
d5837d7f 731avconv -i udp://[@var{multicast-address}]:@var{port}
0fb226b3
SS
732@end example
733
60538758
LB
734@section unix
735
736Unix local socket
737
738The required syntax for a Unix socket URL is:
739
740@example
741unix://@var{filepath}
742@end example
743
744The following parameters can be set via command line options
745(or in code via @code{AVOption}s):
746
747@table @option
748@item timeout
749Timeout in ms.
750@item listen
751Create the Unix socket in listening mode.
752@end table
753
1de4cfe6 754@c man end PROTOCOLS