]> git.sesse.net Git - casparcg/blob - dependencies/ffmpeg/doc/ffmpeg-protocols.html
6be426ade93edda16757994970179cd1fa4140bd
[casparcg] / dependencies / ffmpeg / doc / ffmpeg-protocols.html
1 <!DOCTYPE html>
2 <html>
3 <!-- Created on June 19, 2014 by texi2html 1.82 -->
4 <!--
5 texi2html was written by: 
6             Lionel Cons <Lionel.Cons@cern.ch> (original author)
7             Karl Berry  <karl@freefriends.org>
8             Olaf Bachmann <obachman@mathematik.uni-kl.de>
9             and many others.
10 Maintained by: Many creative people.
11 Send bugs and suggestions to <texi2html-bug@nongnu.org>
12
13 -->
14 <head>
15 <title>FFmpeg documentation : FFmpeg Protocols </title>
16
17 <meta name="description" content="FFmpeg Protocols Documentation: ">
18 <meta name="keywords" content="FFmpeg documentation : FFmpeg Protocols ">
19 <meta name="Generator" content="texi2html 1.82">
20 <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
21 <link rel="stylesheet" type="text/css" href="default.css" />
22
23 <link rel="icon" href="favicon.png" type="image/png" />
24 </head>
25 <body>
26 <div id="container">
27 <div id="body">
28
29 <a name="SEC_Top"></a>
30 <h1 class="settitle">FFmpeg Protocols Documentation</h1>
31
32 <a name="SEC_Contents"></a>
33 <h1>Table of Contents</h1>
34 <div class="contents">
35
36 <ul class="toc">
37   <li><a name="toc-Description" href="#Description">1. Description</a></li>
38   <li><a name="toc-Protocols" href="#Protocols">2. Protocols</a>
39   <ul class="toc">
40     <li><a name="toc-bluray" href="#bluray">2.1 bluray</a></li>
41     <li><a name="toc-cache" href="#cache">2.2 cache</a></li>
42     <li><a name="toc-concat" href="#concat">2.3 concat</a></li>
43     <li><a name="toc-crypto" href="#crypto">2.4 crypto</a></li>
44     <li><a name="toc-data" href="#data">2.5 data</a></li>
45     <li><a name="toc-file" href="#file">2.6 file</a></li>
46     <li><a name="toc-ftp" href="#ftp">2.7 ftp</a></li>
47     <li><a name="toc-gopher" href="#gopher">2.8 gopher</a></li>
48     <li><a name="toc-hls" href="#hls">2.9 hls</a></li>
49     <li><a name="toc-http" href="#http">2.10 http</a>
50     <ul class="toc">
51       <li><a name="toc-HTTP-Cookies" href="#HTTP-Cookies">2.10.1 HTTP Cookies</a></li>
52     </ul></li>
53     <li><a name="toc-mmst" href="#mmst">2.11 mmst</a></li>
54     <li><a name="toc-mmsh" href="#mmsh">2.12 mmsh</a></li>
55     <li><a name="toc-md5" href="#md5">2.13 md5</a></li>
56     <li><a name="toc-pipe" href="#pipe">2.14 pipe</a></li>
57     <li><a name="toc-rtmp" href="#rtmp">2.15 rtmp</a></li>
58     <li><a name="toc-rtmpe" href="#rtmpe">2.16 rtmpe</a></li>
59     <li><a name="toc-rtmps" href="#rtmps">2.17 rtmps</a></li>
60     <li><a name="toc-rtmpt" href="#rtmpt">2.18 rtmpt</a></li>
61     <li><a name="toc-rtmpte" href="#rtmpte">2.19 rtmpte</a></li>
62     <li><a name="toc-rtmpts" href="#rtmpts">2.20 rtmpts</a></li>
63     <li><a name="toc-libssh" href="#libssh">2.21 libssh</a></li>
64     <li><a name="toc-librtmp-rtmp_002c-rtmpe_002c-rtmps_002c-rtmpt_002c-rtmpte" href="#librtmp-rtmp_002c-rtmpe_002c-rtmps_002c-rtmpt_002c-rtmpte">2.22 librtmp rtmp, rtmpe, rtmps, rtmpt, rtmpte</a></li>
65     <li><a name="toc-rtp" href="#rtp">2.23 rtp</a></li>
66     <li><a name="toc-rtsp" href="#rtsp">2.24 rtsp</a>
67     <ul class="toc">
68       <li><a name="toc-Examples" href="#Examples">2.24.1 Examples</a></li>
69     </ul></li>
70     <li><a name="toc-sap" href="#sap">2.25 sap</a>
71     <ul class="toc">
72       <li><a name="toc-Muxer" href="#Muxer">2.25.1 Muxer</a></li>
73       <li><a name="toc-Demuxer" href="#Demuxer">2.25.2 Demuxer</a></li>
74     </ul></li>
75     <li><a name="toc-sctp" href="#sctp">2.26 sctp</a></li>
76     <li><a name="toc-srtp" href="#srtp">2.27 srtp</a></li>
77     <li><a name="toc-tcp" href="#tcp">2.28 tcp</a></li>
78     <li><a name="toc-tls" href="#tls">2.29 tls</a></li>
79     <li><a name="toc-udp" href="#udp">2.30 udp</a>
80     <ul class="toc">
81       <li><a name="toc-Examples-1" href="#Examples-1">2.30.1 Examples</a></li>
82     </ul></li>
83     <li><a name="toc-unix" href="#unix">2.31 unix</a></li>
84   </ul></li>
85   <li><a name="toc-See-Also" href="#See-Also">3. See Also</a></li>
86   <li><a name="toc-Authors" href="#Authors">4. Authors</a></li>
87 </ul>
88 </div>
89
90 <a name="Description"></a>
91 <h1 class="chapter"><a href="ffmpeg-protocols.html#toc-Description">1. Description</a></h1>
92
93 <p>This document describes the input and output protocols provided by the
94 libavformat library.
95 </p>
96
97 <a name="Protocols"></a>
98 <h1 class="chapter"><a href="ffmpeg-protocols.html#toc-Protocols">2. Protocols</a></h1>
99
100 <p>Protocols are configured elements in FFmpeg that enable access to
101 resources that require specific protocols.
102 </p>
103 <p>When you configure your FFmpeg build, all the supported protocols are
104 enabled by default. You can list all available ones using the
105 configure option &quot;&ndash;list-protocols&quot;.
106 </p>
107 <p>You can disable all the protocols using the configure option
108 &quot;&ndash;disable-protocols&quot;, and selectively enable a protocol using the
109 option &quot;&ndash;enable-protocol=<var>PROTOCOL</var>&quot;, or you can disable a
110 particular protocol using the option
111 &quot;&ndash;disable-protocol=<var>PROTOCOL</var>&quot;.
112 </p>
113 <p>The option &quot;-protocols&quot; of the ff* tools will display the list of
114 supported protocols.
115 </p>
116 <p>A description of the currently available protocols follows.
117 </p>
118 <a name="bluray"></a>
119 <h2 class="section"><a href="ffmpeg-protocols.html#toc-bluray">2.1 bluray</a></h2>
120
121 <p>Read BluRay playlist.
122 </p>
123 <p>The accepted options are:
124 </p><dl compact="compact">
125 <dt> &lsquo;<samp>angle</samp>&rsquo;</dt>
126 <dd><p>BluRay angle
127 </p>
128 </dd>
129 <dt> &lsquo;<samp>chapter</samp>&rsquo;</dt>
130 <dd><p>Start chapter (1...N)
131 </p>
132 </dd>
133 <dt> &lsquo;<samp>playlist</samp>&rsquo;</dt>
134 <dd><p>Playlist to read (BDMV/PLAYLIST/?????.mpls)
135 </p>
136 </dd>
137 </dl>
138
139 <p>Examples:
140 </p>
141 <p>Read longest playlist from BluRay mounted to /mnt/bluray:
142 </p><table><tr><td>&nbsp;</td><td><pre class="example">bluray:/mnt/bluray
143 </pre></td></tr></table>
144
145 <p>Read angle 2 of playlist 4 from BluRay mounted to /mnt/bluray, start from chapter 2:
146 </p><table><tr><td>&nbsp;</td><td><pre class="example">-playlist 4 -angle 2 -chapter 2 bluray:/mnt/bluray
147 </pre></td></tr></table>
148
149 <a name="cache"></a>
150 <h2 class="section"><a href="ffmpeg-protocols.html#toc-cache">2.2 cache</a></h2>
151
152 <p>Caching wrapper for input stream.
153 </p>
154 <p>Cache the input stream to temporary file. It brings seeking capability to live streams.
155 </p>
156 <table><tr><td>&nbsp;</td><td><pre class="example">cache:<var>URL</var>
157 </pre></td></tr></table>
158
159 <a name="concat"></a>
160 <h2 class="section"><a href="ffmpeg-protocols.html#toc-concat">2.3 concat</a></h2>
161
162 <p>Physical concatenation protocol.
163 </p>
164 <p>Allow to read and seek from many resource in sequence as if they were
165 a unique resource.
166 </p>
167 <p>A URL accepted by this protocol has the syntax:
168 </p><table><tr><td>&nbsp;</td><td><pre class="example">concat:<var>URL1</var>|<var>URL2</var>|...|<var>URLN</var>
169 </pre></td></tr></table>
170
171 <p>where <var>URL1</var>, <var>URL2</var>, ..., <var>URLN</var> are the urls of the
172 resource to be concatenated, each one possibly specifying a distinct
173 protocol.
174 </p>
175 <p>For example to read a sequence of files &lsquo;<tt>split1.mpeg</tt>&rsquo;,
176 &lsquo;<tt>split2.mpeg</tt>&rsquo;, &lsquo;<tt>split3.mpeg</tt>&rsquo; with <code>ffplay</code> use the
177 command:
178 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffplay concat:split1.mpeg\|split2.mpeg\|split3.mpeg
179 </pre></td></tr></table>
180
181 <p>Note that you may need to escape the character &quot;|&quot; which is special for
182 many shells.
183 </p>
184 <a name="crypto"></a>
185 <h2 class="section"><a href="ffmpeg-protocols.html#toc-crypto">2.4 crypto</a></h2>
186
187 <p>AES-encrypted stream reading protocol.
188 </p>
189 <p>The accepted options are:
190 </p><dl compact="compact">
191 <dt> &lsquo;<samp>key</samp>&rsquo;</dt>
192 <dd><p>Set the AES decryption key binary block from given hexadecimal representation.
193 </p>
194 </dd>
195 <dt> &lsquo;<samp>iv</samp>&rsquo;</dt>
196 <dd><p>Set the AES decryption initialization vector binary block from given hexadecimal representation.
197 </p></dd>
198 </dl>
199
200 <p>Accepted URL formats:
201 </p><table><tr><td>&nbsp;</td><td><pre class="example">crypto:<var>URL</var>
202 crypto+<var>URL</var>
203 </pre></td></tr></table>
204
205 <a name="data"></a>
206 <h2 class="section"><a href="ffmpeg-protocols.html#toc-data">2.5 data</a></h2>
207
208 <p>Data in-line in the URI. See <a href="http://en.wikipedia.org/wiki/Data_URI_scheme">http://en.wikipedia.org/wiki/Data_URI_scheme</a>.
209 </p>
210 <p>For example, to convert a GIF file given inline with <code>ffmpeg</code>:
211 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i &quot;data:image/gif;base64,R0lGODdhCAAIAMIEAAAAAAAA//8AAP//AP///////////////ywAAAAACAAIAAADF0gEDLojDgdGiJdJqUX02iB4E8Q9jUMkADs=&quot; smiley.png
212 </pre></td></tr></table>
213
214 <a name="file"></a>
215 <h2 class="section"><a href="ffmpeg-protocols.html#toc-file">2.6 file</a></h2>
216
217 <p>File access protocol.
218 </p>
219 <p>Allow to read from or write to a file.
220 </p>
221 <p>A file URL can have the form:
222 </p><table><tr><td>&nbsp;</td><td><pre class="example">file:<var>filename</var>
223 </pre></td></tr></table>
224
225 <p>where <var>filename</var> is the path of the file to read.
226 </p>
227 <p>An URL that does not have a protocol prefix will be assumed to be a
228 file URL. Depending on the build, an URL that looks like a Windows
229 path with the drive letter at the beginning will also be assumed to be
230 a file URL (usually not the case in builds for unix-like systems).
231 </p>
232 <p>For example to read from a file &lsquo;<tt>input.mpeg</tt>&rsquo; with <code>ffmpeg</code>
233 use the command:
234 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i file:input.mpeg output.mpeg
235 </pre></td></tr></table>
236
237 <p>This protocol accepts the following options:
238 </p>
239 <dl compact="compact">
240 <dt> &lsquo;<samp>truncate</samp>&rsquo;</dt>
241 <dd><p>Truncate existing files on write, if set to 1. A value of 0 prevents
242 truncating. Default value is 1.
243 </p>
244 </dd>
245 <dt> &lsquo;<samp>blocksize</samp>&rsquo;</dt>
246 <dd><p>Set I/O operation maximum block size, in bytes. Default value is
247 <code>INT_MAX</code>, which results in not limiting the requested block size.
248 Setting this value reasonably low improves user termination request reaction
249 time, which is valuable for files on slow medium.
250 </p></dd>
251 </dl>
252
253 <a name="ftp"></a>
254 <h2 class="section"><a href="ffmpeg-protocols.html#toc-ftp">2.7 ftp</a></h2>
255
256 <p>FTP (File Transfer Protocol).
257 </p>
258 <p>Allow to read from or write to remote resources using FTP protocol.
259 </p>
260 <p>Following syntax is required.
261 </p><table><tr><td>&nbsp;</td><td><pre class="example">ftp://[user[:password]@]server[:port]/path/to/remote/resource.mpeg
262 </pre></td></tr></table>
263
264 <p>This protocol accepts the following options.
265 </p>
266 <dl compact="compact">
267 <dt> &lsquo;<samp>timeout</samp>&rsquo;</dt>
268 <dd><p>Set timeout of socket I/O operations used by the underlying low level
269 operation. By default it is set to -1, which means that the timeout is
270 not specified.
271 </p>
272 </dd>
273 <dt> &lsquo;<samp>ftp-anonymous-password</samp>&rsquo;</dt>
274 <dd><p>Password used when login as anonymous user. Typically an e-mail address
275 should be used.
276 </p>
277 </dd>
278 <dt> &lsquo;<samp>ftp-write-seekable</samp>&rsquo;</dt>
279 <dd><p>Control seekability of connection during encoding. If set to 1 the
280 resource is supposed to be seekable, if set to 0 it is assumed not
281 to be seekable. Default value is 0.
282 </p></dd>
283 </dl>
284
285 <p>NOTE: Protocol can be used as output, but it is recommended to not do
286 it, unless special care is taken (tests, customized server configuration
287 etc.). Different FTP servers behave in different way during seek
288 operation. ff* tools may produce incomplete content due to server limitations.
289 </p>
290 <a name="gopher"></a>
291 <h2 class="section"><a href="ffmpeg-protocols.html#toc-gopher">2.8 gopher</a></h2>
292
293 <p>Gopher protocol.
294 </p>
295 <a name="hls"></a>
296 <h2 class="section"><a href="ffmpeg-protocols.html#toc-hls">2.9 hls</a></h2>
297
298 <p>Read Apple HTTP Live Streaming compliant segmented stream as
299 a uniform one. The M3U8 playlists describing the segments can be
300 remote HTTP resources or local files, accessed using the standard
301 file protocol.
302 The nested protocol is declared by specifying
303 &quot;+<var>proto</var>&quot; after the hls URI scheme name, where <var>proto</var>
304 is either &quot;file&quot; or &quot;http&quot;.
305 </p>
306 <table><tr><td>&nbsp;</td><td><pre class="example">hls+http://host/path/to/remote/resource.m3u8
307 hls+file://path/to/local/resource.m3u8
308 </pre></td></tr></table>
309
310 <p>Using this protocol is discouraged - the hls demuxer should work
311 just as well (if not, please report the issues) and is more complete.
312 To use the hls demuxer instead, simply use the direct URLs to the
313 m3u8 files.
314 </p>
315 <a name="http"></a>
316 <h2 class="section"><a href="ffmpeg-protocols.html#toc-http">2.10 http</a></h2>
317
318 <p>HTTP (Hyper Text Transfer Protocol).
319 </p>
320 <p>This protocol accepts the following options:
321 </p>
322 <dl compact="compact">
323 <dt> &lsquo;<samp>seekable</samp>&rsquo;</dt>
324 <dd><p>Control seekability of connection. If set to 1 the resource is
325 supposed to be seekable, if set to 0 it is assumed not to be seekable,
326 if set to -1 it will try to autodetect if it is seekable. Default
327 value is -1.
328 </p>
329 </dd>
330 <dt> &lsquo;<samp>chunked_post</samp>&rsquo;</dt>
331 <dd><p>If set to 1 use chunked Transfer-Encoding for posts, default is 1.
332 </p>
333 </dd>
334 <dt> &lsquo;<samp>content_type</samp>&rsquo;</dt>
335 <dd><p>Set a specific content type for the POST messages.
336 </p>
337 </dd>
338 <dt> &lsquo;<samp>headers</samp>&rsquo;</dt>
339 <dd><p>Set custom HTTP headers, can override built in default headers. The
340 value must be a string encoding the headers.
341 </p>
342 </dd>
343 <dt> &lsquo;<samp>multiple_requests</samp>&rsquo;</dt>
344 <dd><p>Use persistent connections if set to 1, default is 0.
345 </p>
346 </dd>
347 <dt> &lsquo;<samp>post_data</samp>&rsquo;</dt>
348 <dd><p>Set custom HTTP post data.
349 </p>
350 </dd>
351 <dt> &lsquo;<samp>user-agent</samp>&rsquo;</dt>
352 <dt> &lsquo;<samp>user_agent</samp>&rsquo;</dt>
353 <dd><p>Override the User-Agent header. If not specified the protocol will use a
354 string describing the libavformat build. (&quot;Lavf/&lt;version&gt;&quot;)
355 </p>
356 </dd>
357 <dt> &lsquo;<samp>timeout</samp>&rsquo;</dt>
358 <dd><p>Set timeout of socket I/O operations used by the underlying low level
359 operation. By default it is set to -1, which means that the timeout is
360 not specified.
361 </p>
362 </dd>
363 <dt> &lsquo;<samp>mime_type</samp>&rsquo;</dt>
364 <dd><p>Export the MIME type.
365 </p>
366 </dd>
367 <dt> &lsquo;<samp>icy</samp>&rsquo;</dt>
368 <dd><p>If set to 1 request ICY (SHOUTcast) metadata from the server. If the server
369 supports this, the metadata has to be retrieved by the application by reading
370 the &lsquo;<samp>icy_metadata_headers</samp>&rsquo; and &lsquo;<samp>icy_metadata_packet</samp>&rsquo; options.
371 The default is 0.
372 </p>
373 </dd>
374 <dt> &lsquo;<samp>icy_metadata_headers</samp>&rsquo;</dt>
375 <dd><p>If the server supports ICY metadata, this contains the ICY-specific HTTP reply
376 headers, separated by newline characters.
377 </p>
378 </dd>
379 <dt> &lsquo;<samp>icy_metadata_packet</samp>&rsquo;</dt>
380 <dd><p>If the server supports ICY metadata, and &lsquo;<samp>icy</samp>&rsquo; was set to 1, this
381 contains the last non-empty metadata packet sent by the server. It should be
382 polled in regular intervals by applications interested in mid-stream metadata
383 updates.
384 </p>
385 </dd>
386 <dt> &lsquo;<samp>cookies</samp>&rsquo;</dt>
387 <dd><p>Set the cookies to be sent in future requests. The format of each cookie is the
388 same as the value of a Set-Cookie HTTP response field. Multiple cookies can be
389 delimited by a newline character.
390 </p>
391 </dd>
392 <dt> &lsquo;<samp>offset</samp>&rsquo;</dt>
393 <dd><p>Set initial byte offset.
394 </p>
395 </dd>
396 <dt> &lsquo;<samp>end_offset</samp>&rsquo;</dt>
397 <dd><p>Try to limit the request to bytes preceding this offset.
398 </p></dd>
399 </dl>
400
401 <a name="HTTP-Cookies"></a>
402 <h3 class="subsection"><a href="ffmpeg-protocols.html#toc-HTTP-Cookies">2.10.1 HTTP Cookies</a></h3>
403
404 <p>Some HTTP requests will be denied unless cookie values are passed in with the
405 request. The &lsquo;<samp>cookies</samp>&rsquo; option allows these cookies to be specified. At
406 the very least, each cookie must specify a value along with a path and domain.
407 HTTP requests that match both the domain and path will automatically include the
408 cookie value in the HTTP Cookie header field. Multiple cookies can be delimited
409 by a newline.
410 </p>
411 <p>The required syntax to play a stream specifying a cookie is:
412 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffplay -cookies &quot;nlqptid=nltid=tsn; path=/; domain=somedomain.com;&quot; http://somedomain.com/somestream.m3u8
413 </pre></td></tr></table>
414
415 <a name="mmst"></a>
416 <h2 class="section"><a href="ffmpeg-protocols.html#toc-mmst">2.11 mmst</a></h2>
417
418 <p>MMS (Microsoft Media Server) protocol over TCP.
419 </p>
420 <a name="mmsh"></a>
421 <h2 class="section"><a href="ffmpeg-protocols.html#toc-mmsh">2.12 mmsh</a></h2>
422
423 <p>MMS (Microsoft Media Server) protocol over HTTP.
424 </p>
425 <p>The required syntax is:
426 </p><table><tr><td>&nbsp;</td><td><pre class="example">mmsh://<var>server</var>[:<var>port</var>][/<var>app</var>][/<var>playpath</var>]
427 </pre></td></tr></table>
428
429 <a name="md5"></a>
430 <h2 class="section"><a href="ffmpeg-protocols.html#toc-md5">2.13 md5</a></h2>
431
432 <p>MD5 output protocol.
433 </p>
434 <p>Computes the MD5 hash of the data to be written, and on close writes
435 this to the designated output or stdout if none is specified. It can
436 be used to test muxers without writing an actual file.
437 </p>
438 <p>Some examples follow.
439 </p><table><tr><td>&nbsp;</td><td><pre class="example"># Write the MD5 hash of the encoded AVI file to the file output.avi.md5.
440 ffmpeg -i input.flv -f avi -y md5:output.avi.md5
441
442 # Write the MD5 hash of the encoded AVI file to stdout.
443 ffmpeg -i input.flv -f avi -y md5:
444 </pre></td></tr></table>
445
446 <p>Note that some formats (typically MOV) require the output protocol to
447 be seekable, so they will fail with the MD5 output protocol.
448 </p>
449 <a name="pipe"></a>
450 <h2 class="section"><a href="ffmpeg-protocols.html#toc-pipe">2.14 pipe</a></h2>
451
452 <p>UNIX pipe access protocol.
453 </p>
454 <p>Allow to read and write from UNIX pipes.
455 </p>
456 <p>The accepted syntax is:
457 </p><table><tr><td>&nbsp;</td><td><pre class="example">pipe:[<var>number</var>]
458 </pre></td></tr></table>
459
460 <p><var>number</var> is the number corresponding to the file descriptor of the
461 pipe (e.g. 0 for stdin, 1 for stdout, 2 for stderr).  If <var>number</var>
462 is not specified, by default the stdout file descriptor will be used
463 for writing, stdin for reading.
464 </p>
465 <p>For example to read from stdin with <code>ffmpeg</code>:
466 </p><table><tr><td>&nbsp;</td><td><pre class="example">cat test.wav | ffmpeg -i pipe:0
467 # ...this is the same as...
468 cat test.wav | ffmpeg -i pipe:
469 </pre></td></tr></table>
470
471 <p>For writing to stdout with <code>ffmpeg</code>:
472 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i test.wav -f avi pipe:1 | cat &gt; test.avi
473 # ...this is the same as...
474 ffmpeg -i test.wav -f avi pipe: | cat &gt; test.avi
475 </pre></td></tr></table>
476
477 <p>This protocol accepts the following options:
478 </p>
479 <dl compact="compact">
480 <dt> &lsquo;<samp>blocksize</samp>&rsquo;</dt>
481 <dd><p>Set I/O operation maximum block size, in bytes. Default value is
482 <code>INT_MAX</code>, which results in not limiting the requested block size.
483 Setting this value reasonably low improves user termination request reaction
484 time, which is valuable if data transmission is slow.
485 </p></dd>
486 </dl>
487
488 <p>Note that some formats (typically MOV), require the output protocol to
489 be seekable, so they will fail with the pipe output protocol.
490 </p>
491 <a name="rtmp"></a>
492 <h2 class="section"><a href="ffmpeg-protocols.html#toc-rtmp">2.15 rtmp</a></h2>
493
494 <p>Real-Time Messaging Protocol.
495 </p>
496 <p>The Real-Time Messaging Protocol (RTMP) is used for streaming multimedia
497 content across a TCP/IP network.
498 </p>
499 <p>The required syntax is:
500 </p><table><tr><td>&nbsp;</td><td><pre class="example">rtmp://[<var>username</var>:<var>password</var>@]<var>server</var>[:<var>port</var>][/<var>app</var>][/<var>instance</var>][/<var>playpath</var>]
501 </pre></td></tr></table>
502
503 <p>The accepted parameters are:
504 </p><dl compact="compact">
505 <dt> &lsquo;<samp>username</samp>&rsquo;</dt>
506 <dd><p>An optional username (mostly for publishing).
507 </p>
508 </dd>
509 <dt> &lsquo;<samp>password</samp>&rsquo;</dt>
510 <dd><p>An optional password (mostly for publishing).
511 </p>
512 </dd>
513 <dt> &lsquo;<samp>server</samp>&rsquo;</dt>
514 <dd><p>The address of the RTMP server.
515 </p>
516 </dd>
517 <dt> &lsquo;<samp>port</samp>&rsquo;</dt>
518 <dd><p>The number of the TCP port to use (by default is 1935).
519 </p>
520 </dd>
521 <dt> &lsquo;<samp>app</samp>&rsquo;</dt>
522 <dd><p>It is the name of the application to access. It usually corresponds to
523 the path where the application is installed on the RTMP server
524 (e.g. &lsquo;<tt>/ondemand/</tt>&rsquo;, &lsquo;<tt>/flash/live/</tt>&rsquo;, etc.). You can override
525 the value parsed from the URI through the <code>rtmp_app</code> option, too.
526 </p>
527 </dd>
528 <dt> &lsquo;<samp>playpath</samp>&rsquo;</dt>
529 <dd><p>It is the path or name of the resource to play with reference to the
530 application specified in <var>app</var>, may be prefixed by &quot;mp4:&quot;. You
531 can override the value parsed from the URI through the <code>rtmp_playpath</code>
532 option, too.
533 </p>
534 </dd>
535 <dt> &lsquo;<samp>listen</samp>&rsquo;</dt>
536 <dd><p>Act as a server, listening for an incoming connection.
537 </p>
538 </dd>
539 <dt> &lsquo;<samp>timeout</samp>&rsquo;</dt>
540 <dd><p>Maximum time to wait for the incoming connection. Implies listen.
541 </p></dd>
542 </dl>
543
544 <p>Additionally, the following parameters can be set via command line options
545 (or in code via <code>AVOption</code>s):
546 </p><dl compact="compact">
547 <dt> &lsquo;<samp>rtmp_app</samp>&rsquo;</dt>
548 <dd><p>Name of application to connect on the RTMP server. This option
549 overrides the parameter specified in the URI.
550 </p>
551 </dd>
552 <dt> &lsquo;<samp>rtmp_buffer</samp>&rsquo;</dt>
553 <dd><p>Set the client buffer time in milliseconds. The default is 3000.
554 </p>
555 </dd>
556 <dt> &lsquo;<samp>rtmp_conn</samp>&rsquo;</dt>
557 <dd><p>Extra arbitrary AMF connection parameters, parsed from a string,
558 e.g. like <code>B:1 S:authMe O:1 NN:code:1.23 NS:flag:ok O:0</code>.
559 Each value is prefixed by a single character denoting the type,
560 B for Boolean, N for number, S for string, O for object, or Z for null,
561 followed by a colon. For Booleans the data must be either 0 or 1 for
562 FALSE or TRUE, respectively.  Likewise for Objects the data must be 0 or
563 1 to end or begin an object, respectively. Data items in subobjects may
564 be named, by prefixing the type with &rsquo;N&rsquo; and specifying the name before
565 the value (i.e. <code>NB:myFlag:1</code>). This option may be used multiple
566 times to construct arbitrary AMF sequences.
567 </p>
568 </dd>
569 <dt> &lsquo;<samp>rtmp_flashver</samp>&rsquo;</dt>
570 <dd><p>Version of the Flash plugin used to run the SWF player. The default
571 is LNX 9,0,124,2. (When publishing, the default is FMLE/3.0 (compatible;
572 &lt;libavformat version&gt;).)
573 </p>
574 </dd>
575 <dt> &lsquo;<samp>rtmp_flush_interval</samp>&rsquo;</dt>
576 <dd><p>Number of packets flushed in the same request (RTMPT only). The default
577 is 10.
578 </p>
579 </dd>
580 <dt> &lsquo;<samp>rtmp_live</samp>&rsquo;</dt>
581 <dd><p>Specify that the media is a live stream. No resuming or seeking in
582 live streams is possible. The default value is <code>any</code>, which means the
583 subscriber first tries to play the live stream specified in the
584 playpath. If a live stream of that name is not found, it plays the
585 recorded stream. The other possible values are <code>live</code> and
586 <code>recorded</code>.
587 </p>
588 </dd>
589 <dt> &lsquo;<samp>rtmp_pageurl</samp>&rsquo;</dt>
590 <dd><p>URL of the web page in which the media was embedded. By default no
591 value will be sent.
592 </p>
593 </dd>
594 <dt> &lsquo;<samp>rtmp_playpath</samp>&rsquo;</dt>
595 <dd><p>Stream identifier to play or to publish. This option overrides the
596 parameter specified in the URI.
597 </p>
598 </dd>
599 <dt> &lsquo;<samp>rtmp_subscribe</samp>&rsquo;</dt>
600 <dd><p>Name of live stream to subscribe to. By default no value will be sent.
601 It is only sent if the option is specified or if rtmp_live
602 is set to live.
603 </p>
604 </dd>
605 <dt> &lsquo;<samp>rtmp_swfhash</samp>&rsquo;</dt>
606 <dd><p>SHA256 hash of the decompressed SWF file (32 bytes).
607 </p>
608 </dd>
609 <dt> &lsquo;<samp>rtmp_swfsize</samp>&rsquo;</dt>
610 <dd><p>Size of the decompressed SWF file, required for SWFVerification.
611 </p>
612 </dd>
613 <dt> &lsquo;<samp>rtmp_swfurl</samp>&rsquo;</dt>
614 <dd><p>URL of the SWF player for the media. By default no value will be sent.
615 </p>
616 </dd>
617 <dt> &lsquo;<samp>rtmp_swfverify</samp>&rsquo;</dt>
618 <dd><p>URL to player swf file, compute hash/size automatically.
619 </p>
620 </dd>
621 <dt> &lsquo;<samp>rtmp_tcurl</samp>&rsquo;</dt>
622 <dd><p>URL of the target stream. Defaults to proto://host[:port]/app.
623 </p>
624 </dd>
625 </dl>
626
627 <p>For example to read with <code>ffplay</code> a multimedia resource named
628 &quot;sample&quot; from the application &quot;vod&quot; from an RTMP server &quot;myserver&quot;:
629 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffplay rtmp://myserver/vod/sample
630 </pre></td></tr></table>
631
632 <p>To publish to a password protected server, passing the playpath and
633 app names separately:
634 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -re -i &lt;input&gt; -f flv -rtmp_playpath some/long/path -rtmp_app long/app/name rtmp://username:password@myserver/
635 </pre></td></tr></table>
636
637 <a name="rtmpe"></a>
638 <h2 class="section"><a href="ffmpeg-protocols.html#toc-rtmpe">2.16 rtmpe</a></h2>
639
640 <p>Encrypted Real-Time Messaging Protocol.
641 </p>
642 <p>The Encrypted Real-Time Messaging Protocol (RTMPE) is used for
643 streaming multimedia content within standard cryptographic primitives,
644 consisting of Diffie-Hellman key exchange and HMACSHA256, generating
645 a pair of RC4 keys.
646 </p>
647 <a name="rtmps"></a>
648 <h2 class="section"><a href="ffmpeg-protocols.html#toc-rtmps">2.17 rtmps</a></h2>
649
650 <p>Real-Time Messaging Protocol over a secure SSL connection.
651 </p>
652 <p>The Real-Time Messaging Protocol (RTMPS) is used for streaming
653 multimedia content across an encrypted connection.
654 </p>
655 <a name="rtmpt"></a>
656 <h2 class="section"><a href="ffmpeg-protocols.html#toc-rtmpt">2.18 rtmpt</a></h2>
657
658 <p>Real-Time Messaging Protocol tunneled through HTTP.
659 </p>
660 <p>The Real-Time Messaging Protocol tunneled through HTTP (RTMPT) is used
661 for streaming multimedia content within HTTP requests to traverse
662 firewalls.
663 </p>
664 <a name="rtmpte"></a>
665 <h2 class="section"><a href="ffmpeg-protocols.html#toc-rtmpte">2.19 rtmpte</a></h2>
666
667 <p>Encrypted Real-Time Messaging Protocol tunneled through HTTP.
668 </p>
669 <p>The Encrypted Real-Time Messaging Protocol tunneled through HTTP (RTMPTE)
670 is used for streaming multimedia content within HTTP requests to traverse
671 firewalls.
672 </p>
673 <a name="rtmpts"></a>
674 <h2 class="section"><a href="ffmpeg-protocols.html#toc-rtmpts">2.20 rtmpts</a></h2>
675
676 <p>Real-Time Messaging Protocol tunneled through HTTPS.
677 </p>
678 <p>The Real-Time Messaging Protocol tunneled through HTTPS (RTMPTS) is used
679 for streaming multimedia content within HTTPS requests to traverse
680 firewalls.
681 </p>
682 <a name="libssh"></a>
683 <h2 class="section"><a href="ffmpeg-protocols.html#toc-libssh">2.21 libssh</a></h2>
684
685 <p>Secure File Transfer Protocol via libssh
686 </p>
687 <p>Allow to read from or write to remote resources using SFTP protocol.
688 </p>
689 <p>Following syntax is required.
690 </p>
691 <table><tr><td>&nbsp;</td><td><pre class="example">sftp://[user[:password]@]server[:port]/path/to/remote/resource.mpeg
692 </pre></td></tr></table>
693
694 <p>This protocol accepts the following options.
695 </p>
696 <dl compact="compact">
697 <dt> &lsquo;<samp>timeout</samp>&rsquo;</dt>
698 <dd><p>Set timeout of socket I/O operations used by the underlying low level
699 operation. By default it is set to -1, which means that the timeout
700 is not specified.
701 </p>
702 </dd>
703 <dt> &lsquo;<samp>truncate</samp>&rsquo;</dt>
704 <dd><p>Truncate existing files on write, if set to 1. A value of 0 prevents
705 truncating. Default value is 1.
706 </p>
707 </dd>
708 <dt> &lsquo;<samp>private_key</samp>&rsquo;</dt>
709 <dd><p>Specify the path of the file containing private key to use during authorization.
710 By default libssh searches for keys in the &lsquo;<tt>~/.ssh/</tt>&rsquo; directory.
711 </p>
712 </dd>
713 </dl>
714
715 <p>Example: Play a file stored on remote server.
716 </p>
717 <table><tr><td>&nbsp;</td><td><pre class="example">ffplay sftp://user:password@server_address:22/home/user/resource.mpeg
718 </pre></td></tr></table>
719
720 <a name="librtmp-rtmp_002c-rtmpe_002c-rtmps_002c-rtmpt_002c-rtmpte"></a>
721 <h2 class="section"><a href="ffmpeg-protocols.html#toc-librtmp-rtmp_002c-rtmpe_002c-rtmps_002c-rtmpt_002c-rtmpte">2.22 librtmp rtmp, rtmpe, rtmps, rtmpt, rtmpte</a></h2>
722
723 <p>Real-Time Messaging Protocol and its variants supported through
724 librtmp.
725 </p>
726 <p>Requires the presence of the librtmp headers and library during
727 configuration. You need to explicitly configure the build with
728 &quot;&ndash;enable-librtmp&quot;. If enabled this will replace the native RTMP
729 protocol.
730 </p>
731 <p>This protocol provides most client functions and a few server
732 functions needed to support RTMP, RTMP tunneled in HTTP (RTMPT),
733 encrypted RTMP (RTMPE), RTMP over SSL/TLS (RTMPS) and tunneled
734 variants of these encrypted types (RTMPTE, RTMPTS).
735 </p>
736 <p>The required syntax is:
737 </p><table><tr><td>&nbsp;</td><td><pre class="example"><var>rtmp_proto</var>://<var>server</var>[:<var>port</var>][/<var>app</var>][/<var>playpath</var>] <var>options</var>
738 </pre></td></tr></table>
739
740 <p>where <var>rtmp_proto</var> is one of the strings &quot;rtmp&quot;, &quot;rtmpt&quot;, &quot;rtmpe&quot;,
741 &quot;rtmps&quot;, &quot;rtmpte&quot;, &quot;rtmpts&quot; corresponding to each RTMP variant, and
742 <var>server</var>, <var>port</var>, <var>app</var> and <var>playpath</var> have the same
743 meaning as specified for the RTMP native protocol.
744 <var>options</var> contains a list of space-separated options of the form
745 <var>key</var>=<var>val</var>.
746 </p>
747 <p>See the librtmp manual page (man 3 librtmp) for more information.
748 </p>
749 <p>For example, to stream a file in real-time to an RTMP server using
750 <code>ffmpeg</code>:
751 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -re -i myfile -f flv rtmp://myserver/live/mystream
752 </pre></td></tr></table>
753
754 <p>To play the same stream using <code>ffplay</code>:
755 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffplay &quot;rtmp://myserver/live/mystream live=1&quot;
756 </pre></td></tr></table>
757
758 <a name="rtp"></a>
759 <h2 class="section"><a href="ffmpeg-protocols.html#toc-rtp">2.23 rtp</a></h2>
760
761 <p>Real-time Transport Protocol.
762 </p>
763 <p>The required syntax for an RTP URL is:
764 rtp://<var>hostname</var>[:<var>port</var>][?<var>option</var>=<var>val</var>...]
765 </p>
766 <p><var>port</var> specifies the RTP port to use.
767 </p>
768 <p>The following URL options are supported:
769 </p>
770 <dl compact="compact">
771 <dt> &lsquo;<samp>ttl=<var>n</var></samp>&rsquo;</dt>
772 <dd><p>Set the TTL (Time-To-Live) value (for multicast only).
773 </p>
774 </dd>
775 <dt> &lsquo;<samp>rtcpport=<var>n</var></samp>&rsquo;</dt>
776 <dd><p>Set the remote RTCP port to <var>n</var>.
777 </p>
778 </dd>
779 <dt> &lsquo;<samp>localrtpport=<var>n</var></samp>&rsquo;</dt>
780 <dd><p>Set the local RTP port to <var>n</var>.
781 </p>
782 </dd>
783 <dt> &lsquo;<samp>localrtcpport=<var>n</var>'</samp>&rsquo;</dt>
784 <dd><p>Set the local RTCP port to <var>n</var>.
785 </p>
786 </dd>
787 <dt> &lsquo;<samp>pkt_size=<var>n</var></samp>&rsquo;</dt>
788 <dd><p>Set max packet size (in bytes) to <var>n</var>.
789 </p>
790 </dd>
791 <dt> &lsquo;<samp>connect=0|1</samp>&rsquo;</dt>
792 <dd><p>Do a <code>connect()</code> on the UDP socket (if set to 1) or not (if set
793 to 0).
794 </p>
795 </dd>
796 <dt> &lsquo;<samp>sources=<var>ip</var>[,<var>ip</var>]</samp>&rsquo;</dt>
797 <dd><p>List allowed source IP addresses.
798 </p>
799 </dd>
800 <dt> &lsquo;<samp>block=<var>ip</var>[,<var>ip</var>]</samp>&rsquo;</dt>
801 <dd><p>List disallowed (blocked) source IP addresses.
802 </p>
803 </dd>
804 <dt> &lsquo;<samp>write_to_source=0|1</samp>&rsquo;</dt>
805 <dd><p>Send packets to the source address of the latest received packet (if
806 set to 1) or to a default remote address (if set to 0).
807 </p>
808 </dd>
809 <dt> &lsquo;<samp>localport=<var>n</var></samp>&rsquo;</dt>
810 <dd><p>Set the local RTP port to <var>n</var>.
811 </p>
812 <p>This is a deprecated option. Instead, &lsquo;<samp>localrtpport</samp>&rsquo; should be
813 used.
814 </p>
815 </dd>
816 </dl>
817
818 <p>Important notes:
819 </p>
820 <ol>
821 <li>
822 If &lsquo;<samp>rtcpport</samp>&rsquo; is not set the RTCP port will be set to the RTP
823 port value plus 1.
824
825 </li><li>
826 If &lsquo;<samp>localrtpport</samp>&rsquo; (the local RTP port) is not set any available
827 port will be used for the local RTP and RTCP ports.
828
829 </li><li>
830 If &lsquo;<samp>localrtcpport</samp>&rsquo; (the local RTCP port) is not set it will be
831 set to the the local RTP port value plus 1.
832 </li></ol>
833
834 <a name="rtsp"></a>
835 <h2 class="section"><a href="ffmpeg-protocols.html#toc-rtsp">2.24 rtsp</a></h2>
836
837 <p>Real-Time Streaming Protocol.
838 </p>
839 <p>RTSP is not technically a protocol handler in libavformat, it is a demuxer
840 and muxer. The demuxer supports both normal RTSP (with data transferred
841 over RTP; this is used by e.g. Apple and Microsoft) and Real-RTSP (with
842 data transferred over RDT).
843 </p>
844 <p>The muxer can be used to send a stream using RTSP ANNOUNCE to a server
845 supporting it (currently Darwin Streaming Server and Mischa Spiegelmock&rsquo;s
846 <a href="http://github.com/revmischa/rtsp-server">RTSP server</a>).
847 </p>
848 <p>The required syntax for a RTSP url is:
849 </p><table><tr><td>&nbsp;</td><td><pre class="example">rtsp://<var>hostname</var>[:<var>port</var>]/<var>path</var>
850 </pre></td></tr></table>
851
852 <p>Options can be set on the <code>ffmpeg</code>/<code>ffplay</code> command
853 line, or set in code via <code>AVOption</code>s or in
854 <code>avformat_open_input</code>.
855 </p>
856 <p>The following options are supported.
857 </p>
858 <dl compact="compact">
859 <dt> &lsquo;<samp>initial_pause</samp>&rsquo;</dt>
860 <dd><p>Do not start playing the stream immediately if set to 1. Default value
861 is 0.
862 </p>
863 </dd>
864 <dt> &lsquo;<samp>rtsp_transport</samp>&rsquo;</dt>
865 <dd><p>Set RTSP trasport protocols.
866 </p>
867 <p>It accepts the following values:
868 </p><dl compact="compact">
869 <dt> &lsquo;<samp>udp</samp>&rsquo;</dt>
870 <dd><p>Use UDP as lower transport protocol.
871 </p>
872 </dd>
873 <dt> &lsquo;<samp>tcp</samp>&rsquo;</dt>
874 <dd><p>Use TCP (interleaving within the RTSP control channel) as lower
875 transport protocol.
876 </p>
877 </dd>
878 <dt> &lsquo;<samp>udp_multicast</samp>&rsquo;</dt>
879 <dd><p>Use UDP multicast as lower transport protocol.
880 </p>
881 </dd>
882 <dt> &lsquo;<samp>http</samp>&rsquo;</dt>
883 <dd><p>Use HTTP tunneling as lower transport protocol, which is useful for
884 passing proxies.
885 </p></dd>
886 </dl>
887
888 <p>Multiple lower transport protocols may be specified, in that case they are
889 tried one at a time (if the setup of one fails, the next one is tried).
890 For the muxer, only the &lsquo;<samp>tcp</samp>&rsquo; and &lsquo;<samp>udp</samp>&rsquo; options are supported.
891 </p>
892 </dd>
893 <dt> &lsquo;<samp>rtsp_flags</samp>&rsquo;</dt>
894 <dd><p>Set RTSP flags.
895 </p>
896 <p>The following values are accepted:
897 </p><dl compact="compact">
898 <dt> &lsquo;<samp>filter_src</samp>&rsquo;</dt>
899 <dd><p>Accept packets only from negotiated peer address and port.
900 </p></dd>
901 <dt> &lsquo;<samp>listen</samp>&rsquo;</dt>
902 <dd><p>Act as a server, listening for an incoming connection.
903 </p></dd>
904 </dl>
905
906 <p>Default value is &lsquo;<samp>none</samp>&rsquo;.
907 </p>
908 </dd>
909 <dt> &lsquo;<samp>allowed_media_types</samp>&rsquo;</dt>
910 <dd><p>Set media types to accept from the server.
911 </p>
912 <p>The following flags are accepted:
913 </p><dl compact="compact">
914 <dt> &lsquo;<samp>video</samp>&rsquo;</dt>
915 <dt> &lsquo;<samp>audio</samp>&rsquo;</dt>
916 <dt> &lsquo;<samp>data</samp>&rsquo;</dt>
917 </dl>
918
919 <p>By default it accepts all media types.
920 </p>
921 </dd>
922 <dt> &lsquo;<samp>min_port</samp>&rsquo;</dt>
923 <dd><p>Set minimum local UDP port. Default value is 5000.
924 </p>
925 </dd>
926 <dt> &lsquo;<samp>max_port</samp>&rsquo;</dt>
927 <dd><p>Set maximum local UDP port. Default value is 65000.
928 </p>
929 </dd>
930 <dt> &lsquo;<samp>timeout</samp>&rsquo;</dt>
931 <dd><p>Set maximum timeout (in seconds) to wait for incoming connections.
932 </p>
933 <p>A value of -1 mean infinite (default). This option implies the
934 &lsquo;<samp>rtsp_flags</samp>&rsquo; set to &lsquo;<samp>listen</samp>&rsquo;.
935 </p>
936 </dd>
937 <dt> &lsquo;<samp>reorder_queue_size</samp>&rsquo;</dt>
938 <dd><p>Set number of packets to buffer for handling of reordered packets.
939 </p>
940 </dd>
941 <dt> &lsquo;<samp>stimeout</samp>&rsquo;</dt>
942 <dd><p>Set socket TCP I/O timeout in micro seconds.
943 </p>
944 </dd>
945 <dt> &lsquo;<samp>user-agent</samp>&rsquo;</dt>
946 <dd><p>Override User-Agent header. If not specified, it default to the
947 libavformat identifier string.
948 </p></dd>
949 </dl>
950
951 <p>When receiving data over UDP, the demuxer tries to reorder received packets
952 (since they may arrive out of order, or packets may get lost totally). This
953 can be disabled by setting the maximum demuxing delay to zero (via
954 the <code>max_delay</code> field of AVFormatContext).
955 </p>
956 <p>When watching multi-bitrate Real-RTSP streams with <code>ffplay</code>, the
957 streams to display can be chosen with <code>-vst</code> <var>n</var> and
958 <code>-ast</code> <var>n</var> for video and audio respectively, and can be switched
959 on the fly by pressing <code>v</code> and <code>a</code>.
960 </p>
961 <a name="Examples"></a>
962 <h3 class="subsection"><a href="ffmpeg-protocols.html#toc-Examples">2.24.1 Examples</a></h3>
963
964 <p>The following examples all make use of the <code>ffplay</code> and
965 <code>ffmpeg</code> tools.
966 </p>
967 <ul>
968 <li>
969 Watch a stream over UDP, with a max reordering delay of 0.5 seconds:
970 <table><tr><td>&nbsp;</td><td><pre class="example">ffplay -max_delay 500000 -rtsp_transport udp rtsp://server/video.mp4
971 </pre></td></tr></table>
972
973 </li><li>
974 Watch a stream tunneled over HTTP:
975 <table><tr><td>&nbsp;</td><td><pre class="example">ffplay -rtsp_transport http rtsp://server/video.mp4
976 </pre></td></tr></table>
977
978 </li><li>
979 Send a stream in realtime to a RTSP server, for others to watch:
980 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -re -i <var>input</var> -f rtsp -muxdelay 0.1 rtsp://server/live.sdp
981 </pre></td></tr></table>
982
983 </li><li>
984 Receive a stream in realtime:
985 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -rtsp_flags listen -i rtsp://ownaddress/live.sdp <var>output</var>
986 </pre></td></tr></table>
987 </li></ul>
988
989 <a name="sap"></a>
990 <h2 class="section"><a href="ffmpeg-protocols.html#toc-sap">2.25 sap</a></h2>
991
992 <p>Session Announcement Protocol (RFC 2974). This is not technically a
993 protocol handler in libavformat, it is a muxer and demuxer.
994 It is used for signalling of RTP streams, by announcing the SDP for the
995 streams regularly on a separate port.
996 </p>
997 <a name="Muxer"></a>
998 <h3 class="subsection"><a href="ffmpeg-protocols.html#toc-Muxer">2.25.1 Muxer</a></h3>
999
1000 <p>The syntax for a SAP url given to the muxer is:
1001 </p><table><tr><td>&nbsp;</td><td><pre class="example">sap://<var>destination</var>[:<var>port</var>][?<var>options</var>]
1002 </pre></td></tr></table>
1003
1004 <p>The RTP packets are sent to <var>destination</var> on port <var>port</var>,
1005 or to port 5004 if no port is specified.
1006 <var>options</var> is a <code>&amp;</code>-separated list. The following options
1007 are supported:
1008 </p>
1009 <dl compact="compact">
1010 <dt> &lsquo;<samp>announce_addr=<var>address</var></samp>&rsquo;</dt>
1011 <dd><p>Specify the destination IP address for sending the announcements to.
1012 If omitted, the announcements are sent to the commonly used SAP
1013 announcement multicast address 224.2.127.254 (sap.mcast.net), or
1014 ff0e::2:7ffe if <var>destination</var> is an IPv6 address.
1015 </p>
1016 </dd>
1017 <dt> &lsquo;<samp>announce_port=<var>port</var></samp>&rsquo;</dt>
1018 <dd><p>Specify the port to send the announcements on, defaults to
1019 9875 if not specified.
1020 </p>
1021 </dd>
1022 <dt> &lsquo;<samp>ttl=<var>ttl</var></samp>&rsquo;</dt>
1023 <dd><p>Specify the time to live value for the announcements and RTP packets,
1024 defaults to 255.
1025 </p>
1026 </dd>
1027 <dt> &lsquo;<samp>same_port=<var>0|1</var></samp>&rsquo;</dt>
1028 <dd><p>If set to 1, send all RTP streams on the same port pair. If zero (the
1029 default), all streams are sent on unique ports, with each stream on a
1030 port 2 numbers higher than the previous.
1031 VLC/Live555 requires this to be set to 1, to be able to receive the stream.
1032 The RTP stack in libavformat for receiving requires all streams to be sent
1033 on unique ports.
1034 </p></dd>
1035 </dl>
1036
1037 <p>Example command lines follow.
1038 </p>
1039 <p>To broadcast a stream on the local subnet, for watching in VLC:
1040 </p>
1041 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -re -i <var>input</var> -f sap sap://224.0.0.255?same_port=1
1042 </pre></td></tr></table>
1043
1044 <p>Similarly, for watching in <code>ffplay</code>:
1045 </p>
1046 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -re -i <var>input</var> -f sap sap://224.0.0.255
1047 </pre></td></tr></table>
1048
1049 <p>And for watching in <code>ffplay</code>, over IPv6:
1050 </p>
1051 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -re -i <var>input</var> -f sap sap://[ff0e::1:2:3:4]
1052 </pre></td></tr></table>
1053
1054 <a name="Demuxer"></a>
1055 <h3 class="subsection"><a href="ffmpeg-protocols.html#toc-Demuxer">2.25.2 Demuxer</a></h3>
1056
1057 <p>The syntax for a SAP url given to the demuxer is:
1058 </p><table><tr><td>&nbsp;</td><td><pre class="example">sap://[<var>address</var>][:<var>port</var>]
1059 </pre></td></tr></table>
1060
1061 <p><var>address</var> is the multicast address to listen for announcements on,
1062 if omitted, the default 224.2.127.254 (sap.mcast.net) is used. <var>port</var>
1063 is the port that is listened on, 9875 if omitted.
1064 </p>
1065 <p>The demuxers listens for announcements on the given address and port.
1066 Once an announcement is received, it tries to receive that particular stream.
1067 </p>
1068 <p>Example command lines follow.
1069 </p>
1070 <p>To play back the first stream announced on the normal SAP multicast address:
1071 </p>
1072 <table><tr><td>&nbsp;</td><td><pre class="example">ffplay sap://
1073 </pre></td></tr></table>
1074
1075 <p>To play back the first stream announced on one the default IPv6 SAP multicast address:
1076 </p>
1077 <table><tr><td>&nbsp;</td><td><pre class="example">ffplay sap://[ff0e::2:7ffe]
1078 </pre></td></tr></table>
1079
1080 <a name="sctp"></a>
1081 <h2 class="section"><a href="ffmpeg-protocols.html#toc-sctp">2.26 sctp</a></h2>
1082
1083 <p>Stream Control Transmission Protocol.
1084 </p>
1085 <p>The accepted URL syntax is:
1086 </p><table><tr><td>&nbsp;</td><td><pre class="example">sctp://<var>host</var>:<var>port</var>[?<var>options</var>]
1087 </pre></td></tr></table>
1088
1089 <p>The protocol accepts the following options:
1090 </p><dl compact="compact">
1091 <dt> &lsquo;<samp>listen</samp>&rsquo;</dt>
1092 <dd><p>If set to any value, listen for an incoming connection. Outgoing connection is done by default.
1093 </p>
1094 </dd>
1095 <dt> &lsquo;<samp>max_streams</samp>&rsquo;</dt>
1096 <dd><p>Set the maximum number of streams. By default no limit is set.
1097 </p></dd>
1098 </dl>
1099
1100 <a name="srtp"></a>
1101 <h2 class="section"><a href="ffmpeg-protocols.html#toc-srtp">2.27 srtp</a></h2>
1102
1103 <p>Secure Real-time Transport Protocol.
1104 </p>
1105 <p>The accepted options are:
1106 </p><dl compact="compact">
1107 <dt> &lsquo;<samp>srtp_in_suite</samp>&rsquo;</dt>
1108 <dt> &lsquo;<samp>srtp_out_suite</samp>&rsquo;</dt>
1109 <dd><p>Select input and output encoding suites.
1110 </p>
1111 <p>Supported values:
1112 </p><dl compact="compact">
1113 <dt> &lsquo;<samp>AES_CM_128_HMAC_SHA1_80</samp>&rsquo;</dt>
1114 <dt> &lsquo;<samp>SRTP_AES128_CM_HMAC_SHA1_80</samp>&rsquo;</dt>
1115 <dt> &lsquo;<samp>AES_CM_128_HMAC_SHA1_32</samp>&rsquo;</dt>
1116 <dt> &lsquo;<samp>SRTP_AES128_CM_HMAC_SHA1_32</samp>&rsquo;</dt>
1117 </dl>
1118
1119 </dd>
1120 <dt> &lsquo;<samp>srtp_in_params</samp>&rsquo;</dt>
1121 <dt> &lsquo;<samp>srtp_out_params</samp>&rsquo;</dt>
1122 <dd><p>Set input and output encoding parameters, which are expressed by a
1123 base64-encoded representation of a binary block. The first 16 bytes of
1124 this binary block are used as master key, the following 14 bytes are
1125 used as master salt.
1126 </p></dd>
1127 </dl>
1128
1129 <a name="tcp"></a>
1130 <h2 class="section"><a href="ffmpeg-protocols.html#toc-tcp">2.28 tcp</a></h2>
1131
1132 <p>Transmission Control Protocol.
1133 </p>
1134 <p>The required syntax for a TCP url is:
1135 </p><table><tr><td>&nbsp;</td><td><pre class="example">tcp://<var>hostname</var>:<var>port</var>[?<var>options</var>]
1136 </pre></td></tr></table>
1137
1138 <p><var>options</var> contains a list of &amp;-separated options of the form
1139 <var>key</var>=<var>val</var>.
1140 </p>
1141 <p>The list of supported options follows.
1142 </p>
1143 <dl compact="compact">
1144 <dt> &lsquo;<samp>listen=<var>1|0</var></samp>&rsquo;</dt>
1145 <dd><p>Listen for an incoming connection. Default value is 0.
1146 </p>
1147 </dd>
1148 <dt> &lsquo;<samp>timeout=<var>microseconds</var></samp>&rsquo;</dt>
1149 <dd><p>Set raise error timeout, expressed in microseconds.
1150 </p>
1151 <p>This option is only relevant in read mode: if no data arrived in more
1152 than this time interval, raise error.
1153 </p>
1154 </dd>
1155 <dt> &lsquo;<samp>listen_timeout=<var>microseconds</var></samp>&rsquo;</dt>
1156 <dd><p>Set listen timeout, expressed in microseconds.
1157 </p></dd>
1158 </dl>
1159
1160 <p>The following example shows how to setup a listening TCP connection
1161 with <code>ffmpeg</code>, which is then accessed with <code>ffplay</code>:
1162 </p><table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i <var>input</var> -f <var>format</var> tcp://<var>hostname</var>:<var>port</var>?listen
1163 ffplay tcp://<var>hostname</var>:<var>port</var>
1164 </pre></td></tr></table>
1165
1166 <a name="tls"></a>
1167 <h2 class="section"><a href="ffmpeg-protocols.html#toc-tls">2.29 tls</a></h2>
1168
1169 <p>Transport Layer Security (TLS) / Secure Sockets Layer (SSL)
1170 </p>
1171 <p>The required syntax for a TLS/SSL url is:
1172 </p><table><tr><td>&nbsp;</td><td><pre class="example">tls://<var>hostname</var>:<var>port</var>[?<var>options</var>]
1173 </pre></td></tr></table>
1174
1175 <p>The following parameters can be set via command line options
1176 (or in code via <code>AVOption</code>s):
1177 </p>
1178 <dl compact="compact">
1179 <dt> &lsquo;<samp>ca_file, cafile=<var>filename</var></samp>&rsquo;</dt>
1180 <dd><p>A file containing certificate authority (CA) root certificates to treat
1181 as trusted. If the linked TLS library contains a default this might not
1182 need to be specified for verification to work, but not all libraries and
1183 setups have defaults built in.
1184 The file must be in OpenSSL PEM format.
1185 </p>
1186 </dd>
1187 <dt> &lsquo;<samp>tls_verify=<var>1|0</var></samp>&rsquo;</dt>
1188 <dd><p>If enabled, try to verify the peer that we are communicating with.
1189 Note, if using OpenSSL, this currently only makes sure that the
1190 peer certificate is signed by one of the root certificates in the CA
1191 database, but it does not validate that the certificate actually
1192 matches the host name we are trying to connect to. (With GnuTLS,
1193 the host name is validated as well.)
1194 </p>
1195 <p>This is disabled by default since it requires a CA database to be
1196 provided by the caller in many cases.
1197 </p>
1198 </dd>
1199 <dt> &lsquo;<samp>cert_file, cert=<var>filename</var></samp>&rsquo;</dt>
1200 <dd><p>A file containing a certificate to use in the handshake with the peer.
1201 (When operating as server, in listen mode, this is more often required
1202 by the peer, while client certificates only are mandated in certain
1203 setups.)
1204 </p>
1205 </dd>
1206 <dt> &lsquo;<samp>key_file, key=<var>filename</var></samp>&rsquo;</dt>
1207 <dd><p>A file containing the private key for the certificate.
1208 </p>
1209 </dd>
1210 <dt> &lsquo;<samp>listen=<var>1|0</var></samp>&rsquo;</dt>
1211 <dd><p>If enabled, listen for connections on the provided port, and assume
1212 the server role in the handshake instead of the client role.
1213 </p>
1214 </dd>
1215 </dl>
1216
1217 <p>Example command lines:
1218 </p>
1219 <p>To create a TLS/SSL server that serves an input stream.
1220 </p>
1221 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i <var>input</var> -f <var>format</var> tls://<var>hostname</var>:<var>port</var>?listen&amp;cert=<var>server.crt</var>&amp;key=<var>server.key</var>
1222 </pre></td></tr></table>
1223
1224 <p>To play back a stream from the TLS/SSL server using <code>ffplay</code>:
1225 </p>
1226 <table><tr><td>&nbsp;</td><td><pre class="example">ffplay tls://<var>hostname</var>:<var>port</var>
1227 </pre></td></tr></table>
1228
1229 <a name="udp"></a>
1230 <h2 class="section"><a href="ffmpeg-protocols.html#toc-udp">2.30 udp</a></h2>
1231
1232 <p>User Datagram Protocol.
1233 </p>
1234 <p>The required syntax for an UDP URL is:
1235 </p><table><tr><td>&nbsp;</td><td><pre class="example">udp://<var>hostname</var>:<var>port</var>[?<var>options</var>]
1236 </pre></td></tr></table>
1237
1238 <p><var>options</var> contains a list of &amp;-separated options of the form <var>key</var>=<var>val</var>.
1239 </p>
1240 <p>In case threading is enabled on the system, a circular buffer is used
1241 to store the incoming data, which allows one to reduce loss of data due to
1242 UDP socket buffer overruns. The <var>fifo_size</var> and
1243 <var>overrun_nonfatal</var> options are related to this buffer.
1244 </p>
1245 <p>The list of supported options follows.
1246 </p>
1247 <dl compact="compact">
1248 <dt> &lsquo;<samp>buffer_size=<var>size</var></samp>&rsquo;</dt>
1249 <dd><p>Set the UDP socket buffer size in bytes. This is used both for the
1250 receiving and the sending buffer size.
1251 </p>
1252 </dd>
1253 <dt> &lsquo;<samp>localport=<var>port</var></samp>&rsquo;</dt>
1254 <dd><p>Override the local UDP port to bind with.
1255 </p>
1256 </dd>
1257 <dt> &lsquo;<samp>localaddr=<var>addr</var></samp>&rsquo;</dt>
1258 <dd><p>Choose the local IP address. This is useful e.g. if sending multicast
1259 and the host has multiple interfaces, where the user can choose
1260 which interface to send on by specifying the IP address of that interface.
1261 </p>
1262 </dd>
1263 <dt> &lsquo;<samp>pkt_size=<var>size</var></samp>&rsquo;</dt>
1264 <dd><p>Set the size in bytes of UDP packets.
1265 </p>
1266 </dd>
1267 <dt> &lsquo;<samp>reuse=<var>1|0</var></samp>&rsquo;</dt>
1268 <dd><p>Explicitly allow or disallow reusing UDP sockets.
1269 </p>
1270 </dd>
1271 <dt> &lsquo;<samp>ttl=<var>ttl</var></samp>&rsquo;</dt>
1272 <dd><p>Set the time to live value (for multicast only).
1273 </p>
1274 </dd>
1275 <dt> &lsquo;<samp>connect=<var>1|0</var></samp>&rsquo;</dt>
1276 <dd><p>Initialize the UDP socket with <code>connect()</code>. In this case, the
1277 destination address can&rsquo;t be changed with ff_udp_set_remote_url later.
1278 If the destination address isn&rsquo;t known at the start, this option can
1279 be specified in ff_udp_set_remote_url, too.
1280 This allows finding out the source address for the packets with getsockname,
1281 and makes writes return with AVERROR(ECONNREFUSED) if &quot;destination
1282 unreachable&quot; is received.
1283 For receiving, this gives the benefit of only receiving packets from
1284 the specified peer address/port.
1285 </p>
1286 </dd>
1287 <dt> &lsquo;<samp>sources=<var>address</var>[,<var>address</var>]</samp>&rsquo;</dt>
1288 <dd><p>Only receive packets sent to the multicast group from one of the
1289 specified sender IP addresses.
1290 </p>
1291 </dd>
1292 <dt> &lsquo;<samp>block=<var>address</var>[,<var>address</var>]</samp>&rsquo;</dt>
1293 <dd><p>Ignore packets sent to the multicast group from the specified
1294 sender IP addresses.
1295 </p>
1296 </dd>
1297 <dt> &lsquo;<samp>fifo_size=<var>units</var></samp>&rsquo;</dt>
1298 <dd><p>Set the UDP receiving circular buffer size, expressed as a number of
1299 packets with size of 188 bytes. If not specified defaults to 7*4096.
1300 </p>
1301 </dd>
1302 <dt> &lsquo;<samp>overrun_nonfatal=<var>1|0</var></samp>&rsquo;</dt>
1303 <dd><p>Survive in case of UDP receiving circular buffer overrun. Default
1304 value is 0.
1305 </p>
1306 </dd>
1307 <dt> &lsquo;<samp>timeout=<var>microseconds</var></samp>&rsquo;</dt>
1308 <dd><p>Set raise error timeout, expressed in microseconds.
1309 </p>
1310 <p>This option is only relevant in read mode: if no data arrived in more
1311 than this time interval, raise error.
1312 </p></dd>
1313 </dl>
1314
1315 <a name="Examples-1"></a>
1316 <h3 class="subsection"><a href="ffmpeg-protocols.html#toc-Examples-1">2.30.1 Examples</a></h3>
1317
1318 <ul>
1319 <li>
1320 Use <code>ffmpeg</code> to stream over UDP to a remote endpoint:
1321 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i <var>input</var> -f <var>format</var> udp://<var>hostname</var>:<var>port</var>
1322 </pre></td></tr></table>
1323
1324 </li><li>
1325 Use <code>ffmpeg</code> to stream in mpegts format over UDP using 188
1326 sized UDP packets, using a large input buffer:
1327 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i <var>input</var> -f mpegts udp://<var>hostname</var>:<var>port</var>?pkt_size=188&amp;buffer_size=65535
1328 </pre></td></tr></table>
1329
1330 </li><li>
1331 Use <code>ffmpeg</code> to receive over UDP from a remote endpoint:
1332 <table><tr><td>&nbsp;</td><td><pre class="example">ffmpeg -i udp://[<var>multicast-address</var>]:<var>port</var> ...
1333 </pre></td></tr></table>
1334 </li></ul>
1335
1336 <a name="unix"></a>
1337 <h2 class="section"><a href="ffmpeg-protocols.html#toc-unix">2.31 unix</a></h2>
1338
1339 <p>Unix local socket
1340 </p>
1341 <p>The required syntax for a Unix socket URL is:
1342 </p>
1343 <table><tr><td>&nbsp;</td><td><pre class="example">unix://<var>filepath</var>
1344 </pre></td></tr></table>
1345
1346 <p>The following parameters can be set via command line options
1347 (or in code via <code>AVOption</code>s):
1348 </p>
1349 <dl compact="compact">
1350 <dt> &lsquo;<samp>timeout</samp>&rsquo;</dt>
1351 <dd><p>Timeout in ms.
1352 </p></dd>
1353 <dt> &lsquo;<samp>listen</samp>&rsquo;</dt>
1354 <dd><p>Create the Unix socket in listening mode.
1355 </p></dd>
1356 </dl>
1357
1358
1359 <a name="See-Also"></a>
1360 <h1 class="chapter"><a href="ffmpeg-protocols.html#toc-See-Also">3. See Also</a></h1>
1361
1362 <p><a href="ffmpeg.html">ffmpeg</a>, <a href="ffplay.html">ffplay</a>, <a href="ffprobe.html">ffprobe</a>, <a href="ffserver.html">ffserver</a>,
1363 <a href="libavformat.html">libavformat</a>
1364 </p>
1365
1366 <a name="Authors"></a>
1367 <h1 class="chapter"><a href="ffmpeg-protocols.html#toc-Authors">4. Authors</a></h1>
1368
1369 <p>The FFmpeg developers.
1370 </p>
1371 <p>For details about the authorship, see the Git history of the project
1372 (git://source.ffmpeg.org/ffmpeg), e.g. by typing the command
1373 <code>git log</code> in the FFmpeg source directory, or browsing the
1374 online repository at <a href="http://source.ffmpeg.org">http://source.ffmpeg.org</a>.
1375 </p>
1376 <p>Maintainers for the specific components are listed in the file
1377 &lsquo;<tt>MAINTAINERS</tt>&rsquo; in the source code tree.
1378 </p>
1379
1380 <footer class="footer pagination-right">
1381 <span class="label label-info">This document was generated by <em>Kyle Schwarz</em> on <em>June 19, 2014</em> using <a href="http://www.nongnu.org/texi2html/"><em>texi2html 1.82</em></a>.</span></footer></div></div></body>