protocols.texi 65 KB

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