protocols.texi 67 KB

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