ffmpeg-protocols.html 82 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  6. <title>FFmpeg documentation</title>
  7. <link rel="stylesheet" href="bootstrap.min.css" />
  8. <link rel="stylesheet" href="style.min.css" />
  9. <meta name="description" content="FFmpeg Protocols Documentation: ">
  10. <meta name="keywords" content="FFmpeg documentation : FFmpeg Protocols ">
  11. <meta name="Generator" content="texi2html 5.0">
  12. <!-- Created on June 8, 2020 by texi2html 5.0 -->
  13. <!--
  14. texi2html was written by:
  15. Lionel Cons <Lionel.Cons@cern.ch> (original author)
  16. Karl Berry <karl@freefriends.org>
  17. Olaf Bachmann <obachman@mathematik.uni-kl.de>
  18. and many others.
  19. Maintained by: Many creative people.
  20. Send bugs and suggestions to <texi2html-bug@nongnu.org>
  21. -->
  22. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  23. </head>
  24. <body>
  25. <div class="container">
  26. <h1 class="titlefont">FFmpeg Protocols Documentation</h1>
  27. <hr>
  28. <a name="SEC_Top"></a>
  29. <a name="SEC_Contents"></a>
  30. <h1>Table of Contents</h1>
  31. <div class="contents">
  32. <ul class="no-bullet">
  33. <li><a name="toc-Description" href="#Description">1 Description</a></li>
  34. <li><a name="toc-Protocol-Options" href="#Protocol-Options">2 Protocol Options</a></li>
  35. <li><a name="toc-Protocols" href="#Protocols">3 Protocols</a>
  36. <ul class="no-bullet">
  37. <li><a name="toc-amqp" href="#amqp">3.1 amqp</a></li>
  38. <li><a name="toc-async" href="#async">3.2 async</a></li>
  39. <li><a name="toc-bluray" href="#bluray">3.3 bluray</a></li>
  40. <li><a name="toc-cache" href="#cache">3.4 cache</a></li>
  41. <li><a name="toc-concat" href="#concat">3.5 concat</a></li>
  42. <li><a name="toc-crypto" href="#crypto">3.6 crypto</a></li>
  43. <li><a name="toc-data" href="#data">3.7 data</a></li>
  44. <li><a name="toc-file" href="#file">3.8 file</a></li>
  45. <li><a name="toc-ftp" href="#ftp">3.9 ftp</a></li>
  46. <li><a name="toc-gopher" href="#gopher">3.10 gopher</a></li>
  47. <li><a name="toc-hls" href="#hls">3.11 hls</a></li>
  48. <li><a name="toc-http" href="#http">3.12 http</a>
  49. <ul class="no-bullet">
  50. <li><a name="toc-HTTP-Cookies" href="#HTTP-Cookies">3.12.1 HTTP Cookies</a></li>
  51. </ul></li>
  52. <li><a name="toc-Icecast" href="#Icecast">3.13 Icecast</a></li>
  53. <li><a name="toc-mmst" href="#mmst">3.14 mmst</a></li>
  54. <li><a name="toc-mmsh" href="#mmsh">3.15 mmsh</a></li>
  55. <li><a name="toc-md5" href="#md5">3.16 md5</a></li>
  56. <li><a name="toc-pipe" href="#pipe">3.17 pipe</a></li>
  57. <li><a name="toc-prompeg" href="#prompeg">3.18 prompeg</a></li>
  58. <li><a name="toc-rtmp" href="#rtmp">3.19 rtmp</a></li>
  59. <li><a name="toc-rtmpe" href="#rtmpe">3.20 rtmpe</a></li>
  60. <li><a name="toc-rtmps" href="#rtmps">3.21 rtmps</a></li>
  61. <li><a name="toc-rtmpt" href="#rtmpt">3.22 rtmpt</a></li>
  62. <li><a name="toc-rtmpte" href="#rtmpte">3.23 rtmpte</a></li>
  63. <li><a name="toc-rtmpts" href="#rtmpts">3.24 rtmpts</a></li>
  64. <li><a name="toc-libsmbclient" href="#libsmbclient">3.25 libsmbclient</a></li>
  65. <li><a name="toc-libssh" href="#libssh">3.26 libssh</a></li>
  66. <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">3.27 librtmp rtmp, rtmpe, rtmps, rtmpt, rtmpte</a></li>
  67. <li><a name="toc-rtp" href="#rtp">3.28 rtp</a></li>
  68. <li><a name="toc-rtsp" href="#rtsp">3.29 rtsp</a>
  69. <ul class="no-bullet">
  70. <li><a name="toc-Examples" href="#Examples">3.29.1 Examples</a></li>
  71. </ul></li>
  72. <li><a name="toc-sap" href="#sap">3.30 sap</a>
  73. <ul class="no-bullet">
  74. <li><a name="toc-Muxer" href="#Muxer">3.30.1 Muxer</a></li>
  75. <li><a name="toc-Demuxer" href="#Demuxer">3.30.2 Demuxer</a></li>
  76. </ul></li>
  77. <li><a name="toc-sctp" href="#sctp">3.31 sctp</a></li>
  78. <li><a name="toc-srt" href="#srt">3.32 srt</a></li>
  79. <li><a name="toc-srtp" href="#srtp">3.33 srtp</a></li>
  80. <li><a name="toc-subfile" href="#subfile">3.34 subfile</a></li>
  81. <li><a name="toc-tee" href="#tee">3.35 tee</a></li>
  82. <li><a name="toc-tcp" href="#tcp">3.36 tcp</a></li>
  83. <li><a name="toc-tls" href="#tls">3.37 tls</a></li>
  84. <li><a name="toc-udp" href="#udp">3.38 udp</a>
  85. <ul class="no-bullet">
  86. <li><a name="toc-Examples-1" href="#Examples-1">3.38.1 Examples</a></li>
  87. </ul></li>
  88. <li><a name="toc-unix" href="#unix">3.39 unix</a></li>
  89. <li><a name="toc-zmq" href="#zmq">3.40 zmq</a></li>
  90. </ul></li>
  91. <li><a name="toc-See-Also" href="#See-Also">4 See Also</a></li>
  92. <li><a name="toc-Authors" href="#Authors">5 Authors</a></li>
  93. </ul>
  94. </div>
  95. <hr size="6">
  96. <a name="Description"></a>
  97. <h1 class="chapter"><a href="ffmpeg-protocols.html#toc-Description">1 Description</a></h1>
  98. <p>This document describes the input and output protocols provided by the
  99. libavformat library.
  100. </p>
  101. <a name="Protocol-Options"></a>
  102. <h1 class="chapter"><a href="ffmpeg-protocols.html#toc-Protocol-Options">2 Protocol Options</a></h1>
  103. <p>The libavformat library provides some generic global options, which
  104. can be set on all the protocols. In addition each protocol may support
  105. so-called private options, which are specific for that component.
  106. </p>
  107. <p>Options may be set by specifying -<var>option</var> <var>value</var> in the
  108. FFmpeg tools, or by setting the value explicitly in the
  109. <code>AVFormatContext</code> options or using the &lsquo;<tt>libavutil/opt.h</tt>&rsquo; API
  110. for programmatic use.
  111. </p>
  112. <p>The list of supported options follows:
  113. </p>
  114. <dl compact="compact">
  115. <dt>&lsquo;<samp>protocol_whitelist <var>list</var> (<em>input</em>)</samp>&rsquo;</dt>
  116. <dd><p>Set a &quot;,&quot;-separated list of allowed protocols. &quot;ALL&quot; matches all protocols. Protocols
  117. prefixed by &quot;-&quot; are disabled.
  118. All protocols are allowed by default but protocols used by an another
  119. protocol (nested protocols) are restricted to a per protocol subset.
  120. </p></dd>
  121. </dl>
  122. <a name="Protocols"></a>
  123. <h1 class="chapter"><a href="ffmpeg-protocols.html#toc-Protocols">3 Protocols</a></h1>
  124. <p>Protocols are configured elements in FFmpeg that enable access to
  125. resources that require specific protocols.
  126. </p>
  127. <p>When you configure your FFmpeg build, all the supported protocols are
  128. enabled by default. You can list all available ones using the
  129. configure option &quot;&ndash;list-protocols&quot;.
  130. </p>
  131. <p>You can disable all the protocols using the configure option
  132. &quot;&ndash;disable-protocols&quot;, and selectively enable a protocol using the
  133. option &quot;&ndash;enable-protocol=<var>PROTOCOL</var>&quot;, or you can disable a
  134. particular protocol using the option
  135. &quot;&ndash;disable-protocol=<var>PROTOCOL</var>&quot;.
  136. </p>
  137. <p>The option &quot;-protocols&quot; of the ff* tools will display the list of
  138. supported protocols.
  139. </p>
  140. <p>All protocols accept the following options:
  141. </p>
  142. <dl compact="compact">
  143. <dt>&lsquo;<samp>rw_timeout</samp>&rsquo;</dt>
  144. <dd><p>Maximum time to wait for (network) read/write operations to complete,
  145. in microseconds.
  146. </p></dd>
  147. </dl>
  148. <p>A description of the currently available protocols follows.
  149. </p>
  150. <a name="amqp"></a>
  151. <h2 class="section"><a href="ffmpeg-protocols.html#toc-amqp">3.1 amqp</a></h2>
  152. <p>Advanced Message Queueing Protocol (AMQP) version 0-9-1 is a broker based
  153. publish-subscribe communication protocol.
  154. </p>
  155. <p>FFmpeg must be compiled with &ndash;enable-librabbitmq to support AMQP. A separate
  156. AMQP broker must also be run. An example open-source AMQP broker is RabbitMQ.
  157. </p>
  158. <p>After starting the broker, an FFmpeg client may stream data to the broker using
  159. the command:
  160. </p>
  161. <div class="example">
  162. <pre class="example">ffmpeg -re -i input -f mpegts amqp://[[user]:[password]@]hostname[:port]
  163. </pre></div>
  164. <p>Where hostname and port (default is 5672) is the address of the broker. The
  165. client may also set a user/password for authentication. The default for both
  166. fields is &quot;guest&quot;.
  167. </p>
  168. <p>Muliple subscribers may stream from the broker using the command:
  169. </p><div class="example">
  170. <pre class="example">ffplay amqp://[[user]:[password]@]hostname[:port]
  171. </pre></div>
  172. <p>In RabbitMQ all data published to the broker flows through a specific exchange,
  173. and each subscribing client has an assigned queue/buffer. When a packet arrives
  174. at an exchange, it may be copied to a client&rsquo;s queue depending on the exchange
  175. and routing_key fields.
  176. </p>
  177. <p>The following options are supported:
  178. </p>
  179. <dl compact="compact">
  180. <dt>&lsquo;<samp>exchange</samp>&rsquo;</dt>
  181. <dd><p>Sets the exchange to use on the broker. RabbitMQ has several predefined
  182. exchanges: &quot;amq.direct&quot; is the default exchange, where the publisher and
  183. subscriber must have a matching routing_key; &quot;amq.fanout&quot; is the same as a
  184. broadcast operation (i.e. the data is forwarded to all queues on the fanout
  185. exchange independent of the routing_key); and &quot;amq.topic&quot; is similar to
  186. &quot;amq.direct&quot;, but allows for more complex pattern matching (refer to the RabbitMQ
  187. documentation).
  188. </p>
  189. </dd>
  190. <dt>&lsquo;<samp>routing_key</samp>&rsquo;</dt>
  191. <dd><p>Sets the routing key. The default value is &quot;amqp&quot;. The routing key is used on
  192. the &quot;amq.direct&quot; and &quot;amq.topic&quot; exchanges to decide whether packets are written
  193. to the queue of a subscriber.
  194. </p>
  195. </dd>
  196. <dt>&lsquo;<samp>pkt_size</samp>&rsquo;</dt>
  197. <dd><p>Maximum size of each packet sent/received to the broker. Default is 131072.
  198. Minimum is 4096 and max is any large value (representable by an int). When
  199. receiving packets, this sets an internal buffer size in FFmpeg. It should be
  200. equal to or greater than the size of the published packets to the broker. Otherwise
  201. the received message may be truncated causing decoding errors.
  202. </p>
  203. </dd>
  204. <dt>&lsquo;<samp>connection_timeout</samp>&rsquo;</dt>
  205. <dd><p>The timeout in seconds during the initial connection to the broker. The
  206. default value is rw_timeout, or 5 seconds if rw_timeout is not set.
  207. </p>
  208. </dd>
  209. </dl>
  210. <a name="async"></a>
  211. <h2 class="section"><a href="ffmpeg-protocols.html#toc-async">3.2 async</a></h2>
  212. <p>Asynchronous data filling wrapper for input stream.
  213. </p>
  214. <p>Fill data in a background thread, to decouple I/O operation from demux thread.
  215. </p>
  216. <div class="example">
  217. <pre class="example">async:<var>URL</var>
  218. async:http://host/resource
  219. async:cache:http://host/resource
  220. </pre></div>
  221. <a name="bluray"></a>
  222. <h2 class="section"><a href="ffmpeg-protocols.html#toc-bluray">3.3 bluray</a></h2>
  223. <p>Read BluRay playlist.
  224. </p>
  225. <p>The accepted options are:
  226. </p><dl compact="compact">
  227. <dt>&lsquo;<samp>angle</samp>&rsquo;</dt>
  228. <dd><p>BluRay angle
  229. </p>
  230. </dd>
  231. <dt>&lsquo;<samp>chapter</samp>&rsquo;</dt>
  232. <dd><p>Start chapter (1...N)
  233. </p>
  234. </dd>
  235. <dt>&lsquo;<samp>playlist</samp>&rsquo;</dt>
  236. <dd><p>Playlist to read (BDMV/PLAYLIST/?????.mpls)
  237. </p>
  238. </dd>
  239. </dl>
  240. <p>Examples:
  241. </p>
  242. <p>Read longest playlist from BluRay mounted to /mnt/bluray:
  243. </p><div class="example">
  244. <pre class="example">bluray:/mnt/bluray
  245. </pre></div>
  246. <p>Read angle 2 of playlist 4 from BluRay mounted to /mnt/bluray, start from chapter 2:
  247. </p><div class="example">
  248. <pre class="example">-playlist 4 -angle 2 -chapter 2 bluray:/mnt/bluray
  249. </pre></div>
  250. <a name="cache"></a>
  251. <h2 class="section"><a href="ffmpeg-protocols.html#toc-cache">3.4 cache</a></h2>
  252. <p>Caching wrapper for input stream.
  253. </p>
  254. <p>Cache the input stream to temporary file. It brings seeking capability to live streams.
  255. </p>
  256. <div class="example">
  257. <pre class="example">cache:<var>URL</var>
  258. </pre></div>
  259. <a name="concat"></a>
  260. <h2 class="section"><a href="ffmpeg-protocols.html#toc-concat">3.5 concat</a></h2>
  261. <p>Physical concatenation protocol.
  262. </p>
  263. <p>Read and seek from many resources in sequence as if they were
  264. a unique resource.
  265. </p>
  266. <p>A URL accepted by this protocol has the syntax:
  267. </p><div class="example">
  268. <pre class="example">concat:<var>URL1</var>|<var>URL2</var>|...|<var>URLN</var>
  269. </pre></div>
  270. <p>where <var>URL1</var>, <var>URL2</var>, ..., <var>URLN</var> are the urls of the
  271. resource to be concatenated, each one possibly specifying a distinct
  272. protocol.
  273. </p>
  274. <p>For example to read a sequence of files &lsquo;<tt>split1.mpeg</tt>&rsquo;,
  275. &lsquo;<tt>split2.mpeg</tt>&rsquo;, &lsquo;<tt>split3.mpeg</tt>&rsquo; with <code>ffplay</code> use the
  276. command:
  277. </p><div class="example">
  278. <pre class="example">ffplay concat:split1.mpeg\|split2.mpeg\|split3.mpeg
  279. </pre></div>
  280. <p>Note that you may need to escape the character &quot;|&quot; which is special for
  281. many shells.
  282. </p>
  283. <a name="crypto"></a>
  284. <h2 class="section"><a href="ffmpeg-protocols.html#toc-crypto">3.6 crypto</a></h2>
  285. <p>AES-encrypted stream reading protocol.
  286. </p>
  287. <p>The accepted options are:
  288. </p><dl compact="compact">
  289. <dt>&lsquo;<samp>key</samp>&rsquo;</dt>
  290. <dd><p>Set the AES decryption key binary block from given hexadecimal representation.
  291. </p>
  292. </dd>
  293. <dt>&lsquo;<samp>iv</samp>&rsquo;</dt>
  294. <dd><p>Set the AES decryption initialization vector binary block from given hexadecimal representation.
  295. </p></dd>
  296. </dl>
  297. <p>Accepted URL formats:
  298. </p><div class="example">
  299. <pre class="example">crypto:<var>URL</var>
  300. crypto+<var>URL</var>
  301. </pre></div>
  302. <a name="data"></a>
  303. <h2 class="section"><a href="ffmpeg-protocols.html#toc-data">3.7 data</a></h2>
  304. <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>.
  305. </p>
  306. <p>For example, to convert a GIF file given inline with <code>ffmpeg</code>:
  307. </p><div class="example">
  308. <pre class="example">ffmpeg -i &quot;data:image/gif;base64,R0lGODdhCAAIAMIEAAAAAAAA//8AAP//AP///////////////ywAAAAACAAIAAADF0gEDLojDgdGiJdJqUX02iB4E8Q9jUMkADs=&quot; smiley.png
  309. </pre></div>
  310. <a name="file"></a>
  311. <h2 class="section"><a href="ffmpeg-protocols.html#toc-file">3.8 file</a></h2>
  312. <p>File access protocol.
  313. </p>
  314. <p>Read from or write to a file.
  315. </p>
  316. <p>A file URL can have the form:
  317. </p><div class="example">
  318. <pre class="example">file:<var>filename</var>
  319. </pre></div>
  320. <p>where <var>filename</var> is the path of the file to read.
  321. </p>
  322. <p>An URL that does not have a protocol prefix will be assumed to be a
  323. file URL. Depending on the build, an URL that looks like a Windows
  324. path with the drive letter at the beginning will also be assumed to be
  325. a file URL (usually not the case in builds for unix-like systems).
  326. </p>
  327. <p>For example to read from a file &lsquo;<tt>input.mpeg</tt>&rsquo; with <code>ffmpeg</code>
  328. use the command:
  329. </p><div class="example">
  330. <pre class="example">ffmpeg -i file:input.mpeg output.mpeg
  331. </pre></div>
  332. <p>This protocol accepts the following options:
  333. </p>
  334. <dl compact="compact">
  335. <dt>&lsquo;<samp>truncate</samp>&rsquo;</dt>
  336. <dd><p>Truncate existing files on write, if set to 1. A value of 0 prevents
  337. truncating. Default value is 1.
  338. </p>
  339. </dd>
  340. <dt>&lsquo;<samp>blocksize</samp>&rsquo;</dt>
  341. <dd><p>Set I/O operation maximum block size, in bytes. Default value is
  342. <code>INT_MAX</code>, which results in not limiting the requested block size.
  343. Setting this value reasonably low improves user termination request reaction
  344. time, which is valuable for files on slow medium.
  345. </p>
  346. </dd>
  347. <dt>&lsquo;<samp>follow</samp>&rsquo;</dt>
  348. <dd><p>If set to 1, the protocol will retry reading at the end of the file, allowing
  349. reading files that still are being written. In order for this to terminate,
  350. you either need to use the rw_timeout option, or use the interrupt callback
  351. (for API users).
  352. </p>
  353. </dd>
  354. <dt>&lsquo;<samp>seekable</samp>&rsquo;</dt>
  355. <dd><p>Controls if seekability is advertised on the file. 0 means non-seekable, -1
  356. means auto (seekable for normal files, non-seekable for named pipes).
  357. </p>
  358. <p>Many demuxers handle seekable and non-seekable resources differently,
  359. overriding this might speed up opening certain files at the cost of losing some
  360. features (e.g. accurate seeking).
  361. </p></dd>
  362. </dl>
  363. <a name="ftp"></a>
  364. <h2 class="section"><a href="ffmpeg-protocols.html#toc-ftp">3.9 ftp</a></h2>
  365. <p>FTP (File Transfer Protocol).
  366. </p>
  367. <p>Read from or write to remote resources using FTP protocol.
  368. </p>
  369. <p>Following syntax is required.
  370. </p><div class="example">
  371. <pre class="example">ftp://[user[:password]@]server[:port]/path/to/remote/resource.mpeg
  372. </pre></div>
  373. <p>This protocol accepts the following options.
  374. </p>
  375. <dl compact="compact">
  376. <dt>&lsquo;<samp>timeout</samp>&rsquo;</dt>
  377. <dd><p>Set timeout in microseconds of socket I/O operations used by the underlying low level
  378. operation. By default it is set to -1, which means that the timeout is
  379. not specified.
  380. </p>
  381. </dd>
  382. <dt>&lsquo;<samp>ftp-user</samp>&rsquo;</dt>
  383. <dd><p>Set a user to be used for authenticating to the FTP server. This is overridden by the
  384. user in the FTP URL.
  385. </p>
  386. </dd>
  387. <dt>&lsquo;<samp>ftp-password</samp>&rsquo;</dt>
  388. <dd><p>Set a password to be used for authenticating to the FTP server. This is overridden by
  389. the password in the FTP URL, or by &lsquo;<samp>ftp-anonymous-password</samp>&rsquo; if no user is set.
  390. </p>
  391. </dd>
  392. <dt>&lsquo;<samp>ftp-anonymous-password</samp>&rsquo;</dt>
  393. <dd><p>Password used when login as anonymous user. Typically an e-mail address
  394. should be used.
  395. </p>
  396. </dd>
  397. <dt>&lsquo;<samp>ftp-write-seekable</samp>&rsquo;</dt>
  398. <dd><p>Control seekability of connection during encoding. If set to 1 the
  399. resource is supposed to be seekable, if set to 0 it is assumed not
  400. to be seekable. Default value is 0.
  401. </p></dd>
  402. </dl>
  403. <p>NOTE: Protocol can be used as output, but it is recommended to not do
  404. it, unless special care is taken (tests, customized server configuration
  405. etc.). Different FTP servers behave in different way during seek
  406. operation. ff* tools may produce incomplete content due to server limitations.
  407. </p>
  408. <a name="gopher"></a>
  409. <h2 class="section"><a href="ffmpeg-protocols.html#toc-gopher">3.10 gopher</a></h2>
  410. <p>Gopher protocol.
  411. </p>
  412. <a name="hls"></a>
  413. <h2 class="section"><a href="ffmpeg-protocols.html#toc-hls">3.11 hls</a></h2>
  414. <p>Read Apple HTTP Live Streaming compliant segmented stream as
  415. a uniform one. The M3U8 playlists describing the segments can be
  416. remote HTTP resources or local files, accessed using the standard
  417. file protocol.
  418. The nested protocol is declared by specifying
  419. &quot;+<var>proto</var>&quot; after the hls URI scheme name, where <var>proto</var>
  420. is either &quot;file&quot; or &quot;http&quot;.
  421. </p>
  422. <div class="example">
  423. <pre class="example">hls+http://host/path/to/remote/resource.m3u8
  424. hls+file://path/to/local/resource.m3u8
  425. </pre></div>
  426. <p>Using this protocol is discouraged - the hls demuxer should work
  427. just as well (if not, please report the issues) and is more complete.
  428. To use the hls demuxer instead, simply use the direct URLs to the
  429. m3u8 files.
  430. </p>
  431. <a name="http"></a>
  432. <h2 class="section"><a href="ffmpeg-protocols.html#toc-http">3.12 http</a></h2>
  433. <p>HTTP (Hyper Text Transfer Protocol).
  434. </p>
  435. <p>This protocol accepts the following options:
  436. </p>
  437. <dl compact="compact">
  438. <dt>&lsquo;<samp>seekable</samp>&rsquo;</dt>
  439. <dd><p>Control seekability of connection. If set to 1 the resource is
  440. supposed to be seekable, if set to 0 it is assumed not to be seekable,
  441. if set to -1 it will try to autodetect if it is seekable. Default
  442. value is -1.
  443. </p>
  444. </dd>
  445. <dt>&lsquo;<samp>chunked_post</samp>&rsquo;</dt>
  446. <dd><p>If set to 1 use chunked Transfer-Encoding for posts, default is 1.
  447. </p>
  448. </dd>
  449. <dt>&lsquo;<samp>content_type</samp>&rsquo;</dt>
  450. <dd><p>Set a specific content type for the POST messages or for listen mode.
  451. </p>
  452. </dd>
  453. <dt>&lsquo;<samp>http_proxy</samp>&rsquo;</dt>
  454. <dd><p>set HTTP proxy to tunnel through e.g. http://example.com:1234
  455. </p>
  456. </dd>
  457. <dt>&lsquo;<samp>headers</samp>&rsquo;</dt>
  458. <dd><p>Set custom HTTP headers, can override built in default headers. The
  459. value must be a string encoding the headers.
  460. </p>
  461. </dd>
  462. <dt>&lsquo;<samp>multiple_requests</samp>&rsquo;</dt>
  463. <dd><p>Use persistent connections if set to 1, default is 0.
  464. </p>
  465. </dd>
  466. <dt>&lsquo;<samp>post_data</samp>&rsquo;</dt>
  467. <dd><p>Set custom HTTP post data.
  468. </p>
  469. </dd>
  470. <dt>&lsquo;<samp>referer</samp>&rsquo;</dt>
  471. <dd><p>Set the Referer header. Include &rsquo;Referer: URL&rsquo; header in HTTP request.
  472. </p>
  473. </dd>
  474. <dt>&lsquo;<samp>user_agent</samp>&rsquo;</dt>
  475. <dd><p>Override the User-Agent header. If not specified the protocol will use a
  476. string describing the libavformat build. (&quot;Lavf/&lt;version&gt;&quot;)
  477. </p>
  478. </dd>
  479. <dt>&lsquo;<samp>user-agent</samp>&rsquo;</dt>
  480. <dd><p>This is a deprecated option, you can use user_agent instead it.
  481. </p>
  482. </dd>
  483. <dt>&lsquo;<samp>timeout</samp>&rsquo;</dt>
  484. <dd><p>Set timeout in microseconds of socket I/O operations used by the underlying low level
  485. operation. By default it is set to -1, which means that the timeout is
  486. not specified.
  487. </p>
  488. </dd>
  489. <dt>&lsquo;<samp>reconnect_at_eof</samp>&rsquo;</dt>
  490. <dd><p>If set then eof is treated like an error and causes reconnection, this is useful
  491. for live / endless streams.
  492. </p>
  493. </dd>
  494. <dt>&lsquo;<samp>reconnect_streamed</samp>&rsquo;</dt>
  495. <dd><p>If set then even streamed/non seekable streams will be reconnected on errors.
  496. </p>
  497. </dd>
  498. <dt>&lsquo;<samp>reconnect_delay_max</samp>&rsquo;</dt>
  499. <dd><p>Sets the maximum delay in seconds after which to give up reconnecting
  500. </p>
  501. </dd>
  502. <dt>&lsquo;<samp>mime_type</samp>&rsquo;</dt>
  503. <dd><p>Export the MIME type.
  504. </p>
  505. </dd>
  506. <dt>&lsquo;<samp>http_version</samp>&rsquo;</dt>
  507. <dd><p>Exports the HTTP response version number. Usually &quot;1.0&quot; or &quot;1.1&quot;.
  508. </p>
  509. </dd>
  510. <dt>&lsquo;<samp>icy</samp>&rsquo;</dt>
  511. <dd><p>If set to 1 request ICY (SHOUTcast) metadata from the server. If the server
  512. supports this, the metadata has to be retrieved by the application by reading
  513. the &lsquo;<samp>icy_metadata_headers</samp>&rsquo; and &lsquo;<samp>icy_metadata_packet</samp>&rsquo; options.
  514. The default is 1.
  515. </p>
  516. </dd>
  517. <dt>&lsquo;<samp>icy_metadata_headers</samp>&rsquo;</dt>
  518. <dd><p>If the server supports ICY metadata, this contains the ICY-specific HTTP reply
  519. headers, separated by newline characters.
  520. </p>
  521. </dd>
  522. <dt>&lsquo;<samp>icy_metadata_packet</samp>&rsquo;</dt>
  523. <dd><p>If the server supports ICY metadata, and &lsquo;<samp>icy</samp>&rsquo; was set to 1, this
  524. contains the last non-empty metadata packet sent by the server. It should be
  525. polled in regular intervals by applications interested in mid-stream metadata
  526. updates.
  527. </p>
  528. </dd>
  529. <dt>&lsquo;<samp>cookies</samp>&rsquo;</dt>
  530. <dd><p>Set the cookies to be sent in future requests. The format of each cookie is the
  531. same as the value of a Set-Cookie HTTP response field. Multiple cookies can be
  532. delimited by a newline character.
  533. </p>
  534. </dd>
  535. <dt>&lsquo;<samp>offset</samp>&rsquo;</dt>
  536. <dd><p>Set initial byte offset.
  537. </p>
  538. </dd>
  539. <dt>&lsquo;<samp>end_offset</samp>&rsquo;</dt>
  540. <dd><p>Try to limit the request to bytes preceding this offset.
  541. </p>
  542. </dd>
  543. <dt>&lsquo;<samp>method</samp>&rsquo;</dt>
  544. <dd><p>When used as a client option it sets the HTTP method for the request.
  545. </p>
  546. <p>When used as a server option it sets the HTTP method that is going to be
  547. expected from the client(s).
  548. If the expected and the received HTTP method do not match the client will
  549. be given a Bad Request response.
  550. When unset the HTTP method is not checked for now. This will be replaced by
  551. autodetection in the future.
  552. </p>
  553. </dd>
  554. <dt>&lsquo;<samp>listen</samp>&rsquo;</dt>
  555. <dd><p>If set to 1 enables experimental HTTP server. This can be used to send data when
  556. used as an output option, or read data from a client with HTTP POST when used as
  557. an input option.
  558. If set to 2 enables experimental multi-client HTTP server. This is not yet implemented
  559. in ffmpeg.c and thus must not be used as a command line option.
  560. </p><div class="example">
  561. <pre class="example"># Server side (sending):
  562. ffmpeg -i somefile.ogg -c copy -listen 1 -f ogg http://<var>server</var>:<var>port</var>
  563. # Client side (receiving):
  564. ffmpeg -i http://<var>server</var>:<var>port</var> -c copy somefile.ogg
  565. # Client can also be done with wget:
  566. wget http://<var>server</var>:<var>port</var> -O somefile.ogg
  567. # Server side (receiving):
  568. ffmpeg -listen 1 -i http://<var>server</var>:<var>port</var> -c copy somefile.ogg
  569. # Client side (sending):
  570. ffmpeg -i somefile.ogg -chunked_post 0 -c copy -f ogg http://<var>server</var>:<var>port</var>
  571. # Client can also be done with wget:
  572. wget --post-file=somefile.ogg http://<var>server</var>:<var>port</var>
  573. </pre></div>
  574. </dd>
  575. <dt>&lsquo;<samp>send_expect_100</samp>&rsquo;</dt>
  576. <dd><p>Send an Expect: 100-continue header for POST. If set to 1 it will send, if set
  577. to 0 it won&rsquo;t, if set to -1 it will try to send if it is applicable. Default
  578. value is -1.
  579. </p>
  580. </dd>
  581. </dl>
  582. <a name="HTTP-Cookies"></a>
  583. <h3 class="subsection"><a href="ffmpeg-protocols.html#toc-HTTP-Cookies">3.12.1 HTTP Cookies</a></h3>
  584. <p>Some HTTP requests will be denied unless cookie values are passed in with the
  585. request. The &lsquo;<samp>cookies</samp>&rsquo; option allows these cookies to be specified. At
  586. the very least, each cookie must specify a value along with a path and domain.
  587. HTTP requests that match both the domain and path will automatically include the
  588. cookie value in the HTTP Cookie header field. Multiple cookies can be delimited
  589. by a newline.
  590. </p>
  591. <p>The required syntax to play a stream specifying a cookie is:
  592. </p><div class="example">
  593. <pre class="example">ffplay -cookies &quot;nlqptid=nltid=tsn; path=/; domain=somedomain.com;&quot; http://somedomain.com/somestream.m3u8
  594. </pre></div>
  595. <a name="Icecast"></a>
  596. <h2 class="section"><a href="ffmpeg-protocols.html#toc-Icecast">3.13 Icecast</a></h2>
  597. <p>Icecast protocol (stream to Icecast servers)
  598. </p>
  599. <p>This protocol accepts the following options:
  600. </p>
  601. <dl compact="compact">
  602. <dt>&lsquo;<samp>ice_genre</samp>&rsquo;</dt>
  603. <dd><p>Set the stream genre.
  604. </p>
  605. </dd>
  606. <dt>&lsquo;<samp>ice_name</samp>&rsquo;</dt>
  607. <dd><p>Set the stream name.
  608. </p>
  609. </dd>
  610. <dt>&lsquo;<samp>ice_description</samp>&rsquo;</dt>
  611. <dd><p>Set the stream description.
  612. </p>
  613. </dd>
  614. <dt>&lsquo;<samp>ice_url</samp>&rsquo;</dt>
  615. <dd><p>Set the stream website URL.
  616. </p>
  617. </dd>
  618. <dt>&lsquo;<samp>ice_public</samp>&rsquo;</dt>
  619. <dd><p>Set if the stream should be public.
  620. The default is 0 (not public).
  621. </p>
  622. </dd>
  623. <dt>&lsquo;<samp>user_agent</samp>&rsquo;</dt>
  624. <dd><p>Override the User-Agent header. If not specified a string of the form
  625. &quot;Lavf/&lt;version&gt;&quot; will be used.
  626. </p>
  627. </dd>
  628. <dt>&lsquo;<samp>password</samp>&rsquo;</dt>
  629. <dd><p>Set the Icecast mountpoint password.
  630. </p>
  631. </dd>
  632. <dt>&lsquo;<samp>content_type</samp>&rsquo;</dt>
  633. <dd><p>Set the stream content type. This must be set if it is different from
  634. audio/mpeg.
  635. </p>
  636. </dd>
  637. <dt>&lsquo;<samp>legacy_icecast</samp>&rsquo;</dt>
  638. <dd><p>This enables support for Icecast versions &lt; 2.4.0, that do not support the
  639. HTTP PUT method but the SOURCE method.
  640. </p>
  641. </dd>
  642. </dl>
  643. <div class="example">
  644. <pre class="example">icecast://[<var>username</var>[:<var>password</var>]@]<var>server</var>:<var>port</var>/<var>mountpoint</var>
  645. </pre></div>
  646. <a name="mmst"></a>
  647. <h2 class="section"><a href="ffmpeg-protocols.html#toc-mmst">3.14 mmst</a></h2>
  648. <p>MMS (Microsoft Media Server) protocol over TCP.
  649. </p>
  650. <a name="mmsh"></a>
  651. <h2 class="section"><a href="ffmpeg-protocols.html#toc-mmsh">3.15 mmsh</a></h2>
  652. <p>MMS (Microsoft Media Server) protocol over HTTP.
  653. </p>
  654. <p>The required syntax is:
  655. </p><div class="example">
  656. <pre class="example">mmsh://<var>server</var>[:<var>port</var>][/<var>app</var>][/<var>playpath</var>]
  657. </pre></div>
  658. <a name="md5"></a>
  659. <h2 class="section"><a href="ffmpeg-protocols.html#toc-md5">3.16 md5</a></h2>
  660. <p>MD5 output protocol.
  661. </p>
  662. <p>Computes the MD5 hash of the data to be written, and on close writes
  663. this to the designated output or stdout if none is specified. It can
  664. be used to test muxers without writing an actual file.
  665. </p>
  666. <p>Some examples follow.
  667. </p><div class="example">
  668. <pre class="example"># Write the MD5 hash of the encoded AVI file to the file output.avi.md5.
  669. ffmpeg -i input.flv -f avi -y md5:output.avi.md5
  670. # Write the MD5 hash of the encoded AVI file to stdout.
  671. ffmpeg -i input.flv -f avi -y md5:
  672. </pre></div>
  673. <p>Note that some formats (typically MOV) require the output protocol to
  674. be seekable, so they will fail with the MD5 output protocol.
  675. </p>
  676. <a name="pipe"></a>
  677. <h2 class="section"><a href="ffmpeg-protocols.html#toc-pipe">3.17 pipe</a></h2>
  678. <p>UNIX pipe access protocol.
  679. </p>
  680. <p>Read and write from UNIX pipes.
  681. </p>
  682. <p>The accepted syntax is:
  683. </p><div class="example">
  684. <pre class="example">pipe:[<var>number</var>]
  685. </pre></div>
  686. <p><var>number</var> is the number corresponding to the file descriptor of the
  687. pipe (e.g. 0 for stdin, 1 for stdout, 2 for stderr). If <var>number</var>
  688. is not specified, by default the stdout file descriptor will be used
  689. for writing, stdin for reading.
  690. </p>
  691. <p>For example to read from stdin with <code>ffmpeg</code>:
  692. </p><div class="example">
  693. <pre class="example">cat test.wav | ffmpeg -i pipe:0
  694. # ...this is the same as...
  695. cat test.wav | ffmpeg -i pipe:
  696. </pre></div>
  697. <p>For writing to stdout with <code>ffmpeg</code>:
  698. </p><div class="example">
  699. <pre class="example">ffmpeg -i test.wav -f avi pipe:1 | cat &gt; test.avi
  700. # ...this is the same as...
  701. ffmpeg -i test.wav -f avi pipe: | cat &gt; test.avi
  702. </pre></div>
  703. <p>This protocol accepts the following options:
  704. </p>
  705. <dl compact="compact">
  706. <dt>&lsquo;<samp>blocksize</samp>&rsquo;</dt>
  707. <dd><p>Set I/O operation maximum block size, in bytes. Default value is
  708. <code>INT_MAX</code>, which results in not limiting the requested block size.
  709. Setting this value reasonably low improves user termination request reaction
  710. time, which is valuable if data transmission is slow.
  711. </p></dd>
  712. </dl>
  713. <p>Note that some formats (typically MOV), require the output protocol to
  714. be seekable, so they will fail with the pipe output protocol.
  715. </p>
  716. <a name="prompeg"></a>
  717. <h2 class="section"><a href="ffmpeg-protocols.html#toc-prompeg">3.18 prompeg</a></h2>
  718. <p>Pro-MPEG Code of Practice #3 Release 2 FEC protocol.
  719. </p>
  720. <p>The Pro-MPEG CoP#3 FEC is a 2D parity-check forward error correction mechanism
  721. for MPEG-2 Transport Streams sent over RTP.
  722. </p>
  723. <p>This protocol must be used in conjunction with the <code>rtp_mpegts</code> muxer and
  724. the <code>rtp</code> protocol.
  725. </p>
  726. <p>The required syntax is:
  727. </p><div class="example">
  728. <pre class="example">-f rtp_mpegts -fec prompeg=<var>option</var>=<var>val</var>... rtp://<var>hostname</var>:<var>port</var>
  729. </pre></div>
  730. <p>The destination UDP ports are <code>port + 2</code> for the column FEC stream
  731. and <code>port + 4</code> for the row FEC stream.
  732. </p>
  733. <p>This protocol accepts the following options:
  734. </p><dl compact="compact">
  735. <dt>&lsquo;<samp>l=<var>n</var></samp>&rsquo;</dt>
  736. <dd><p>The number of columns (4-20, LxD &lt;= 100)
  737. </p>
  738. </dd>
  739. <dt>&lsquo;<samp>d=<var>n</var></samp>&rsquo;</dt>
  740. <dd><p>The number of rows (4-20, LxD &lt;= 100)
  741. </p>
  742. </dd>
  743. </dl>
  744. <p>Example usage:
  745. </p>
  746. <div class="example">
  747. <pre class="example">-f rtp_mpegts -fec prompeg=l=8:d=4 rtp://<var>hostname</var>:<var>port</var>
  748. </pre></div>
  749. <a name="rtmp"></a>
  750. <h2 class="section"><a href="ffmpeg-protocols.html#toc-rtmp">3.19 rtmp</a></h2>
  751. <p>Real-Time Messaging Protocol.
  752. </p>
  753. <p>The Real-Time Messaging Protocol (RTMP) is used for streaming multimedia
  754. content across a TCP/IP network.
  755. </p>
  756. <p>The required syntax is:
  757. </p><div class="example">
  758. <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>]
  759. </pre></div>
  760. <p>The accepted parameters are:
  761. </p><dl compact="compact">
  762. <dt>&lsquo;<samp>username</samp>&rsquo;</dt>
  763. <dd><p>An optional username (mostly for publishing).
  764. </p>
  765. </dd>
  766. <dt>&lsquo;<samp>password</samp>&rsquo;</dt>
  767. <dd><p>An optional password (mostly for publishing).
  768. </p>
  769. </dd>
  770. <dt>&lsquo;<samp>server</samp>&rsquo;</dt>
  771. <dd><p>The address of the RTMP server.
  772. </p>
  773. </dd>
  774. <dt>&lsquo;<samp>port</samp>&rsquo;</dt>
  775. <dd><p>The number of the TCP port to use (by default is 1935).
  776. </p>
  777. </dd>
  778. <dt>&lsquo;<samp>app</samp>&rsquo;</dt>
  779. <dd><p>It is the name of the application to access. It usually corresponds to
  780. the path where the application is installed on the RTMP server
  781. (e.g. &lsquo;<tt>/ondemand/</tt>&rsquo;, &lsquo;<tt>/flash/live/</tt>&rsquo;, etc.). You can override
  782. the value parsed from the URI through the <code>rtmp_app</code> option, too.
  783. </p>
  784. </dd>
  785. <dt>&lsquo;<samp>playpath</samp>&rsquo;</dt>
  786. <dd><p>It is the path or name of the resource to play with reference to the
  787. application specified in <var>app</var>, may be prefixed by &quot;mp4:&quot;. You
  788. can override the value parsed from the URI through the <code>rtmp_playpath</code>
  789. option, too.
  790. </p>
  791. </dd>
  792. <dt>&lsquo;<samp>listen</samp>&rsquo;</dt>
  793. <dd><p>Act as a server, listening for an incoming connection.
  794. </p>
  795. </dd>
  796. <dt>&lsquo;<samp>timeout</samp>&rsquo;</dt>
  797. <dd><p>Maximum time to wait for the incoming connection. Implies listen.
  798. </p></dd>
  799. </dl>
  800. <p>Additionally, the following parameters can be set via command line options
  801. (or in code via <code>AVOption</code>s):
  802. </p><dl compact="compact">
  803. <dt>&lsquo;<samp>rtmp_app</samp>&rsquo;</dt>
  804. <dd><p>Name of application to connect on the RTMP server. This option
  805. overrides the parameter specified in the URI.
  806. </p>
  807. </dd>
  808. <dt>&lsquo;<samp>rtmp_buffer</samp>&rsquo;</dt>
  809. <dd><p>Set the client buffer time in milliseconds. The default is 3000.
  810. </p>
  811. </dd>
  812. <dt>&lsquo;<samp>rtmp_conn</samp>&rsquo;</dt>
  813. <dd><p>Extra arbitrary AMF connection parameters, parsed from a string,
  814. e.g. like <code>B:1 S:authMe O:1 NN:code:1.23 NS:flag:ok O:0</code>.
  815. Each value is prefixed by a single character denoting the type,
  816. B for Boolean, N for number, S for string, O for object, or Z for null,
  817. followed by a colon. For Booleans the data must be either 0 or 1 for
  818. FALSE or TRUE, respectively. Likewise for Objects the data must be 0 or
  819. 1 to end or begin an object, respectively. Data items in subobjects may
  820. be named, by prefixing the type with &rsquo;N&rsquo; and specifying the name before
  821. the value (i.e. <code>NB:myFlag:1</code>). This option may be used multiple
  822. times to construct arbitrary AMF sequences.
  823. </p>
  824. </dd>
  825. <dt>&lsquo;<samp>rtmp_flashver</samp>&rsquo;</dt>
  826. <dd><p>Version of the Flash plugin used to run the SWF player. The default
  827. is LNX 9,0,124,2. (When publishing, the default is FMLE/3.0 (compatible;
  828. &lt;libavformat version&gt;).)
  829. </p>
  830. </dd>
  831. <dt>&lsquo;<samp>rtmp_flush_interval</samp>&rsquo;</dt>
  832. <dd><p>Number of packets flushed in the same request (RTMPT only). The default
  833. is 10.
  834. </p>
  835. </dd>
  836. <dt>&lsquo;<samp>rtmp_live</samp>&rsquo;</dt>
  837. <dd><p>Specify that the media is a live stream. No resuming or seeking in
  838. live streams is possible. The default value is <code>any</code>, which means the
  839. subscriber first tries to play the live stream specified in the
  840. playpath. If a live stream of that name is not found, it plays the
  841. recorded stream. The other possible values are <code>live</code> and
  842. <code>recorded</code>.
  843. </p>
  844. </dd>
  845. <dt>&lsquo;<samp>rtmp_pageurl</samp>&rsquo;</dt>
  846. <dd><p>URL of the web page in which the media was embedded. By default no
  847. value will be sent.
  848. </p>
  849. </dd>
  850. <dt>&lsquo;<samp>rtmp_playpath</samp>&rsquo;</dt>
  851. <dd><p>Stream identifier to play or to publish. This option overrides the
  852. parameter specified in the URI.
  853. </p>
  854. </dd>
  855. <dt>&lsquo;<samp>rtmp_subscribe</samp>&rsquo;</dt>
  856. <dd><p>Name of live stream to subscribe to. By default no value will be sent.
  857. It is only sent if the option is specified or if rtmp_live
  858. is set to live.
  859. </p>
  860. </dd>
  861. <dt>&lsquo;<samp>rtmp_swfhash</samp>&rsquo;</dt>
  862. <dd><p>SHA256 hash of the decompressed SWF file (32 bytes).
  863. </p>
  864. </dd>
  865. <dt>&lsquo;<samp>rtmp_swfsize</samp>&rsquo;</dt>
  866. <dd><p>Size of the decompressed SWF file, required for SWFVerification.
  867. </p>
  868. </dd>
  869. <dt>&lsquo;<samp>rtmp_swfurl</samp>&rsquo;</dt>
  870. <dd><p>URL of the SWF player for the media. By default no value will be sent.
  871. </p>
  872. </dd>
  873. <dt>&lsquo;<samp>rtmp_swfverify</samp>&rsquo;</dt>
  874. <dd><p>URL to player swf file, compute hash/size automatically.
  875. </p>
  876. </dd>
  877. <dt>&lsquo;<samp>rtmp_tcurl</samp>&rsquo;</dt>
  878. <dd><p>URL of the target stream. Defaults to proto://host[:port]/app.
  879. </p>
  880. </dd>
  881. </dl>
  882. <p>For example to read with <code>ffplay</code> a multimedia resource named
  883. &quot;sample&quot; from the application &quot;vod&quot; from an RTMP server &quot;myserver&quot;:
  884. </p><div class="example">
  885. <pre class="example">ffplay rtmp://myserver/vod/sample
  886. </pre></div>
  887. <p>To publish to a password protected server, passing the playpath and
  888. app names separately:
  889. </p><div class="example">
  890. <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/
  891. </pre></div>
  892. <a name="rtmpe"></a>
  893. <h2 class="section"><a href="ffmpeg-protocols.html#toc-rtmpe">3.20 rtmpe</a></h2>
  894. <p>Encrypted Real-Time Messaging Protocol.
  895. </p>
  896. <p>The Encrypted Real-Time Messaging Protocol (RTMPE) is used for
  897. streaming multimedia content within standard cryptographic primitives,
  898. consisting of Diffie-Hellman key exchange and HMACSHA256, generating
  899. a pair of RC4 keys.
  900. </p>
  901. <a name="rtmps"></a>
  902. <h2 class="section"><a href="ffmpeg-protocols.html#toc-rtmps">3.21 rtmps</a></h2>
  903. <p>Real-Time Messaging Protocol over a secure SSL connection.
  904. </p>
  905. <p>The Real-Time Messaging Protocol (RTMPS) is used for streaming
  906. multimedia content across an encrypted connection.
  907. </p>
  908. <a name="rtmpt"></a>
  909. <h2 class="section"><a href="ffmpeg-protocols.html#toc-rtmpt">3.22 rtmpt</a></h2>
  910. <p>Real-Time Messaging Protocol tunneled through HTTP.
  911. </p>
  912. <p>The Real-Time Messaging Protocol tunneled through HTTP (RTMPT) is used
  913. for streaming multimedia content within HTTP requests to traverse
  914. firewalls.
  915. </p>
  916. <a name="rtmpte"></a>
  917. <h2 class="section"><a href="ffmpeg-protocols.html#toc-rtmpte">3.23 rtmpte</a></h2>
  918. <p>Encrypted Real-Time Messaging Protocol tunneled through HTTP.
  919. </p>
  920. <p>The Encrypted Real-Time Messaging Protocol tunneled through HTTP (RTMPTE)
  921. is used for streaming multimedia content within HTTP requests to traverse
  922. firewalls.
  923. </p>
  924. <a name="rtmpts"></a>
  925. <h2 class="section"><a href="ffmpeg-protocols.html#toc-rtmpts">3.24 rtmpts</a></h2>
  926. <p>Real-Time Messaging Protocol tunneled through HTTPS.
  927. </p>
  928. <p>The Real-Time Messaging Protocol tunneled through HTTPS (RTMPTS) is used
  929. for streaming multimedia content within HTTPS requests to traverse
  930. firewalls.
  931. </p>
  932. <a name="libsmbclient"></a>
  933. <h2 class="section"><a href="ffmpeg-protocols.html#toc-libsmbclient">3.25 libsmbclient</a></h2>
  934. <p>libsmbclient permits one to manipulate CIFS/SMB network resources.
  935. </p>
  936. <p>Following syntax is required.
  937. </p>
  938. <div class="example">
  939. <pre class="example">smb://[[domain:]user[:password@]]server[/share[/path[/file]]]
  940. </pre></div>
  941. <p>This protocol accepts the following options.
  942. </p>
  943. <dl compact="compact">
  944. <dt>&lsquo;<samp>timeout</samp>&rsquo;</dt>
  945. <dd><p>Set timeout in milliseconds of socket I/O operations used by the underlying
  946. low level operation. By default it is set to -1, which means that the timeout
  947. is not specified.
  948. </p>
  949. </dd>
  950. <dt>&lsquo;<samp>truncate</samp>&rsquo;</dt>
  951. <dd><p>Truncate existing files on write, if set to 1. A value of 0 prevents
  952. truncating. Default value is 1.
  953. </p>
  954. </dd>
  955. <dt>&lsquo;<samp>workgroup</samp>&rsquo;</dt>
  956. <dd><p>Set the workgroup used for making connections. By default workgroup is not specified.
  957. </p>
  958. </dd>
  959. </dl>
  960. <p>For more information see: <a href="http://www.samba.org/">http://www.samba.org/</a>.
  961. </p>
  962. <a name="libssh"></a>
  963. <h2 class="section"><a href="ffmpeg-protocols.html#toc-libssh">3.26 libssh</a></h2>
  964. <p>Secure File Transfer Protocol via libssh
  965. </p>
  966. <p>Read from or write to remote resources using SFTP protocol.
  967. </p>
  968. <p>Following syntax is required.
  969. </p>
  970. <div class="example">
  971. <pre class="example">sftp://[user[:password]@]server[:port]/path/to/remote/resource.mpeg
  972. </pre></div>
  973. <p>This protocol accepts the following options.
  974. </p>
  975. <dl compact="compact">
  976. <dt>&lsquo;<samp>timeout</samp>&rsquo;</dt>
  977. <dd><p>Set timeout of socket I/O operations used by the underlying low level
  978. operation. By default it is set to -1, which means that the timeout
  979. is not specified.
  980. </p>
  981. </dd>
  982. <dt>&lsquo;<samp>truncate</samp>&rsquo;</dt>
  983. <dd><p>Truncate existing files on write, if set to 1. A value of 0 prevents
  984. truncating. Default value is 1.
  985. </p>
  986. </dd>
  987. <dt>&lsquo;<samp>private_key</samp>&rsquo;</dt>
  988. <dd><p>Specify the path of the file containing private key to use during authorization.
  989. By default libssh searches for keys in the &lsquo;<tt>~/.ssh/</tt>&rsquo; directory.
  990. </p>
  991. </dd>
  992. </dl>
  993. <p>Example: Play a file stored on remote server.
  994. </p>
  995. <div class="example">
  996. <pre class="example">ffplay sftp://user:password@server_address:22/home/user/resource.mpeg
  997. </pre></div>
  998. <a name="librtmp-rtmp_002c-rtmpe_002c-rtmps_002c-rtmpt_002c-rtmpte"></a>
  999. <h2 class="section"><a href="ffmpeg-protocols.html#toc-librtmp-rtmp_002c-rtmpe_002c-rtmps_002c-rtmpt_002c-rtmpte">3.27 librtmp rtmp, rtmpe, rtmps, rtmpt, rtmpte</a></h2>
  1000. <p>Real-Time Messaging Protocol and its variants supported through
  1001. librtmp.
  1002. </p>
  1003. <p>Requires the presence of the librtmp headers and library during
  1004. configuration. You need to explicitly configure the build with
  1005. &quot;&ndash;enable-librtmp&quot;. If enabled this will replace the native RTMP
  1006. protocol.
  1007. </p>
  1008. <p>This protocol provides most client functions and a few server
  1009. functions needed to support RTMP, RTMP tunneled in HTTP (RTMPT),
  1010. encrypted RTMP (RTMPE), RTMP over SSL/TLS (RTMPS) and tunneled
  1011. variants of these encrypted types (RTMPTE, RTMPTS).
  1012. </p>
  1013. <p>The required syntax is:
  1014. </p><div class="example">
  1015. <pre class="example"><var>rtmp_proto</var>://<var>server</var>[:<var>port</var>][/<var>app</var>][/<var>playpath</var>] <var>options</var>
  1016. </pre></div>
  1017. <p>where <var>rtmp_proto</var> is one of the strings &quot;rtmp&quot;, &quot;rtmpt&quot;, &quot;rtmpe&quot;,
  1018. &quot;rtmps&quot;, &quot;rtmpte&quot;, &quot;rtmpts&quot; corresponding to each RTMP variant, and
  1019. <var>server</var>, <var>port</var>, <var>app</var> and <var>playpath</var> have the same
  1020. meaning as specified for the RTMP native protocol.
  1021. <var>options</var> contains a list of space-separated options of the form
  1022. <var>key</var>=<var>val</var>.
  1023. </p>
  1024. <p>See the librtmp manual page (man 3 librtmp) for more information.
  1025. </p>
  1026. <p>For example, to stream a file in real-time to an RTMP server using
  1027. <code>ffmpeg</code>:
  1028. </p><div class="example">
  1029. <pre class="example">ffmpeg -re -i myfile -f flv rtmp://myserver/live/mystream
  1030. </pre></div>
  1031. <p>To play the same stream using <code>ffplay</code>:
  1032. </p><div class="example">
  1033. <pre class="example">ffplay &quot;rtmp://myserver/live/mystream live=1&quot;
  1034. </pre></div>
  1035. <a name="rtp"></a>
  1036. <h2 class="section"><a href="ffmpeg-protocols.html#toc-rtp">3.28 rtp</a></h2>
  1037. <p>Real-time Transport Protocol.
  1038. </p>
  1039. <p>The required syntax for an RTP URL is:
  1040. rtp://<var>hostname</var>[:<var>port</var>][?<var>option</var>=<var>val</var>...]
  1041. </p>
  1042. <p><var>port</var> specifies the RTP port to use.
  1043. </p>
  1044. <p>The following URL options are supported:
  1045. </p>
  1046. <dl compact="compact">
  1047. <dt>&lsquo;<samp>ttl=<var>n</var></samp>&rsquo;</dt>
  1048. <dd><p>Set the TTL (Time-To-Live) value (for multicast only).
  1049. </p>
  1050. </dd>
  1051. <dt>&lsquo;<samp>rtcpport=<var>n</var></samp>&rsquo;</dt>
  1052. <dd><p>Set the remote RTCP port to <var>n</var>.
  1053. </p>
  1054. </dd>
  1055. <dt>&lsquo;<samp>localrtpport=<var>n</var></samp>&rsquo;</dt>
  1056. <dd><p>Set the local RTP port to <var>n</var>.
  1057. </p>
  1058. </dd>
  1059. <dt>&lsquo;<samp>localrtcpport=<var>n</var>'</samp>&rsquo;</dt>
  1060. <dd><p>Set the local RTCP port to <var>n</var>.
  1061. </p>
  1062. </dd>
  1063. <dt>&lsquo;<samp>pkt_size=<var>n</var></samp>&rsquo;</dt>
  1064. <dd><p>Set max packet size (in bytes) to <var>n</var>.
  1065. </p>
  1066. </dd>
  1067. <dt>&lsquo;<samp>connect=0|1</samp>&rsquo;</dt>
  1068. <dd><p>Do a <code>connect()</code> on the UDP socket (if set to 1) or not (if set
  1069. to 0).
  1070. </p>
  1071. </dd>
  1072. <dt>&lsquo;<samp>sources=<var>ip</var>[,<var>ip</var>]</samp>&rsquo;</dt>
  1073. <dd><p>List allowed source IP addresses.
  1074. </p>
  1075. </dd>
  1076. <dt>&lsquo;<samp>block=<var>ip</var>[,<var>ip</var>]</samp>&rsquo;</dt>
  1077. <dd><p>List disallowed (blocked) source IP addresses.
  1078. </p>
  1079. </dd>
  1080. <dt>&lsquo;<samp>write_to_source=0|1</samp>&rsquo;</dt>
  1081. <dd><p>Send packets to the source address of the latest received packet (if
  1082. set to 1) or to a default remote address (if set to 0).
  1083. </p>
  1084. </dd>
  1085. <dt>&lsquo;<samp>localport=<var>n</var></samp>&rsquo;</dt>
  1086. <dd><p>Set the local RTP port to <var>n</var>.
  1087. </p>
  1088. <p>This is a deprecated option. Instead, &lsquo;<samp>localrtpport</samp>&rsquo; should be
  1089. used.
  1090. </p>
  1091. </dd>
  1092. </dl>
  1093. <p>Important notes:
  1094. </p>
  1095. <ol>
  1096. <li>
  1097. If &lsquo;<samp>rtcpport</samp>&rsquo; is not set the RTCP port will be set to the RTP
  1098. port value plus 1.
  1099. </li><li>
  1100. If &lsquo;<samp>localrtpport</samp>&rsquo; (the local RTP port) is not set any available
  1101. port will be used for the local RTP and RTCP ports.
  1102. </li><li>
  1103. If &lsquo;<samp>localrtcpport</samp>&rsquo; (the local RTCP port) is not set it will be
  1104. set to the local RTP port value plus 1.
  1105. </li></ol>
  1106. <a name="rtsp"></a>
  1107. <h2 class="section"><a href="ffmpeg-protocols.html#toc-rtsp">3.29 rtsp</a></h2>
  1108. <p>Real-Time Streaming Protocol.
  1109. </p>
  1110. <p>RTSP is not technically a protocol handler in libavformat, it is a demuxer
  1111. and muxer. The demuxer supports both normal RTSP (with data transferred
  1112. over RTP; this is used by e.g. Apple and Microsoft) and Real-RTSP (with
  1113. data transferred over RDT).
  1114. </p>
  1115. <p>The muxer can be used to send a stream using RTSP ANNOUNCE to a server
  1116. supporting it (currently Darwin Streaming Server and Mischa Spiegelmock&rsquo;s
  1117. <a href="https://github.com/revmischa/rtsp-server">RTSP server</a>).
  1118. </p>
  1119. <p>The required syntax for a RTSP url is:
  1120. </p><div class="example">
  1121. <pre class="example">rtsp://<var>hostname</var>[:<var>port</var>]/<var>path</var>
  1122. </pre></div>
  1123. <p>Options can be set on the <code>ffmpeg</code>/<code>ffplay</code> command
  1124. line, or set in code via <code>AVOption</code>s or in
  1125. <code>avformat_open_input</code>.
  1126. </p>
  1127. <p>The following options are supported.
  1128. </p>
  1129. <dl compact="compact">
  1130. <dt>&lsquo;<samp>initial_pause</samp>&rsquo;</dt>
  1131. <dd><p>Do not start playing the stream immediately if set to 1. Default value
  1132. is 0.
  1133. </p>
  1134. </dd>
  1135. <dt>&lsquo;<samp>rtsp_transport</samp>&rsquo;</dt>
  1136. <dd><p>Set RTSP transport protocols.
  1137. </p>
  1138. <p>It accepts the following values:
  1139. </p><dl compact="compact">
  1140. <dt>&lsquo;<samp>udp</samp>&rsquo;</dt>
  1141. <dd><p>Use UDP as lower transport protocol.
  1142. </p>
  1143. </dd>
  1144. <dt>&lsquo;<samp>tcp</samp>&rsquo;</dt>
  1145. <dd><p>Use TCP (interleaving within the RTSP control channel) as lower
  1146. transport protocol.
  1147. </p>
  1148. </dd>
  1149. <dt>&lsquo;<samp>udp_multicast</samp>&rsquo;</dt>
  1150. <dd><p>Use UDP multicast as lower transport protocol.
  1151. </p>
  1152. </dd>
  1153. <dt>&lsquo;<samp>http</samp>&rsquo;</dt>
  1154. <dd><p>Use HTTP tunneling as lower transport protocol, which is useful for
  1155. passing proxies.
  1156. </p></dd>
  1157. </dl>
  1158. <p>Multiple lower transport protocols may be specified, in that case they are
  1159. tried one at a time (if the setup of one fails, the next one is tried).
  1160. For the muxer, only the &lsquo;<samp>tcp</samp>&rsquo; and &lsquo;<samp>udp</samp>&rsquo; options are supported.
  1161. </p>
  1162. </dd>
  1163. <dt>&lsquo;<samp>rtsp_flags</samp>&rsquo;</dt>
  1164. <dd><p>Set RTSP flags.
  1165. </p>
  1166. <p>The following values are accepted:
  1167. </p><dl compact="compact">
  1168. <dt>&lsquo;<samp>filter_src</samp>&rsquo;</dt>
  1169. <dd><p>Accept packets only from negotiated peer address and port.
  1170. </p></dd>
  1171. <dt>&lsquo;<samp>listen</samp>&rsquo;</dt>
  1172. <dd><p>Act as a server, listening for an incoming connection.
  1173. </p></dd>
  1174. <dt>&lsquo;<samp>prefer_tcp</samp>&rsquo;</dt>
  1175. <dd><p>Try TCP for RTP transport first, if TCP is available as RTSP RTP transport.
  1176. </p></dd>
  1177. </dl>
  1178. <p>Default value is &lsquo;<samp>none</samp>&rsquo;.
  1179. </p>
  1180. </dd>
  1181. <dt>&lsquo;<samp>allowed_media_types</samp>&rsquo;</dt>
  1182. <dd><p>Set media types to accept from the server.
  1183. </p>
  1184. <p>The following flags are accepted:
  1185. </p><dl compact="compact">
  1186. <dt>&lsquo;<samp>video</samp>&rsquo;</dt>
  1187. <dt>&lsquo;<samp>audio</samp>&rsquo;</dt>
  1188. <dt>&lsquo;<samp>data</samp>&rsquo;</dt>
  1189. </dl>
  1190. <p>By default it accepts all media types.
  1191. </p>
  1192. </dd>
  1193. <dt>&lsquo;<samp>min_port</samp>&rsquo;</dt>
  1194. <dd><p>Set minimum local UDP port. Default value is 5000.
  1195. </p>
  1196. </dd>
  1197. <dt>&lsquo;<samp>max_port</samp>&rsquo;</dt>
  1198. <dd><p>Set maximum local UDP port. Default value is 65000.
  1199. </p>
  1200. </dd>
  1201. <dt>&lsquo;<samp>timeout</samp>&rsquo;</dt>
  1202. <dd><p>Set maximum timeout (in seconds) to wait for incoming connections.
  1203. </p>
  1204. <p>A value of -1 means infinite (default). This option implies the
  1205. &lsquo;<samp>rtsp_flags</samp>&rsquo; set to &lsquo;<samp>listen</samp>&rsquo;.
  1206. </p>
  1207. </dd>
  1208. <dt>&lsquo;<samp>reorder_queue_size</samp>&rsquo;</dt>
  1209. <dd><p>Set number of packets to buffer for handling of reordered packets.
  1210. </p>
  1211. </dd>
  1212. <dt>&lsquo;<samp>stimeout</samp>&rsquo;</dt>
  1213. <dd><p>Set socket TCP I/O timeout in microseconds.
  1214. </p>
  1215. </dd>
  1216. <dt>&lsquo;<samp>user-agent</samp>&rsquo;</dt>
  1217. <dd><p>Override User-Agent header. If not specified, it defaults to the
  1218. libavformat identifier string.
  1219. </p></dd>
  1220. </dl>
  1221. <p>When receiving data over UDP, the demuxer tries to reorder received packets
  1222. (since they may arrive out of order, or packets may get lost totally). This
  1223. can be disabled by setting the maximum demuxing delay to zero (via
  1224. the <code>max_delay</code> field of AVFormatContext).
  1225. </p>
  1226. <p>When watching multi-bitrate Real-RTSP streams with <code>ffplay</code>, the
  1227. streams to display can be chosen with <code>-vst</code> <var>n</var> and
  1228. <code>-ast</code> <var>n</var> for video and audio respectively, and can be switched
  1229. on the fly by pressing <code>v</code> and <code>a</code>.
  1230. </p>
  1231. <a name="Examples"></a>
  1232. <h3 class="subsection"><a href="ffmpeg-protocols.html#toc-Examples">3.29.1 Examples</a></h3>
  1233. <p>The following examples all make use of the <code>ffplay</code> and
  1234. <code>ffmpeg</code> tools.
  1235. </p>
  1236. <ul>
  1237. <li>
  1238. Watch a stream over UDP, with a max reordering delay of 0.5 seconds:
  1239. <div class="example">
  1240. <pre class="example">ffplay -max_delay 500000 -rtsp_transport udp rtsp://server/video.mp4
  1241. </pre></div>
  1242. </li><li>
  1243. Watch a stream tunneled over HTTP:
  1244. <div class="example">
  1245. <pre class="example">ffplay -rtsp_transport http rtsp://server/video.mp4
  1246. </pre></div>
  1247. </li><li>
  1248. Send a stream in realtime to a RTSP server, for others to watch:
  1249. <div class="example">
  1250. <pre class="example">ffmpeg -re -i <var>input</var> -f rtsp -muxdelay 0.1 rtsp://server/live.sdp
  1251. </pre></div>
  1252. </li><li>
  1253. Receive a stream in realtime:
  1254. <div class="example">
  1255. <pre class="example">ffmpeg -rtsp_flags listen -i rtsp://ownaddress/live.sdp <var>output</var>
  1256. </pre></div>
  1257. </li></ul>
  1258. <a name="sap"></a>
  1259. <h2 class="section"><a href="ffmpeg-protocols.html#toc-sap">3.30 sap</a></h2>
  1260. <p>Session Announcement Protocol (RFC 2974). This is not technically a
  1261. protocol handler in libavformat, it is a muxer and demuxer.
  1262. It is used for signalling of RTP streams, by announcing the SDP for the
  1263. streams regularly on a separate port.
  1264. </p>
  1265. <a name="Muxer"></a>
  1266. <h3 class="subsection"><a href="ffmpeg-protocols.html#toc-Muxer">3.30.1 Muxer</a></h3>
  1267. <p>The syntax for a SAP url given to the muxer is:
  1268. </p><div class="example">
  1269. <pre class="example">sap://<var>destination</var>[:<var>port</var>][?<var>options</var>]
  1270. </pre></div>
  1271. <p>The RTP packets are sent to <var>destination</var> on port <var>port</var>,
  1272. or to port 5004 if no port is specified.
  1273. <var>options</var> is a <code>&amp;</code>-separated list. The following options
  1274. are supported:
  1275. </p>
  1276. <dl compact="compact">
  1277. <dt>&lsquo;<samp>announce_addr=<var>address</var></samp>&rsquo;</dt>
  1278. <dd><p>Specify the destination IP address for sending the announcements to.
  1279. If omitted, the announcements are sent to the commonly used SAP
  1280. announcement multicast address 224.2.127.254 (sap.mcast.net), or
  1281. ff0e::2:7ffe if <var>destination</var> is an IPv6 address.
  1282. </p>
  1283. </dd>
  1284. <dt>&lsquo;<samp>announce_port=<var>port</var></samp>&rsquo;</dt>
  1285. <dd><p>Specify the port to send the announcements on, defaults to
  1286. 9875 if not specified.
  1287. </p>
  1288. </dd>
  1289. <dt>&lsquo;<samp>ttl=<var>ttl</var></samp>&rsquo;</dt>
  1290. <dd><p>Specify the time to live value for the announcements and RTP packets,
  1291. defaults to 255.
  1292. </p>
  1293. </dd>
  1294. <dt>&lsquo;<samp>same_port=<var>0|1</var></samp>&rsquo;</dt>
  1295. <dd><p>If set to 1, send all RTP streams on the same port pair. If zero (the
  1296. default), all streams are sent on unique ports, with each stream on a
  1297. port 2 numbers higher than the previous.
  1298. VLC/Live555 requires this to be set to 1, to be able to receive the stream.
  1299. The RTP stack in libavformat for receiving requires all streams to be sent
  1300. on unique ports.
  1301. </p></dd>
  1302. </dl>
  1303. <p>Example command lines follow.
  1304. </p>
  1305. <p>To broadcast a stream on the local subnet, for watching in VLC:
  1306. </p>
  1307. <div class="example">
  1308. <pre class="example">ffmpeg -re -i <var>input</var> -f sap sap://224.0.0.255?same_port=1
  1309. </pre></div>
  1310. <p>Similarly, for watching in <code>ffplay</code>:
  1311. </p>
  1312. <div class="example">
  1313. <pre class="example">ffmpeg -re -i <var>input</var> -f sap sap://224.0.0.255
  1314. </pre></div>
  1315. <p>And for watching in <code>ffplay</code>, over IPv6:
  1316. </p>
  1317. <div class="example">
  1318. <pre class="example">ffmpeg -re -i <var>input</var> -f sap sap://[ff0e::1:2:3:4]
  1319. </pre></div>
  1320. <a name="Demuxer"></a>
  1321. <h3 class="subsection"><a href="ffmpeg-protocols.html#toc-Demuxer">3.30.2 Demuxer</a></h3>
  1322. <p>The syntax for a SAP url given to the demuxer is:
  1323. </p><div class="example">
  1324. <pre class="example">sap://[<var>address</var>][:<var>port</var>]
  1325. </pre></div>
  1326. <p><var>address</var> is the multicast address to listen for announcements on,
  1327. if omitted, the default 224.2.127.254 (sap.mcast.net) is used. <var>port</var>
  1328. is the port that is listened on, 9875 if omitted.
  1329. </p>
  1330. <p>The demuxers listens for announcements on the given address and port.
  1331. Once an announcement is received, it tries to receive that particular stream.
  1332. </p>
  1333. <p>Example command lines follow.
  1334. </p>
  1335. <p>To play back the first stream announced on the normal SAP multicast address:
  1336. </p>
  1337. <div class="example">
  1338. <pre class="example">ffplay sap://
  1339. </pre></div>
  1340. <p>To play back the first stream announced on one the default IPv6 SAP multicast address:
  1341. </p>
  1342. <div class="example">
  1343. <pre class="example">ffplay sap://[ff0e::2:7ffe]
  1344. </pre></div>
  1345. <a name="sctp"></a>
  1346. <h2 class="section"><a href="ffmpeg-protocols.html#toc-sctp">3.31 sctp</a></h2>
  1347. <p>Stream Control Transmission Protocol.
  1348. </p>
  1349. <p>The accepted URL syntax is:
  1350. </p><div class="example">
  1351. <pre class="example">sctp://<var>host</var>:<var>port</var>[?<var>options</var>]
  1352. </pre></div>
  1353. <p>The protocol accepts the following options:
  1354. </p><dl compact="compact">
  1355. <dt>&lsquo;<samp>listen</samp>&rsquo;</dt>
  1356. <dd><p>If set to any value, listen for an incoming connection. Outgoing connection is done by default.
  1357. </p>
  1358. </dd>
  1359. <dt>&lsquo;<samp>max_streams</samp>&rsquo;</dt>
  1360. <dd><p>Set the maximum number of streams. By default no limit is set.
  1361. </p></dd>
  1362. </dl>
  1363. <a name="srt"></a>
  1364. <h2 class="section"><a href="ffmpeg-protocols.html#toc-srt">3.32 srt</a></h2>
  1365. <p>Haivision Secure Reliable Transport Protocol via libsrt.
  1366. </p>
  1367. <p>The supported syntax for a SRT URL is:
  1368. </p><div class="example">
  1369. <pre class="example">srt://<var>hostname</var>:<var>port</var>[?<var>options</var>]
  1370. </pre></div>
  1371. <p><var>options</var> contains a list of &amp;-separated options of the form
  1372. <var>key</var>=<var>val</var>.
  1373. </p>
  1374. <p>or
  1375. </p>
  1376. <div class="example">
  1377. <pre class="example"><var>options</var> srt://<var>hostname</var>:<var>port</var>
  1378. </pre></div>
  1379. <p><var>options</var> contains a list of &rsquo;-<var>key</var> <var>val</var>&rsquo;
  1380. options.
  1381. </p>
  1382. <p>This protocol accepts the following options.
  1383. </p>
  1384. <dl compact="compact">
  1385. <dt>&lsquo;<samp>connect_timeout=<var>milliseconds</var></samp>&rsquo;</dt>
  1386. <dd><p>Connection timeout; SRT cannot connect for RTT &gt; 1500 msec
  1387. (2 handshake exchanges) with the default connect timeout of
  1388. 3 seconds. This option applies to the caller and rendezvous
  1389. connection modes. The connect timeout is 10 times the value
  1390. set for the rendezvous mode (which can be used as a
  1391. workaround for this connection problem with earlier versions).
  1392. </p>
  1393. </dd>
  1394. <dt>&lsquo;<samp>ffs=<var>bytes</var></samp>&rsquo;</dt>
  1395. <dd><p>Flight Flag Size (Window Size), in bytes. FFS is actually an
  1396. internal parameter and you should set it to not less than
  1397. &lsquo;<samp>recv_buffer_size</samp>&rsquo; and &lsquo;<samp>mss</samp>&rsquo;. The default value
  1398. is relatively large, therefore unless you set a very large receiver buffer,
  1399. you do not need to change this option. Default value is 25600.
  1400. </p>
  1401. </dd>
  1402. <dt>&lsquo;<samp>inputbw=<var>bytes/seconds</var></samp>&rsquo;</dt>
  1403. <dd><p>Sender nominal input rate, in bytes per seconds. Used along with
  1404. &lsquo;<samp>oheadbw</samp>&rsquo;, when &lsquo;<samp>maxbw</samp>&rsquo; is set to relative (0), to
  1405. calculate maximum sending rate when recovery packets are sent
  1406. along with the main media stream:
  1407. &lsquo;<samp>inputbw</samp>&rsquo; * (100 + &lsquo;<samp>oheadbw</samp>&rsquo;) / 100
  1408. if &lsquo;<samp>inputbw</samp>&rsquo; is not set while &lsquo;<samp>maxbw</samp>&rsquo; is set to
  1409. relative (0), the actual input rate is evaluated inside
  1410. the library. Default value is 0.
  1411. </p>
  1412. </dd>
  1413. <dt>&lsquo;<samp>iptos=<var>tos</var></samp>&rsquo;</dt>
  1414. <dd><p>IP Type of Service. Applies to sender only. Default value is 0xB8.
  1415. </p>
  1416. </dd>
  1417. <dt>&lsquo;<samp>ipttl=<var>ttl</var></samp>&rsquo;</dt>
  1418. <dd><p>IP Time To Live. Applies to sender only. Default value is 64.
  1419. </p>
  1420. </dd>
  1421. <dt>&lsquo;<samp>latency=<var>microseconds</var></samp>&rsquo;</dt>
  1422. <dd><p>Timestamp-based Packet Delivery Delay.
  1423. Used to absorb bursts of missed packet retransmissions.
  1424. This flag sets both &lsquo;<samp>rcvlatency</samp>&rsquo; and &lsquo;<samp>peerlatency</samp>&rsquo;
  1425. to the same value. Note that prior to version 1.3.0
  1426. this is the only flag to set the latency, however
  1427. this is effectively equivalent to setting &lsquo;<samp>peerlatency</samp>&rsquo;,
  1428. when side is sender and &lsquo;<samp>rcvlatency</samp>&rsquo;
  1429. when side is receiver, and the bidirectional stream
  1430. sending is not supported.
  1431. </p>
  1432. </dd>
  1433. <dt>&lsquo;<samp>listen_timeout=<var>microseconds</var></samp>&rsquo;</dt>
  1434. <dd><p>Set socket listen timeout.
  1435. </p>
  1436. </dd>
  1437. <dt>&lsquo;<samp>maxbw=<var>bytes/seconds</var></samp>&rsquo;</dt>
  1438. <dd><p>Maximum sending bandwidth, in bytes per seconds.
  1439. -1 infinite (CSRTCC limit is 30mbps)
  1440. 0 relative to input rate (see &lsquo;<samp>inputbw</samp>&rsquo;)
  1441. &gt;0 absolute limit value
  1442. Default value is 0 (relative)
  1443. </p>
  1444. </dd>
  1445. <dt>&lsquo;<samp>mode=<var>caller|listener|rendezvous</var></samp>&rsquo;</dt>
  1446. <dd><p>Connection mode.
  1447. &lsquo;<samp>caller</samp>&rsquo; opens client connection.
  1448. &lsquo;<samp>listener</samp>&rsquo; starts server to listen for incoming connections.
  1449. &lsquo;<samp>rendezvous</samp>&rsquo; use Rendez-Vous connection mode.
  1450. Default value is caller.
  1451. </p>
  1452. </dd>
  1453. <dt>&lsquo;<samp>mss=<var>bytes</var></samp>&rsquo;</dt>
  1454. <dd><p>Maximum Segment Size, in bytes. Used for buffer allocation
  1455. and rate calculation using a packet counter assuming fully
  1456. filled packets. The smallest MSS between the peers is
  1457. used. This is 1500 by default in the overall internet.
  1458. This is the maximum size of the UDP packet and can be
  1459. only decreased, unless you have some unusual dedicated
  1460. network settings. Default value is 1500.
  1461. </p>
  1462. </dd>
  1463. <dt>&lsquo;<samp>nakreport=<var>1|0</var></samp>&rsquo;</dt>
  1464. <dd><p>If set to 1, Receiver will send &lsquo;UMSG_LOSSREPORT&lsquo; messages
  1465. periodically until a lost packet is retransmitted or
  1466. intentionally dropped. Default value is 1.
  1467. </p>
  1468. </dd>
  1469. <dt>&lsquo;<samp>oheadbw=<var>percents</var></samp>&rsquo;</dt>
  1470. <dd><p>Recovery bandwidth overhead above input rate, in percents.
  1471. See &lsquo;<samp>inputbw</samp>&rsquo;. Default value is 25%.
  1472. </p>
  1473. </dd>
  1474. <dt>&lsquo;<samp>passphrase=<var>string</var></samp>&rsquo;</dt>
  1475. <dd><p>HaiCrypt Encryption/Decryption Passphrase string, length
  1476. from 10 to 79 characters. The passphrase is the shared
  1477. secret between the sender and the receiver. It is used
  1478. to generate the Key Encrypting Key using PBKDF2
  1479. (Password-Based Key Derivation Function). It is used
  1480. only if &lsquo;<samp>pbkeylen</samp>&rsquo; is non-zero. It is used on
  1481. the receiver only if the received data is encrypted.
  1482. The configured passphrase cannot be recovered (write-only).
  1483. </p>
  1484. </dd>
  1485. <dt>&lsquo;<samp>enforced_encryption=<var>1|0</var></samp>&rsquo;</dt>
  1486. <dd><p>If true, both connection parties must have the same password
  1487. set (including empty, that is, with no encryption). If the
  1488. password doesn&rsquo;t match or only one side is unencrypted,
  1489. the connection is rejected. Default is true.
  1490. </p>
  1491. </dd>
  1492. <dt>&lsquo;<samp>kmrefreshrate=<var>packets</var></samp>&rsquo;</dt>
  1493. <dd><p>The number of packets to be transmitted after which the
  1494. encryption key is switched to a new key. Default is -1.
  1495. -1 means auto (0x1000000 in srt library). The range for
  1496. this option is integers in the 0 - <code>INT_MAX</code>.
  1497. </p>
  1498. </dd>
  1499. <dt>&lsquo;<samp>kmpreannounce=<var>packets</var></samp>&rsquo;</dt>
  1500. <dd><p>The interval between when a new encryption key is sent and
  1501. when switchover occurs. This value also applies to the
  1502. subsequent interval between when switchover occurs and
  1503. when the old encryption key is decommissioned. Default is -1.
  1504. -1 means auto (0x1000 in srt library). The range for
  1505. this option is integers in the 0 - <code>INT_MAX</code>.
  1506. </p>
  1507. </dd>
  1508. <dt>&lsquo;<samp>payload_size=<var>bytes</var></samp>&rsquo;</dt>
  1509. <dd><p>Sets the maximum declared size of a packet transferred
  1510. during the single call to the sending function in Live
  1511. mode. Use 0 if this value isn&rsquo;t used (which is default in
  1512. file mode).
  1513. Default is -1 (automatic), which typically means MPEG-TS;
  1514. if you are going to use SRT
  1515. to send any different kind of payload, such as, for example,
  1516. wrapping a live stream in very small frames, then you can
  1517. use a bigger maximum frame size, though not greater than
  1518. 1456 bytes.
  1519. </p>
  1520. </dd>
  1521. <dt>&lsquo;<samp>pkt_size=<var>bytes</var></samp>&rsquo;</dt>
  1522. <dd><p>Alias for &lsquo;<samp>payload_size</samp>&rsquo;.
  1523. </p>
  1524. </dd>
  1525. <dt>&lsquo;<samp>peerlatency=<var>microseconds</var></samp>&rsquo;</dt>
  1526. <dd><p>The latency value (as described in &lsquo;<samp>rcvlatency</samp>&rsquo;) that is
  1527. set by the sender side as a minimum value for the receiver.
  1528. </p>
  1529. </dd>
  1530. <dt>&lsquo;<samp>pbkeylen=<var>bytes</var></samp>&rsquo;</dt>
  1531. <dd><p>Sender encryption key length, in bytes.
  1532. Only can be set to 0, 16, 24 and 32.
  1533. Enable sender encryption if not 0.
  1534. Not required on receiver (set to 0),
  1535. key size obtained from sender in HaiCrypt handshake.
  1536. Default value is 0.
  1537. </p>
  1538. </dd>
  1539. <dt>&lsquo;<samp>rcvlatency=<var>microseconds</var></samp>&rsquo;</dt>
  1540. <dd><p>The time that should elapse since the moment when the
  1541. packet was sent and the moment when it&rsquo;s delivered to
  1542. the receiver application in the receiving function.
  1543. This time should be a buffer time large enough to cover
  1544. the time spent for sending, unexpectedly extended RTT
  1545. time, and the time needed to retransmit the lost UDP
  1546. packet. The effective latency value will be the maximum
  1547. of this options&rsquo; value and the value of &lsquo;<samp>peerlatency</samp>&rsquo;
  1548. set by the peer side. Before version 1.3.0 this option
  1549. is only available as &lsquo;<samp>latency</samp>&rsquo;.
  1550. </p>
  1551. </dd>
  1552. <dt>&lsquo;<samp>recv_buffer_size=<var>bytes</var></samp>&rsquo;</dt>
  1553. <dd><p>Set UDP receive buffer size, expressed in bytes.
  1554. </p>
  1555. </dd>
  1556. <dt>&lsquo;<samp>send_buffer_size=<var>bytes</var></samp>&rsquo;</dt>
  1557. <dd><p>Set UDP send buffer size, expressed in bytes.
  1558. </p>
  1559. </dd>
  1560. <dt>&lsquo;<samp>timeout=<var>microseconds</var></samp>&rsquo;</dt>
  1561. <dd><p>Set raise error timeouts for read, write and connect operations. Note that the
  1562. SRT library has internal timeouts which can be controlled separately, the
  1563. value set here is only a cap on those.
  1564. </p>
  1565. </dd>
  1566. <dt>&lsquo;<samp>tlpktdrop=<var>1|0</var></samp>&rsquo;</dt>
  1567. <dd><p>Too-late Packet Drop. When enabled on receiver, it skips
  1568. missing packets that have not been delivered in time and
  1569. delivers the following packets to the application when
  1570. their time-to-play has come. It also sends a fake ACK to
  1571. the sender. When enabled on sender and enabled on the
  1572. receiving peer, the sender drops the older packets that
  1573. have no chance of being delivered in time. It was
  1574. automatically enabled in the sender if the receiver
  1575. supports it.
  1576. </p>
  1577. </dd>
  1578. <dt>&lsquo;<samp>sndbuf=<var>bytes</var></samp>&rsquo;</dt>
  1579. <dd><p>Set send buffer size, expressed in bytes.
  1580. </p>
  1581. </dd>
  1582. <dt>&lsquo;<samp>rcvbuf=<var>bytes</var></samp>&rsquo;</dt>
  1583. <dd><p>Set receive buffer size, expressed in bytes.
  1584. </p>
  1585. <p>Receive buffer must not be greater than &lsquo;<samp>ffs</samp>&rsquo;.
  1586. </p>
  1587. </dd>
  1588. <dt>&lsquo;<samp>lossmaxttl=<var>packets</var></samp>&rsquo;</dt>
  1589. <dd><p>The value up to which the Reorder Tolerance may grow. When
  1590. Reorder Tolerance is &gt; 0, then packet loss report is delayed
  1591. until that number of packets come in. Reorder Tolerance
  1592. increases every time a &quot;belated&quot; packet has come, but it
  1593. wasn&rsquo;t due to retransmission (that is, when UDP packets tend
  1594. to come out of order), with the difference between the latest
  1595. sequence and this packet&rsquo;s sequence, and not more than the
  1596. value of this option. By default it&rsquo;s 0, which means that this
  1597. mechanism is turned off, and the loss report is always sent
  1598. immediately upon experiencing a &quot;gap&quot; in sequences.
  1599. </p>
  1600. </dd>
  1601. <dt>&lsquo;<samp>minversion</samp>&rsquo;</dt>
  1602. <dd><p>The minimum SRT version that is required from the peer. A connection
  1603. to a peer that does not satisfy the minimum version requirement
  1604. will be rejected.
  1605. </p>
  1606. <p>The version format in hex is 0xXXYYZZ for x.y.z in human readable
  1607. form.
  1608. </p>
  1609. </dd>
  1610. <dt>&lsquo;<samp>streamid=<var>string</var></samp>&rsquo;</dt>
  1611. <dd><p>A string limited to 512 characters that can be set on the socket prior
  1612. to connecting. This stream ID will be able to be retrieved by the
  1613. listener side from the socket that is returned from srt_accept and
  1614. was connected by a socket with that set stream ID. SRT does not enforce
  1615. any special interpretation of the contents of this string.
  1616. This option doesn’t make sense in Rendezvous connection; the result
  1617. might be that simply one side will override the value from the other
  1618. side and it’s the matter of luck which one would win
  1619. </p>
  1620. </dd>
  1621. <dt>&lsquo;<samp>smoother=<var>live|file</var></samp>&rsquo;</dt>
  1622. <dd><p>The type of Smoother used for the transmission for that socket, which
  1623. is responsible for the transmission and congestion control. The Smoother
  1624. type must be exactly the same on both connecting parties, otherwise
  1625. the connection is rejected.
  1626. </p>
  1627. </dd>
  1628. <dt>&lsquo;<samp>messageapi=<var>1|0</var></samp>&rsquo;</dt>
  1629. <dd><p>When set, this socket uses the Message API, otherwise it uses Buffer
  1630. API. Note that in live mode (see &lsquo;<samp>transtype</samp>&rsquo;) there’s only
  1631. message API available. In File mode you can chose to use one of two modes:
  1632. </p>
  1633. <p>Stream API (default, when this option is false). In this mode you may
  1634. send as many data as you wish with one sending instruction, or even use
  1635. dedicated functions that read directly from a file. The internal facility
  1636. will take care of any speed and congestion control. When receiving, you
  1637. can also receive as many data as desired, the data not extracted will be
  1638. waiting for the next call. There is no boundary between data portions in
  1639. the Stream mode.
  1640. </p>
  1641. <p>Message API. In this mode your single sending instruction passes exactly
  1642. one piece of data that has boundaries (a message). Contrary to Live mode,
  1643. this message may span across multiple UDP packets and the only size
  1644. limitation is that it shall fit as a whole in the sending buffer. The
  1645. receiver shall use as large buffer as necessary to receive the message,
  1646. otherwise the message will not be given up. When the message is not
  1647. complete (not all packets received or there was a packet loss) it will
  1648. not be given up.
  1649. </p>
  1650. </dd>
  1651. <dt>&lsquo;<samp>transtype=<var>live|file</var></samp>&rsquo;</dt>
  1652. <dd><p>Sets the transmission type for the socket, in particular, setting this
  1653. option sets multiple other parameters to their default values as required
  1654. for a particular transmission type.
  1655. </p>
  1656. <p>live: Set options as for live transmission. In this mode, you should
  1657. send by one sending instruction only so many data that fit in one UDP packet,
  1658. and limited to the value defined first in &lsquo;<samp>payload_size</samp>&rsquo; (1316 is
  1659. default in this mode). There is no speed control in this mode, only the
  1660. bandwidth control, if configured, in order to not exceed the bandwidth with
  1661. the overhead transmission (retransmitted and control packets).
  1662. </p>
  1663. <p>file: Set options as for non-live transmission. See &lsquo;<samp>messageapi</samp>&rsquo;
  1664. for further explanations
  1665. </p>
  1666. </dd>
  1667. <dt>&lsquo;<samp>linger=<var>seconds</var></samp>&rsquo;</dt>
  1668. <dd><p>The number of seconds that the socket waits for unsent data when closing.
  1669. Default is -1. -1 means auto (off with 0 seconds in live mode, on with 180
  1670. seconds in file mode). The range for this option is integers in the
  1671. 0 - <code>INT_MAX</code>.
  1672. </p>
  1673. </dd>
  1674. </dl>
  1675. <p>For more information see: <a href="https://github.com/Haivision/srt">https://github.com/Haivision/srt</a>.
  1676. </p>
  1677. <a name="srtp"></a>
  1678. <h2 class="section"><a href="ffmpeg-protocols.html#toc-srtp">3.33 srtp</a></h2>
  1679. <p>Secure Real-time Transport Protocol.
  1680. </p>
  1681. <p>The accepted options are:
  1682. </p><dl compact="compact">
  1683. <dt>&lsquo;<samp>srtp_in_suite</samp>&rsquo;</dt>
  1684. <dt>&lsquo;<samp>srtp_out_suite</samp>&rsquo;</dt>
  1685. <dd><p>Select input and output encoding suites.
  1686. </p>
  1687. <p>Supported values:
  1688. </p><dl compact="compact">
  1689. <dt>&lsquo;<samp>AES_CM_128_HMAC_SHA1_80</samp>&rsquo;</dt>
  1690. <dt>&lsquo;<samp>SRTP_AES128_CM_HMAC_SHA1_80</samp>&rsquo;</dt>
  1691. <dt>&lsquo;<samp>AES_CM_128_HMAC_SHA1_32</samp>&rsquo;</dt>
  1692. <dt>&lsquo;<samp>SRTP_AES128_CM_HMAC_SHA1_32</samp>&rsquo;</dt>
  1693. </dl>
  1694. </dd>
  1695. <dt>&lsquo;<samp>srtp_in_params</samp>&rsquo;</dt>
  1696. <dt>&lsquo;<samp>srtp_out_params</samp>&rsquo;</dt>
  1697. <dd><p>Set input and output encoding parameters, which are expressed by a
  1698. base64-encoded representation of a binary block. The first 16 bytes of
  1699. this binary block are used as master key, the following 14 bytes are
  1700. used as master salt.
  1701. </p></dd>
  1702. </dl>
  1703. <a name="subfile"></a>
  1704. <h2 class="section"><a href="ffmpeg-protocols.html#toc-subfile">3.34 subfile</a></h2>
  1705. <p>Virtually extract a segment of a file or another stream.
  1706. The underlying stream must be seekable.
  1707. </p>
  1708. <p>Accepted options:
  1709. </p><dl compact="compact">
  1710. <dt>&lsquo;<samp>start</samp>&rsquo;</dt>
  1711. <dd><p>Start offset of the extracted segment, in bytes.
  1712. </p></dd>
  1713. <dt>&lsquo;<samp>end</samp>&rsquo;</dt>
  1714. <dd><p>End offset of the extracted segment, in bytes.
  1715. If set to 0, extract till end of file.
  1716. </p></dd>
  1717. </dl>
  1718. <p>Examples:
  1719. </p>
  1720. <p>Extract a chapter from a DVD VOB file (start and end sectors obtained
  1721. externally and multiplied by 2048):
  1722. </p><div class="example">
  1723. <pre class="example">subfile,,start,153391104,end,268142592,,:/media/dvd/VIDEO_TS/VTS_08_1.VOB
  1724. </pre></div>
  1725. <p>Play an AVI file directly from a TAR archive:
  1726. </p><div class="example">
  1727. <pre class="example">subfile,,start,183241728,end,366490624,,:archive.tar
  1728. </pre></div>
  1729. <p>Play a MPEG-TS file from start offset till end:
  1730. </p><div class="example">
  1731. <pre class="example">subfile,,start,32815239,end,0,,:video.ts
  1732. </pre></div>
  1733. <a name="tee"></a>
  1734. <h2 class="section"><a href="ffmpeg-protocols.html#toc-tee">3.35 tee</a></h2>
  1735. <p>Writes the output to multiple protocols. The individual outputs are separated
  1736. by |
  1737. </p>
  1738. <div class="example">
  1739. <pre class="example">tee:file://path/to/local/this.avi|file://path/to/local/that.avi
  1740. </pre></div>
  1741. <a name="tcp"></a>
  1742. <h2 class="section"><a href="ffmpeg-protocols.html#toc-tcp">3.36 tcp</a></h2>
  1743. <p>Transmission Control Protocol.
  1744. </p>
  1745. <p>The required syntax for a TCP url is:
  1746. </p><div class="example">
  1747. <pre class="example">tcp://<var>hostname</var>:<var>port</var>[?<var>options</var>]
  1748. </pre></div>
  1749. <p><var>options</var> contains a list of &amp;-separated options of the form
  1750. <var>key</var>=<var>val</var>.
  1751. </p>
  1752. <p>The list of supported options follows.
  1753. </p>
  1754. <dl compact="compact">
  1755. <dt>&lsquo;<samp>listen=<var>1|0</var></samp>&rsquo;</dt>
  1756. <dd><p>Listen for an incoming connection. Default value is 0.
  1757. </p>
  1758. </dd>
  1759. <dt>&lsquo;<samp>timeout=<var>microseconds</var></samp>&rsquo;</dt>
  1760. <dd><p>Set raise error timeout, expressed in microseconds.
  1761. </p>
  1762. <p>This option is only relevant in read mode: if no data arrived in more
  1763. than this time interval, raise error.
  1764. </p>
  1765. </dd>
  1766. <dt>&lsquo;<samp>listen_timeout=<var>milliseconds</var></samp>&rsquo;</dt>
  1767. <dd><p>Set listen timeout, expressed in milliseconds.
  1768. </p>
  1769. </dd>
  1770. <dt>&lsquo;<samp>recv_buffer_size=<var>bytes</var></samp>&rsquo;</dt>
  1771. <dd><p>Set receive buffer size, expressed bytes.
  1772. </p>
  1773. </dd>
  1774. <dt>&lsquo;<samp>send_buffer_size=<var>bytes</var></samp>&rsquo;</dt>
  1775. <dd><p>Set send buffer size, expressed bytes.
  1776. </p>
  1777. </dd>
  1778. <dt>&lsquo;<samp>tcp_nodelay=<var>1|0</var></samp>&rsquo;</dt>
  1779. <dd><p>Set TCP_NODELAY to disable Nagle&rsquo;s algorithm. Default value is 0.
  1780. </p>
  1781. </dd>
  1782. <dt>&lsquo;<samp>tcp_mss=<var>bytes</var></samp>&rsquo;</dt>
  1783. <dd><p>Set maximum segment size for outgoing TCP packets, expressed in bytes.
  1784. </p></dd>
  1785. </dl>
  1786. <p>The following example shows how to setup a listening TCP connection
  1787. with <code>ffmpeg</code>, which is then accessed with <code>ffplay</code>:
  1788. </p><div class="example">
  1789. <pre class="example">ffmpeg -i <var>input</var> -f <var>format</var> tcp://<var>hostname</var>:<var>port</var>?listen
  1790. ffplay tcp://<var>hostname</var>:<var>port</var>
  1791. </pre></div>
  1792. <a name="tls"></a>
  1793. <h2 class="section"><a href="ffmpeg-protocols.html#toc-tls">3.37 tls</a></h2>
  1794. <p>Transport Layer Security (TLS) / Secure Sockets Layer (SSL)
  1795. </p>
  1796. <p>The required syntax for a TLS/SSL url is:
  1797. </p><div class="example">
  1798. <pre class="example">tls://<var>hostname</var>:<var>port</var>[?<var>options</var>]
  1799. </pre></div>
  1800. <p>The following parameters can be set via command line options
  1801. (or in code via <code>AVOption</code>s):
  1802. </p>
  1803. <dl compact="compact">
  1804. <dt>&lsquo;<samp>ca_file, cafile=<var>filename</var></samp>&rsquo;</dt>
  1805. <dd><p>A file containing certificate authority (CA) root certificates to treat
  1806. as trusted. If the linked TLS library contains a default this might not
  1807. need to be specified for verification to work, but not all libraries and
  1808. setups have defaults built in.
  1809. The file must be in OpenSSL PEM format.
  1810. </p>
  1811. </dd>
  1812. <dt>&lsquo;<samp>tls_verify=<var>1|0</var></samp>&rsquo;</dt>
  1813. <dd><p>If enabled, try to verify the peer that we are communicating with.
  1814. Note, if using OpenSSL, this currently only makes sure that the
  1815. peer certificate is signed by one of the root certificates in the CA
  1816. database, but it does not validate that the certificate actually
  1817. matches the host name we are trying to connect to. (With other backends,
  1818. the host name is validated as well.)
  1819. </p>
  1820. <p>This is disabled by default since it requires a CA database to be
  1821. provided by the caller in many cases.
  1822. </p>
  1823. </dd>
  1824. <dt>&lsquo;<samp>cert_file, cert=<var>filename</var></samp>&rsquo;</dt>
  1825. <dd><p>A file containing a certificate to use in the handshake with the peer.
  1826. (When operating as server, in listen mode, this is more often required
  1827. by the peer, while client certificates only are mandated in certain
  1828. setups.)
  1829. </p>
  1830. </dd>
  1831. <dt>&lsquo;<samp>key_file, key=<var>filename</var></samp>&rsquo;</dt>
  1832. <dd><p>A file containing the private key for the certificate.
  1833. </p>
  1834. </dd>
  1835. <dt>&lsquo;<samp>listen=<var>1|0</var></samp>&rsquo;</dt>
  1836. <dd><p>If enabled, listen for connections on the provided port, and assume
  1837. the server role in the handshake instead of the client role.
  1838. </p>
  1839. </dd>
  1840. </dl>
  1841. <p>Example command lines:
  1842. </p>
  1843. <p>To create a TLS/SSL server that serves an input stream.
  1844. </p>
  1845. <div class="example">
  1846. <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>
  1847. </pre></div>
  1848. <p>To play back a stream from the TLS/SSL server using <code>ffplay</code>:
  1849. </p>
  1850. <div class="example">
  1851. <pre class="example">ffplay tls://<var>hostname</var>:<var>port</var>
  1852. </pre></div>
  1853. <a name="udp"></a>
  1854. <h2 class="section"><a href="ffmpeg-protocols.html#toc-udp">3.38 udp</a></h2>
  1855. <p>User Datagram Protocol.
  1856. </p>
  1857. <p>The required syntax for an UDP URL is:
  1858. </p><div class="example">
  1859. <pre class="example">udp://<var>hostname</var>:<var>port</var>[?<var>options</var>]
  1860. </pre></div>
  1861. <p><var>options</var> contains a list of &amp;-separated options of the form <var>key</var>=<var>val</var>.
  1862. </p>
  1863. <p>In case threading is enabled on the system, a circular buffer is used
  1864. to store the incoming data, which allows one to reduce loss of data due to
  1865. UDP socket buffer overruns. The <var>fifo_size</var> and
  1866. <var>overrun_nonfatal</var> options are related to this buffer.
  1867. </p>
  1868. <p>The list of supported options follows.
  1869. </p>
  1870. <dl compact="compact">
  1871. <dt>&lsquo;<samp>buffer_size=<var>size</var></samp>&rsquo;</dt>
  1872. <dd><p>Set the UDP maximum socket buffer size in bytes. This is used to set either
  1873. the receive or send buffer size, depending on what the socket is used for.
  1874. Default is 32 KB for output, 384 KB for input. See also <var>fifo_size</var>.
  1875. </p>
  1876. </dd>
  1877. <dt>&lsquo;<samp>bitrate=<var>bitrate</var></samp>&rsquo;</dt>
  1878. <dd><p>If set to nonzero, the output will have the specified constant bitrate if the
  1879. input has enough packets to sustain it.
  1880. </p>
  1881. </dd>
  1882. <dt>&lsquo;<samp>burst_bits=<var>bits</var></samp>&rsquo;</dt>
  1883. <dd><p>When using <var>bitrate</var> this specifies the maximum number of bits in
  1884. packet bursts.
  1885. </p>
  1886. </dd>
  1887. <dt>&lsquo;<samp>localport=<var>port</var></samp>&rsquo;</dt>
  1888. <dd><p>Override the local UDP port to bind with.
  1889. </p>
  1890. </dd>
  1891. <dt>&lsquo;<samp>localaddr=<var>addr</var></samp>&rsquo;</dt>
  1892. <dd><p>Local IP address of a network interface used for sending packets or joining
  1893. multicast groups.
  1894. </p>
  1895. </dd>
  1896. <dt>&lsquo;<samp>pkt_size=<var>size</var></samp>&rsquo;</dt>
  1897. <dd><p>Set the size in bytes of UDP packets.
  1898. </p>
  1899. </dd>
  1900. <dt>&lsquo;<samp>reuse=<var>1|0</var></samp>&rsquo;</dt>
  1901. <dd><p>Explicitly allow or disallow reusing UDP sockets.
  1902. </p>
  1903. </dd>
  1904. <dt>&lsquo;<samp>ttl=<var>ttl</var></samp>&rsquo;</dt>
  1905. <dd><p>Set the time to live value (for multicast only).
  1906. </p>
  1907. </dd>
  1908. <dt>&lsquo;<samp>connect=<var>1|0</var></samp>&rsquo;</dt>
  1909. <dd><p>Initialize the UDP socket with <code>connect()</code>. In this case, the
  1910. destination address can&rsquo;t be changed with ff_udp_set_remote_url later.
  1911. If the destination address isn&rsquo;t known at the start, this option can
  1912. be specified in ff_udp_set_remote_url, too.
  1913. This allows finding out the source address for the packets with getsockname,
  1914. and makes writes return with AVERROR(ECONNREFUSED) if &quot;destination
  1915. unreachable&quot; is received.
  1916. For receiving, this gives the benefit of only receiving packets from
  1917. the specified peer address/port.
  1918. </p>
  1919. </dd>
  1920. <dt>&lsquo;<samp>sources=<var>address</var>[,<var>address</var>]</samp>&rsquo;</dt>
  1921. <dd><p>Only receive packets sent from the specified addresses. In case of multicast,
  1922. also subscribe to multicast traffic coming from these addresses only.
  1923. </p>
  1924. </dd>
  1925. <dt>&lsquo;<samp>block=<var>address</var>[,<var>address</var>]</samp>&rsquo;</dt>
  1926. <dd><p>Ignore packets sent from the specified addresses. In case of multicast, also
  1927. exclude the source addresses in the multicast subscription.
  1928. </p>
  1929. </dd>
  1930. <dt>&lsquo;<samp>fifo_size=<var>units</var></samp>&rsquo;</dt>
  1931. <dd><p>Set the UDP receiving circular buffer size, expressed as a number of
  1932. packets with size of 188 bytes. If not specified defaults to 7*4096.
  1933. </p>
  1934. </dd>
  1935. <dt>&lsquo;<samp>overrun_nonfatal=<var>1|0</var></samp>&rsquo;</dt>
  1936. <dd><p>Survive in case of UDP receiving circular buffer overrun. Default
  1937. value is 0.
  1938. </p>
  1939. </dd>
  1940. <dt>&lsquo;<samp>timeout=<var>microseconds</var></samp>&rsquo;</dt>
  1941. <dd><p>Set raise error timeout, expressed in microseconds.
  1942. </p>
  1943. <p>This option is only relevant in read mode: if no data arrived in more
  1944. than this time interval, raise error.
  1945. </p>
  1946. </dd>
  1947. <dt>&lsquo;<samp>broadcast=<var>1|0</var></samp>&rsquo;</dt>
  1948. <dd><p>Explicitly allow or disallow UDP broadcasting.
  1949. </p>
  1950. <p>Note that broadcasting may not work properly on networks having
  1951. a broadcast storm protection.
  1952. </p></dd>
  1953. </dl>
  1954. <a name="Examples-1"></a>
  1955. <h3 class="subsection"><a href="ffmpeg-protocols.html#toc-Examples-1">3.38.1 Examples</a></h3>
  1956. <ul>
  1957. <li>
  1958. Use <code>ffmpeg</code> to stream over UDP to a remote endpoint:
  1959. <div class="example">
  1960. <pre class="example">ffmpeg -i <var>input</var> -f <var>format</var> udp://<var>hostname</var>:<var>port</var>
  1961. </pre></div>
  1962. </li><li>
  1963. Use <code>ffmpeg</code> to stream in mpegts format over UDP using 188
  1964. sized UDP packets, using a large input buffer:
  1965. <div class="example">
  1966. <pre class="example">ffmpeg -i <var>input</var> -f mpegts udp://<var>hostname</var>:<var>port</var>?pkt_size=188&amp;buffer_size=65535
  1967. </pre></div>
  1968. </li><li>
  1969. Use <code>ffmpeg</code> to receive over UDP from a remote endpoint:
  1970. <div class="example">
  1971. <pre class="example">ffmpeg -i udp://[<var>multicast-address</var>]:<var>port</var> ...
  1972. </pre></div>
  1973. </li></ul>
  1974. <a name="unix"></a>
  1975. <h2 class="section"><a href="ffmpeg-protocols.html#toc-unix">3.39 unix</a></h2>
  1976. <p>Unix local socket
  1977. </p>
  1978. <p>The required syntax for a Unix socket URL is:
  1979. </p>
  1980. <div class="example">
  1981. <pre class="example">unix://<var>filepath</var>
  1982. </pre></div>
  1983. <p>The following parameters can be set via command line options
  1984. (or in code via <code>AVOption</code>s):
  1985. </p>
  1986. <dl compact="compact">
  1987. <dt>&lsquo;<samp>timeout</samp>&rsquo;</dt>
  1988. <dd><p>Timeout in ms.
  1989. </p></dd>
  1990. <dt>&lsquo;<samp>listen</samp>&rsquo;</dt>
  1991. <dd><p>Create the Unix socket in listening mode.
  1992. </p></dd>
  1993. </dl>
  1994. <a name="zmq"></a>
  1995. <h2 class="section"><a href="ffmpeg-protocols.html#toc-zmq">3.40 zmq</a></h2>
  1996. <p>ZeroMQ asynchronous messaging using the libzmq library.
  1997. </p>
  1998. <p>This library supports unicast streaming to multiple clients without relying on
  1999. an external server.
  2000. </p>
  2001. <p>The required syntax for streaming or connecting to a stream is:
  2002. </p><div class="example">
  2003. <pre class="example">zmq:tcp://ip-address:port
  2004. </pre></div>
  2005. <p>Example:
  2006. Create a localhost stream on port 5555:
  2007. </p><div class="example">
  2008. <pre class="example">ffmpeg -re -i input -f mpegts zmq:tcp://127.0.0.1:5555
  2009. </pre></div>
  2010. <p>Multiple clients may connect to the stream using:
  2011. </p><div class="example">
  2012. <pre class="example">ffplay zmq:tcp://127.0.0.1:5555
  2013. </pre></div>
  2014. <p>Streaming to multiple clients is implemented using a ZeroMQ Pub-Sub pattern.
  2015. The server side binds to a port and publishes data. Clients connect to the
  2016. server (via IP address/port) and subscribe to the stream. The order in which
  2017. the server and client start generally does not matter.
  2018. </p>
  2019. <p>ffmpeg must be compiled with the &ndash;enable-libzmq option to support
  2020. this protocol.
  2021. </p>
  2022. <p>Options can be set on the <code>ffmpeg</code>/<code>ffplay</code> command
  2023. line. The following options are supported:
  2024. </p>
  2025. <dl compact="compact">
  2026. <dt>&lsquo;<samp>pkt_size</samp>&rsquo;</dt>
  2027. <dd><p>Forces the maximum packet size for sending/receiving data. The default value is
  2028. 131,072 bytes. On the server side, this sets the maximum size of sent packets
  2029. via ZeroMQ. On the clients, it sets an internal buffer size for receiving
  2030. packets. Note that pkt_size on the clients should be equal to or greater than
  2031. pkt_size on the server. Otherwise the received message may be truncated causing
  2032. decoding errors.
  2033. </p>
  2034. </dd>
  2035. </dl>
  2036. <a name="See-Also"></a>
  2037. <h1 class="chapter"><a href="ffmpeg-protocols.html#toc-See-Also">4 See Also</a></h1>
  2038. <p><a href="ffmpeg.html">ffmpeg</a>, <a href="ffplay.html">ffplay</a>, <a href="ffprobe.html">ffprobe</a>,
  2039. <a href="libavformat.html">libavformat</a>
  2040. </p>
  2041. <a name="Authors"></a>
  2042. <h1 class="chapter"><a href="ffmpeg-protocols.html#toc-Authors">5 Authors</a></h1>
  2043. <p>The FFmpeg developers.
  2044. </p>
  2045. <p>For details about the authorship, see the Git history of the project
  2046. (git://source.ffmpeg.org/ffmpeg), e.g. by typing the command
  2047. <code>git log</code> in the FFmpeg source directory, or browsing the
  2048. online repository at <a href="http://source.ffmpeg.org">http://source.ffmpeg.org</a>.
  2049. </p>
  2050. <p>Maintainers for the specific components are listed in the file
  2051. &lsquo;<tt>MAINTAINERS</tt>&rsquo; in the source code tree.
  2052. </p>
  2053. </div>
  2054. </body>
  2055. </html>