ffmpeg-protocols.html 89 KB

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