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