protocols.texi 65 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158
  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_flashver
  660. Version of the Flash plugin used to run the SWF player. The default
  661. is LNX 9,0,124,2. (When publishing, the default is FMLE/3.0 (compatible;
  662. <libavformat version>).)
  663. @item rtmp_flush_interval
  664. Number of packets flushed in the same request (RTMPT only). The default
  665. is 10.
  666. @item rtmp_live
  667. Specify that the media is a live stream. No resuming or seeking in
  668. live streams is possible. The default value is @code{any}, which means the
  669. subscriber first tries to play the live stream specified in the
  670. playpath. If a live stream of that name is not found, it plays the
  671. recorded stream. The other possible values are @code{live} and
  672. @code{recorded}.
  673. @item rtmp_pageurl
  674. URL of the web page in which the media was embedded. By default no
  675. value will be sent.
  676. @item rtmp_playpath
  677. Stream identifier to play or to publish. This option overrides the
  678. parameter specified in the URI.
  679. @item rtmp_subscribe
  680. Name of live stream to subscribe to. By default no value will be sent.
  681. It is only sent if the option is specified or if rtmp_live
  682. is set to live.
  683. @item rtmp_swfhash
  684. SHA256 hash of the decompressed SWF file (32 bytes).
  685. @item rtmp_swfsize
  686. Size of the decompressed SWF file, required for SWFVerification.
  687. @item rtmp_swfurl
  688. URL of the SWF player for the media. By default no value will be sent.
  689. @item rtmp_swfverify
  690. URL to player swf file, compute hash/size automatically.
  691. @item rtmp_tcurl
  692. URL of the target stream. Defaults to proto://host[:port]/app.
  693. @item tcp_nodelay=@var{1|0}
  694. Set TCP_NODELAY to disable Nagle's algorithm. Default value is 0.
  695. @emph{Remark: Writing to the socket is currently not optimized to minimize system calls and reduces the efficiency / effect of TCP_NODELAY.}
  696. @end table
  697. For example to read with @command{ffplay} a multimedia resource named
  698. "sample" from the application "vod" from an RTMP server "myserver":
  699. @example
  700. ffplay rtmp://myserver/vod/sample
  701. @end example
  702. To publish to a password protected server, passing the playpath and
  703. app names separately:
  704. @example
  705. ffmpeg -re -i <input> -f flv -rtmp_playpath some/long/path -rtmp_app long/app/name rtmp://username:password@@myserver/
  706. @end example
  707. @section rtmpe
  708. Encrypted Real-Time Messaging Protocol.
  709. The Encrypted Real-Time Messaging Protocol (RTMPE) is used for
  710. streaming multimedia content within standard cryptographic primitives,
  711. consisting of Diffie-Hellman key exchange and HMACSHA256, generating
  712. a pair of RC4 keys.
  713. @section rtmps
  714. Real-Time Messaging Protocol over a secure SSL connection.
  715. The Real-Time Messaging Protocol (RTMPS) is used for streaming
  716. multimedia content across an encrypted connection.
  717. @section rtmpt
  718. Real-Time Messaging Protocol tunneled through HTTP.
  719. The Real-Time Messaging Protocol tunneled through HTTP (RTMPT) is used
  720. for streaming multimedia content within HTTP requests to traverse
  721. firewalls.
  722. @section rtmpte
  723. Encrypted Real-Time Messaging Protocol tunneled through HTTP.
  724. The Encrypted Real-Time Messaging Protocol tunneled through HTTP (RTMPTE)
  725. is used for streaming multimedia content within HTTP requests to traverse
  726. firewalls.
  727. @section rtmpts
  728. Real-Time Messaging Protocol tunneled through HTTPS.
  729. The Real-Time Messaging Protocol tunneled through HTTPS (RTMPTS) is used
  730. for streaming multimedia content within HTTPS requests to traverse
  731. firewalls.
  732. @section libsmbclient
  733. libsmbclient permits one to manipulate CIFS/SMB network resources.
  734. Following syntax is required.
  735. @example
  736. smb://[[domain:]user[:password@@]]server[/share[/path[/file]]]
  737. @end example
  738. This protocol accepts the following options.
  739. @table @option
  740. @item timeout
  741. Set timeout in milliseconds of socket I/O operations used by the underlying
  742. low level operation. By default it is set to -1, which means that the timeout
  743. is not specified.
  744. @item truncate
  745. Truncate existing files on write, if set to 1. A value of 0 prevents
  746. truncating. Default value is 1.
  747. @item workgroup
  748. Set the workgroup used for making connections. By default workgroup is not specified.
  749. @end table
  750. For more information see: @url{http://www.samba.org/}.
  751. @section libssh
  752. Secure File Transfer Protocol via libssh
  753. Read from or write to remote resources using SFTP protocol.
  754. Following syntax is required.
  755. @example
  756. sftp://[user[:password]@@]server[:port]/path/to/remote/resource.mpeg
  757. @end example
  758. This protocol accepts the following options.
  759. @table @option
  760. @item timeout
  761. Set timeout of socket I/O operations used by the underlying low level
  762. operation. By default it is set to -1, which means that the timeout
  763. is not specified.
  764. @item truncate
  765. Truncate existing files on write, if set to 1. A value of 0 prevents
  766. truncating. Default value is 1.
  767. @item private_key
  768. Specify the path of the file containing private key to use during authorization.
  769. By default libssh searches for keys in the @file{~/.ssh/} directory.
  770. @end table
  771. Example: Play a file stored on remote server.
  772. @example
  773. ffplay sftp://user:password@@server_address:22/home/user/resource.mpeg
  774. @end example
  775. @section librtmp rtmp, rtmpe, rtmps, rtmpt, rtmpte
  776. Real-Time Messaging Protocol and its variants supported through
  777. librtmp.
  778. Requires the presence of the librtmp headers and library during
  779. configuration. You need to explicitly configure the build with
  780. "--enable-librtmp". If enabled this will replace the native RTMP
  781. protocol.
  782. This protocol provides most client functions and a few server
  783. functions needed to support RTMP, RTMP tunneled in HTTP (RTMPT),
  784. encrypted RTMP (RTMPE), RTMP over SSL/TLS (RTMPS) and tunneled
  785. variants of these encrypted types (RTMPTE, RTMPTS).
  786. The required syntax is:
  787. @example
  788. @var{rtmp_proto}://@var{server}[:@var{port}][/@var{app}][/@var{playpath}] @var{options}
  789. @end example
  790. where @var{rtmp_proto} is one of the strings "rtmp", "rtmpt", "rtmpe",
  791. "rtmps", "rtmpte", "rtmpts" corresponding to each RTMP variant, and
  792. @var{server}, @var{port}, @var{app} and @var{playpath} have the same
  793. meaning as specified for the RTMP native protocol.
  794. @var{options} contains a list of space-separated options of the form
  795. @var{key}=@var{val}.
  796. See the librtmp manual page (man 3 librtmp) for more information.
  797. For example, to stream a file in real-time to an RTMP server using
  798. @command{ffmpeg}:
  799. @example
  800. ffmpeg -re -i myfile -f flv rtmp://myserver/live/mystream
  801. @end example
  802. To play the same stream using @command{ffplay}:
  803. @example
  804. ffplay "rtmp://myserver/live/mystream live=1"
  805. @end example
  806. @section rtp
  807. Real-time Transport Protocol.
  808. The required syntax for an RTP URL is:
  809. rtp://@var{hostname}[:@var{port}][?@var{option}=@var{val}...]
  810. @var{port} specifies the RTP port to use.
  811. The following URL options are supported:
  812. @table @option
  813. @item ttl=@var{n}
  814. Set the TTL (Time-To-Live) value (for multicast only).
  815. @item rtcpport=@var{n}
  816. Set the remote RTCP port to @var{n}.
  817. @item localrtpport=@var{n}
  818. Set the local RTP port to @var{n}.
  819. @item localrtcpport=@var{n}'
  820. Set the local RTCP port to @var{n}.
  821. @item pkt_size=@var{n}
  822. Set max packet size (in bytes) to @var{n}.
  823. @item buffer_size=@var{size}
  824. Set the maximum UDP socket buffer size in bytes.
  825. @item connect=0|1
  826. Do a @code{connect()} on the UDP socket (if set to 1) or not (if set
  827. to 0).
  828. @item sources=@var{ip}[,@var{ip}]
  829. List allowed source IP addresses.
  830. @item block=@var{ip}[,@var{ip}]
  831. List disallowed (blocked) source IP addresses.
  832. @item write_to_source=0|1
  833. Send packets to the source address of the latest received packet (if
  834. set to 1) or to a default remote address (if set to 0).
  835. @item localport=@var{n}
  836. Set the local RTP port to @var{n}.
  837. @item localaddr=@var{addr}
  838. Local IP address of a network interface used for sending packets or joining
  839. multicast groups.
  840. @item timeout=@var{n}
  841. Set timeout (in microseconds) of socket I/O operations to @var{n}.
  842. This is a deprecated option. Instead, @option{localrtpport} should be
  843. used.
  844. @end table
  845. Important notes:
  846. @enumerate
  847. @item
  848. If @option{rtcpport} is not set the RTCP port will be set to the RTP
  849. port value plus 1.
  850. @item
  851. If @option{localrtpport} (the local RTP port) is not set any available
  852. port will be used for the local RTP and RTCP ports.
  853. @item
  854. If @option{localrtcpport} (the local RTCP port) is not set it will be
  855. set to the local RTP port value plus 1.
  856. @end enumerate
  857. @section rtsp
  858. Real-Time Streaming Protocol.
  859. RTSP is not technically a protocol handler in libavformat, it is a demuxer
  860. and muxer. The demuxer supports both normal RTSP (with data transferred
  861. over RTP; this is used by e.g. Apple and Microsoft) and Real-RTSP (with
  862. data transferred over RDT).
  863. The muxer can be used to send a stream using RTSP ANNOUNCE to a server
  864. supporting it (currently Darwin Streaming Server and Mischa Spiegelmock's
  865. @uref{https://github.com/revmischa/rtsp-server, RTSP server}).
  866. The required syntax for a RTSP url is:
  867. @example
  868. rtsp://@var{hostname}[:@var{port}]/@var{path}
  869. @end example
  870. Options can be set on the @command{ffmpeg}/@command{ffplay} command
  871. line, or set in code via @code{AVOption}s or in
  872. @code{avformat_open_input}.
  873. @subsection Muxer
  874. The following options are supported.
  875. @table @option
  876. @item rtsp_transport
  877. Set RTSP transport protocols.
  878. It accepts the following values:
  879. @table @samp
  880. @item udp
  881. Use UDP as lower transport protocol.
  882. @item tcp
  883. Use TCP (interleaving within the RTSP control channel) as lower
  884. transport protocol.
  885. @end table
  886. Default value is @samp{0}.
  887. @item rtsp_flags
  888. Set RTSP flags.
  889. The following values are accepted:
  890. @table @samp
  891. @item latm
  892. Use MP4A-LATM packetization instead of MPEG4-GENERIC for AAC.
  893. @item rfc2190
  894. Use RFC 2190 packetization instead of RFC 4629 for H.263.
  895. @item skip_rtcp
  896. Don't send RTCP sender reports.
  897. @item h264_mode0
  898. Use mode 0 for H.264 in RTP.
  899. @item send_bye
  900. Send RTCP BYE packets when finishing.
  901. @end table
  902. Default value is @samp{0}.
  903. @item min_port
  904. Set minimum local UDP port. Default value is 5000.
  905. @item max_port
  906. Set maximum local UDP port. Default value is 65000.
  907. @item buffer_size
  908. Set the maximum socket buffer size in bytes.
  909. @item pkt_size
  910. Set max send packet size (in bytes). Default value is 1472.
  911. @end table
  912. @subsection Demuxer
  913. The following options are supported.
  914. @table @option
  915. @item initial_pause
  916. Do not start playing the stream immediately if set to 1. Default value
  917. is 0.
  918. @item rtsp_transport
  919. Set RTSP transport protocols.
  920. It accepts the following values:
  921. @table @samp
  922. @item udp
  923. Use UDP as lower transport protocol.
  924. @item tcp
  925. Use TCP (interleaving within the RTSP control channel) as lower
  926. transport protocol.
  927. @item udp_multicast
  928. Use UDP multicast as lower transport protocol.
  929. @item http
  930. Use HTTP tunneling as lower transport protocol, which is useful for
  931. passing proxies.
  932. @item https
  933. Use HTTPs tunneling as lower transport protocol, which is useful for
  934. passing proxies and widely used for security consideration.
  935. @end table
  936. Multiple lower transport protocols may be specified, in that case they are
  937. tried one at a time (if the setup of one fails, the next one is tried).
  938. For the muxer, only the @samp{tcp} and @samp{udp} options are supported.
  939. @item rtsp_flags
  940. Set RTSP flags.
  941. The following values are accepted:
  942. @table @samp
  943. @item filter_src
  944. Accept packets only from negotiated peer address and port.
  945. @item listen
  946. Act as a server, listening for an incoming connection.
  947. @item prefer_tcp
  948. Try TCP for RTP transport first, if TCP is available as RTSP RTP transport.
  949. @item satip_raw
  950. Export raw MPEG-TS stream instead of demuxing. The flag will simply write out
  951. the raw stream, with the original PAT/PMT/PIDs intact.
  952. @end table
  953. Default value is @samp{none}.
  954. @item allowed_media_types
  955. Set media types to accept from the server.
  956. The following flags are accepted:
  957. @table @samp
  958. @item video
  959. @item audio
  960. @item data
  961. @item subtitle
  962. @end table
  963. By default it accepts all media types.
  964. @item min_port
  965. Set minimum local UDP port. Default value is 5000.
  966. @item max_port
  967. Set maximum local UDP port. Default value is 65000.
  968. @item listen_timeout
  969. Set maximum timeout (in seconds) to establish an initial connection. Setting
  970. @option{listen_timeout} > 0 sets @option{rtsp_flags} to @samp{listen}. Default is -1
  971. which means an infinite timeout when @samp{listen} mode is set.
  972. @item reorder_queue_size
  973. Set number of packets to buffer for handling of reordered packets.
  974. @item timeout
  975. Set socket TCP I/O timeout in microseconds.
  976. @item user_agent
  977. Override User-Agent header. If not specified, it defaults to the
  978. libavformat identifier string.
  979. @item buffer_size
  980. Set the maximum socket buffer size in bytes.
  981. @end table
  982. When receiving data over UDP, the demuxer tries to reorder received packets
  983. (since they may arrive out of order, or packets may get lost totally). This
  984. can be disabled by setting the maximum demuxing delay to zero (via
  985. the @code{max_delay} field of AVFormatContext).
  986. When watching multi-bitrate Real-RTSP streams with @command{ffplay}, the
  987. streams to display can be chosen with @code{-vst} @var{n} and
  988. @code{-ast} @var{n} for video and audio respectively, and can be switched
  989. on the fly by pressing @code{v} and @code{a}.
  990. @subsection Examples
  991. The following examples all make use of the @command{ffplay} and
  992. @command{ffmpeg} tools.
  993. @itemize
  994. @item
  995. Watch a stream over UDP, with a max reordering delay of 0.5 seconds:
  996. @example
  997. ffplay -max_delay 500000 -rtsp_transport udp rtsp://server/video.mp4
  998. @end example
  999. @item
  1000. Watch a stream tunneled over HTTP:
  1001. @example
  1002. ffplay -rtsp_transport http rtsp://server/video.mp4
  1003. @end example
  1004. @item
  1005. Send a stream in realtime to a RTSP server, for others to watch:
  1006. @example
  1007. ffmpeg -re -i @var{input} -f rtsp -muxdelay 0.1 rtsp://server/live.sdp
  1008. @end example
  1009. @item
  1010. Receive a stream in realtime:
  1011. @example
  1012. ffmpeg -rtsp_flags listen -i rtsp://ownaddress/live.sdp @var{output}
  1013. @end example
  1014. @end itemize
  1015. @section sap
  1016. Session Announcement Protocol (RFC 2974). This is not technically a
  1017. protocol handler in libavformat, it is a muxer and demuxer.
  1018. It is used for signalling of RTP streams, by announcing the SDP for the
  1019. streams regularly on a separate port.
  1020. @subsection Muxer
  1021. The syntax for a SAP url given to the muxer is:
  1022. @example
  1023. sap://@var{destination}[:@var{port}][?@var{options}]
  1024. @end example
  1025. The RTP packets are sent to @var{destination} on port @var{port},
  1026. or to port 5004 if no port is specified.
  1027. @var{options} is a @code{&}-separated list. The following options
  1028. are supported:
  1029. @table @option
  1030. @item announce_addr=@var{address}
  1031. Specify the destination IP address for sending the announcements to.
  1032. If omitted, the announcements are sent to the commonly used SAP
  1033. announcement multicast address 224.2.127.254 (sap.mcast.net), or
  1034. ff0e::2:7ffe if @var{destination} is an IPv6 address.
  1035. @item announce_port=@var{port}
  1036. Specify the port to send the announcements on, defaults to
  1037. 9875 if not specified.
  1038. @item ttl=@var{ttl}
  1039. Specify the time to live value for the announcements and RTP packets,
  1040. defaults to 255.
  1041. @item same_port=@var{0|1}
  1042. If set to 1, send all RTP streams on the same port pair. If zero (the
  1043. default), all streams are sent on unique ports, with each stream on a
  1044. port 2 numbers higher than the previous.
  1045. VLC/Live555 requires this to be set to 1, to be able to receive the stream.
  1046. The RTP stack in libavformat for receiving requires all streams to be sent
  1047. on unique ports.
  1048. @end table
  1049. Example command lines follow.
  1050. To broadcast a stream on the local subnet, for watching in VLC:
  1051. @example
  1052. ffmpeg -re -i @var{input} -f sap sap://224.0.0.255?same_port=1
  1053. @end example
  1054. Similarly, for watching in @command{ffplay}:
  1055. @example
  1056. ffmpeg -re -i @var{input} -f sap sap://224.0.0.255
  1057. @end example
  1058. And for watching in @command{ffplay}, over IPv6:
  1059. @example
  1060. ffmpeg -re -i @var{input} -f sap sap://[ff0e::1:2:3:4]
  1061. @end example
  1062. @subsection Demuxer
  1063. The syntax for a SAP url given to the demuxer is:
  1064. @example
  1065. sap://[@var{address}][:@var{port}]
  1066. @end example
  1067. @var{address} is the multicast address to listen for announcements on,
  1068. if omitted, the default 224.2.127.254 (sap.mcast.net) is used. @var{port}
  1069. is the port that is listened on, 9875 if omitted.
  1070. The demuxers listens for announcements on the given address and port.
  1071. Once an announcement is received, it tries to receive that particular stream.
  1072. Example command lines follow.
  1073. To play back the first stream announced on the normal SAP multicast address:
  1074. @example
  1075. ffplay sap://
  1076. @end example
  1077. To play back the first stream announced on one the default IPv6 SAP multicast address:
  1078. @example
  1079. ffplay sap://[ff0e::2:7ffe]
  1080. @end example
  1081. @section sctp
  1082. Stream Control Transmission Protocol.
  1083. The accepted URL syntax is:
  1084. @example
  1085. sctp://@var{host}:@var{port}[?@var{options}]
  1086. @end example
  1087. The protocol accepts the following options:
  1088. @table @option
  1089. @item listen
  1090. If set to any value, listen for an incoming connection. Outgoing connection is done by default.
  1091. @item max_streams
  1092. Set the maximum number of streams. By default no limit is set.
  1093. @end table
  1094. @section srt
  1095. Haivision Secure Reliable Transport Protocol via libsrt.
  1096. The supported syntax for a SRT URL is:
  1097. @example
  1098. srt://@var{hostname}:@var{port}[?@var{options}]
  1099. @end example
  1100. @var{options} contains a list of &-separated options of the form
  1101. @var{key}=@var{val}.
  1102. or
  1103. @example
  1104. @var{options} srt://@var{hostname}:@var{port}
  1105. @end example
  1106. @var{options} contains a list of '-@var{key} @var{val}'
  1107. options.
  1108. This protocol accepts the following options.
  1109. @table @option
  1110. @item connect_timeout=@var{milliseconds}
  1111. Connection timeout; SRT cannot connect for RTT > 1500 msec
  1112. (2 handshake exchanges) with the default connect timeout of
  1113. 3 seconds. This option applies to the caller and rendezvous
  1114. connection modes. The connect timeout is 10 times the value
  1115. set for the rendezvous mode (which can be used as a
  1116. workaround for this connection problem with earlier versions).
  1117. @item ffs=@var{bytes}
  1118. Flight Flag Size (Window Size), in bytes. FFS is actually an
  1119. internal parameter and you should set it to not less than
  1120. @option{recv_buffer_size} and @option{mss}. The default value
  1121. is relatively large, therefore unless you set a very large receiver buffer,
  1122. you do not need to change this option. Default value is 25600.
  1123. @item inputbw=@var{bytes/seconds}
  1124. Sender nominal input rate, in bytes per seconds. Used along with
  1125. @option{oheadbw}, when @option{maxbw} is set to relative (0), to
  1126. calculate maximum sending rate when recovery packets are sent
  1127. along with the main media stream:
  1128. @option{inputbw} * (100 + @option{oheadbw}) / 100
  1129. if @option{inputbw} is not set while @option{maxbw} is set to
  1130. relative (0), the actual input rate is evaluated inside
  1131. the library. Default value is 0.
  1132. @item iptos=@var{tos}
  1133. IP Type of Service. Applies to sender only. Default value is 0xB8.
  1134. @item ipttl=@var{ttl}
  1135. IP Time To Live. Applies to sender only. Default value is 64.
  1136. @item latency=@var{microseconds}
  1137. Timestamp-based Packet Delivery Delay.
  1138. Used to absorb bursts of missed packet retransmissions.
  1139. This flag sets both @option{rcvlatency} and @option{peerlatency}
  1140. to the same value. Note that prior to version 1.3.0
  1141. this is the only flag to set the latency, however
  1142. this is effectively equivalent to setting @option{peerlatency},
  1143. when side is sender and @option{rcvlatency}
  1144. when side is receiver, and the bidirectional stream
  1145. sending is not supported.
  1146. @item listen_timeout=@var{microseconds}
  1147. Set socket listen timeout.
  1148. @item maxbw=@var{bytes/seconds}
  1149. Maximum sending bandwidth, in bytes per seconds.
  1150. -1 infinite (CSRTCC limit is 30mbps)
  1151. 0 relative to input rate (see @option{inputbw})
  1152. >0 absolute limit value
  1153. Default value is 0 (relative)
  1154. @item mode=@var{caller|listener|rendezvous}
  1155. Connection mode.
  1156. @option{caller} opens client connection.
  1157. @option{listener} starts server to listen for incoming connections.
  1158. @option{rendezvous} use Rendez-Vous connection mode.
  1159. Default value is caller.
  1160. @item mss=@var{bytes}
  1161. Maximum Segment Size, in bytes. Used for buffer allocation
  1162. and rate calculation using a packet counter assuming fully
  1163. filled packets. The smallest MSS between the peers is
  1164. used. This is 1500 by default in the overall internet.
  1165. This is the maximum size of the UDP packet and can be
  1166. only decreased, unless you have some unusual dedicated
  1167. network settings. Default value is 1500.
  1168. @item nakreport=@var{1|0}
  1169. If set to 1, Receiver will send `UMSG_LOSSREPORT` messages
  1170. periodically until a lost packet is retransmitted or
  1171. intentionally dropped. Default value is 1.
  1172. @item oheadbw=@var{percents}
  1173. Recovery bandwidth overhead above input rate, in percents.
  1174. See @option{inputbw}. Default value is 25%.
  1175. @item passphrase=@var{string}
  1176. HaiCrypt Encryption/Decryption Passphrase string, length
  1177. from 10 to 79 characters. The passphrase is the shared
  1178. secret between the sender and the receiver. It is used
  1179. to generate the Key Encrypting Key using PBKDF2
  1180. (Password-Based Key Derivation Function). It is used
  1181. only if @option{pbkeylen} is non-zero. It is used on
  1182. the receiver only if the received data is encrypted.
  1183. The configured passphrase cannot be recovered (write-only).
  1184. @item enforced_encryption=@var{1|0}
  1185. If true, both connection parties must have the same password
  1186. set (including empty, that is, with no encryption). If the
  1187. password doesn't match or only one side is unencrypted,
  1188. the connection is rejected. Default is true.
  1189. @item kmrefreshrate=@var{packets}
  1190. The number of packets to be transmitted after which the
  1191. encryption key is switched to a new key. Default is -1.
  1192. -1 means auto (0x1000000 in srt library). The range for
  1193. this option is integers in the 0 - @code{INT_MAX}.
  1194. @item kmpreannounce=@var{packets}
  1195. The interval between when a new encryption key is sent and
  1196. when switchover occurs. This value also applies to the
  1197. subsequent interval between when switchover occurs and
  1198. when the old encryption key is decommissioned. Default is -1.
  1199. -1 means auto (0x1000 in srt library). The range for
  1200. this option is integers in the 0 - @code{INT_MAX}.
  1201. @item snddropdelay=@var{microseconds}
  1202. The sender's extra delay before dropping packets. This delay is
  1203. added to the default drop delay time interval value.
  1204. Special value -1: Do not drop packets on the sender at all.
  1205. @item payload_size=@var{bytes}
  1206. Sets the maximum declared size of a packet transferred
  1207. during the single call to the sending function in Live
  1208. mode. Use 0 if this value isn't used (which is default in
  1209. file mode).
  1210. Default is -1 (automatic), which typically means MPEG-TS;
  1211. if you are going to use SRT
  1212. to send any different kind of payload, such as, for example,
  1213. wrapping a live stream in very small frames, then you can
  1214. use a bigger maximum frame size, though not greater than
  1215. 1456 bytes.
  1216. @item pkt_size=@var{bytes}
  1217. Alias for @samp{payload_size}.
  1218. @item peerlatency=@var{microseconds}
  1219. The latency value (as described in @option{rcvlatency}) that is
  1220. set by the sender side as a minimum value for the receiver.
  1221. @item pbkeylen=@var{bytes}
  1222. Sender encryption key length, in bytes.
  1223. Only can be set to 0, 16, 24 and 32.
  1224. Enable sender encryption if not 0.
  1225. Not required on receiver (set to 0),
  1226. key size obtained from sender in HaiCrypt handshake.
  1227. Default value is 0.
  1228. @item rcvlatency=@var{microseconds}
  1229. The time that should elapse since the moment when the
  1230. packet was sent and the moment when it's delivered to
  1231. the receiver application in the receiving function.
  1232. This time should be a buffer time large enough to cover
  1233. the time spent for sending, unexpectedly extended RTT
  1234. time, and the time needed to retransmit the lost UDP
  1235. packet. The effective latency value will be the maximum
  1236. of this options' value and the value of @option{peerlatency}
  1237. set by the peer side. Before version 1.3.0 this option
  1238. is only available as @option{latency}.
  1239. @item recv_buffer_size=@var{bytes}
  1240. Set UDP receive buffer size, expressed in bytes.
  1241. @item send_buffer_size=@var{bytes}
  1242. Set UDP send buffer size, expressed in bytes.
  1243. @item timeout=@var{microseconds}
  1244. Set raise error timeouts for read, write and connect operations. Note that the
  1245. SRT library has internal timeouts which can be controlled separately, the
  1246. value set here is only a cap on those.
  1247. @item tlpktdrop=@var{1|0}
  1248. Too-late Packet Drop. When enabled on receiver, it skips
  1249. missing packets that have not been delivered in time and
  1250. delivers the following packets to the application when
  1251. their time-to-play has come. It also sends a fake ACK to
  1252. the sender. When enabled on sender and enabled on the
  1253. receiving peer, the sender drops the older packets that
  1254. have no chance of being delivered in time. It was
  1255. automatically enabled in the sender if the receiver
  1256. supports it.
  1257. @item sndbuf=@var{bytes}
  1258. Set send buffer size, expressed in bytes.
  1259. @item rcvbuf=@var{bytes}
  1260. Set receive buffer size, expressed in bytes.
  1261. Receive buffer must not be greater than @option{ffs}.
  1262. @item lossmaxttl=@var{packets}
  1263. The value up to which the Reorder Tolerance may grow. When
  1264. Reorder Tolerance is > 0, then packet loss report is delayed
  1265. until that number of packets come in. Reorder Tolerance
  1266. increases every time a "belated" packet has come, but it
  1267. wasn't due to retransmission (that is, when UDP packets tend
  1268. to come out of order), with the difference between the latest
  1269. sequence and this packet's sequence, and not more than the
  1270. value of this option. By default it's 0, which means that this
  1271. mechanism is turned off, and the loss report is always sent
  1272. immediately upon experiencing a "gap" in sequences.
  1273. @item minversion
  1274. The minimum SRT version that is required from the peer. A connection
  1275. to a peer that does not satisfy the minimum version requirement
  1276. will be rejected.
  1277. The version format in hex is 0xXXYYZZ for x.y.z in human readable
  1278. form.
  1279. @item streamid=@var{string}
  1280. A string limited to 512 characters that can be set on the socket prior
  1281. to connecting. This stream ID will be able to be retrieved by the
  1282. listener side from the socket that is returned from srt_accept and
  1283. was connected by a socket with that set stream ID. SRT does not enforce
  1284. any special interpretation of the contents of this string.
  1285. This option doesn’t make sense in Rendezvous connection; the result
  1286. might be that simply one side will override the value from the other
  1287. side and it’s the matter of luck which one would win
  1288. @item srt_streamid=@var{string}
  1289. Alias for @samp{streamid} to avoid conflict with ffmpeg command line option.
  1290. @item smoother=@var{live|file}
  1291. The type of Smoother used for the transmission for that socket, which
  1292. is responsible for the transmission and congestion control. The Smoother
  1293. type must be exactly the same on both connecting parties, otherwise
  1294. the connection is rejected.
  1295. @item messageapi=@var{1|0}
  1296. When set, this socket uses the Message API, otherwise it uses Buffer
  1297. API. Note that in live mode (see @option{transtype}) there’s only
  1298. message API available. In File mode you can chose to use one of two modes:
  1299. Stream API (default, when this option is false). In this mode you may
  1300. send as many data as you wish with one sending instruction, or even use
  1301. dedicated functions that read directly from a file. The internal facility
  1302. will take care of any speed and congestion control. When receiving, you
  1303. can also receive as many data as desired, the data not extracted will be
  1304. waiting for the next call. There is no boundary between data portions in
  1305. the Stream mode.
  1306. Message API. In this mode your single sending instruction passes exactly
  1307. one piece of data that has boundaries (a message). Contrary to Live mode,
  1308. this message may span across multiple UDP packets and the only size
  1309. limitation is that it shall fit as a whole in the sending buffer. The
  1310. receiver shall use as large buffer as necessary to receive the message,
  1311. otherwise the message will not be given up. When the message is not
  1312. complete (not all packets received or there was a packet loss) it will
  1313. not be given up.
  1314. @item transtype=@var{live|file}
  1315. Sets the transmission type for the socket, in particular, setting this
  1316. option sets multiple other parameters to their default values as required
  1317. for a particular transmission type.
  1318. live: Set options as for live transmission. In this mode, you should
  1319. send by one sending instruction only so many data that fit in one UDP packet,
  1320. and limited to the value defined first in @option{payload_size} (1316 is
  1321. default in this mode). There is no speed control in this mode, only the
  1322. bandwidth control, if configured, in order to not exceed the bandwidth with
  1323. the overhead transmission (retransmitted and control packets).
  1324. file: Set options as for non-live transmission. See @option{messageapi}
  1325. for further explanations
  1326. @item linger=@var{seconds}
  1327. The number of seconds that the socket waits for unsent data when closing.
  1328. Default is -1. -1 means auto (off with 0 seconds in live mode, on with 180
  1329. seconds in file mode). The range for this option is integers in the
  1330. 0 - @code{INT_MAX}.
  1331. @item tsbpd=@var{1|0}
  1332. When true, use Timestamp-based Packet Delivery mode. The default behavior
  1333. depends on the transmission type: enabled in live mode, disabled in file
  1334. mode.
  1335. @end table
  1336. For more information see: @url{https://github.com/Haivision/srt}.
  1337. @section srtp
  1338. Secure Real-time Transport Protocol.
  1339. The accepted options are:
  1340. @table @option
  1341. @item srtp_in_suite
  1342. @item srtp_out_suite
  1343. Select input and output encoding suites.
  1344. Supported values:
  1345. @table @samp
  1346. @item AES_CM_128_HMAC_SHA1_80
  1347. @item SRTP_AES128_CM_HMAC_SHA1_80
  1348. @item AES_CM_128_HMAC_SHA1_32
  1349. @item SRTP_AES128_CM_HMAC_SHA1_32
  1350. @end table
  1351. @item srtp_in_params
  1352. @item srtp_out_params
  1353. Set input and output encoding parameters, which are expressed by a
  1354. base64-encoded representation of a binary block. The first 16 bytes of
  1355. this binary block are used as master key, the following 14 bytes are
  1356. used as master salt.
  1357. @end table
  1358. @section subfile
  1359. Virtually extract a segment of a file or another stream.
  1360. The underlying stream must be seekable.
  1361. Accepted options:
  1362. @table @option
  1363. @item start
  1364. Start offset of the extracted segment, in bytes.
  1365. @item end
  1366. End offset of the extracted segment, in bytes.
  1367. If set to 0, extract till end of file.
  1368. @end table
  1369. Examples:
  1370. Extract a chapter from a DVD VOB file (start and end sectors obtained
  1371. externally and multiplied by 2048):
  1372. @example
  1373. subfile,,start,153391104,end,268142592,,:/media/dvd/VIDEO_TS/VTS_08_1.VOB
  1374. @end example
  1375. Play an AVI file directly from a TAR archive:
  1376. @example
  1377. subfile,,start,183241728,end,366490624,,:archive.tar
  1378. @end example
  1379. Play a MPEG-TS file from start offset till end:
  1380. @example
  1381. subfile,,start,32815239,end,0,,:video.ts
  1382. @end example
  1383. @section tee
  1384. Writes the output to multiple protocols. The individual outputs are separated
  1385. by |
  1386. @example
  1387. tee:file://path/to/local/this.avi|file://path/to/local/that.avi
  1388. @end example
  1389. @section tcp
  1390. Transmission Control Protocol.
  1391. The required syntax for a TCP url is:
  1392. @example
  1393. tcp://@var{hostname}:@var{port}[?@var{options}]
  1394. @end example
  1395. @var{options} contains a list of &-separated options of the form
  1396. @var{key}=@var{val}.
  1397. The list of supported options follows.
  1398. @table @option
  1399. @item listen=@var{2|1|0}
  1400. Listen for an incoming connection. 0 disables listen, 1 enables listen in
  1401. single client mode, 2 enables listen in multi-client mode. Default value is 0.
  1402. @item timeout=@var{microseconds}
  1403. Set raise error timeout, expressed in microseconds.
  1404. This option is only relevant in read mode: if no data arrived in more
  1405. than this time interval, raise error.
  1406. @item listen_timeout=@var{milliseconds}
  1407. Set listen timeout, expressed in milliseconds.
  1408. @item recv_buffer_size=@var{bytes}
  1409. Set receive buffer size, expressed bytes.
  1410. @item send_buffer_size=@var{bytes}
  1411. Set send buffer size, expressed bytes.
  1412. @item tcp_nodelay=@var{1|0}
  1413. Set TCP_NODELAY to disable Nagle's algorithm. Default value is 0.
  1414. @emph{Remark: Writing to the socket is currently not optimized to minimize system calls and reduces the efficiency / effect of TCP_NODELAY.}
  1415. @item tcp_mss=@var{bytes}
  1416. Set maximum segment size for outgoing TCP packets, expressed in bytes.
  1417. @end table
  1418. The following example shows how to setup a listening TCP connection
  1419. with @command{ffmpeg}, which is then accessed with @command{ffplay}:
  1420. @example
  1421. ffmpeg -i @var{input} -f @var{format} tcp://@var{hostname}:@var{port}?listen
  1422. ffplay tcp://@var{hostname}:@var{port}
  1423. @end example
  1424. @section tls
  1425. Transport Layer Security (TLS) / Secure Sockets Layer (SSL)
  1426. The required syntax for a TLS/SSL url is:
  1427. @example
  1428. tls://@var{hostname}:@var{port}[?@var{options}]
  1429. @end example
  1430. The following parameters can be set via command line options
  1431. (or in code via @code{AVOption}s):
  1432. @table @option
  1433. @item ca_file, cafile=@var{filename}
  1434. A file containing certificate authority (CA) root certificates to treat
  1435. as trusted. If the linked TLS library contains a default this might not
  1436. need to be specified for verification to work, but not all libraries and
  1437. setups have defaults built in.
  1438. The file must be in OpenSSL PEM format.
  1439. @item tls_verify=@var{1|0}
  1440. If enabled, try to verify the peer that we are communicating with.
  1441. Note, if using OpenSSL, this currently only makes sure that the
  1442. peer certificate is signed by one of the root certificates in the CA
  1443. database, but it does not validate that the certificate actually
  1444. matches the host name we are trying to connect to. (With other backends,
  1445. the host name is validated as well.)
  1446. This is disabled by default since it requires a CA database to be
  1447. provided by the caller in many cases.
  1448. @item cert_file, cert=@var{filename}
  1449. A file containing a certificate to use in the handshake with the peer.
  1450. (When operating as server, in listen mode, this is more often required
  1451. by the peer, while client certificates only are mandated in certain
  1452. setups.)
  1453. @item key_file, key=@var{filename}
  1454. A file containing the private key for the certificate.
  1455. @item listen=@var{1|0}
  1456. If enabled, listen for connections on the provided port, and assume
  1457. the server role in the handshake instead of the client role.
  1458. @item http_proxy
  1459. The HTTP proxy to tunnel through, e.g. @code{http://example.com:1234}.
  1460. The proxy must support the CONNECT method.
  1461. @end table
  1462. Example command lines:
  1463. To create a TLS/SSL server that serves an input stream.
  1464. @example
  1465. ffmpeg -i @var{input} -f @var{format} tls://@var{hostname}:@var{port}?listen&cert=@var{server.crt}&key=@var{server.key}
  1466. @end example
  1467. To play back a stream from the TLS/SSL server using @command{ffplay}:
  1468. @example
  1469. ffplay tls://@var{hostname}:@var{port}
  1470. @end example
  1471. @section udp
  1472. User Datagram Protocol.
  1473. The required syntax for an UDP URL is:
  1474. @example
  1475. udp://@var{hostname}:@var{port}[?@var{options}]
  1476. @end example
  1477. @var{options} contains a list of &-separated options of the form @var{key}=@var{val}.
  1478. In case threading is enabled on the system, a circular buffer is used
  1479. to store the incoming data, which allows one to reduce loss of data due to
  1480. UDP socket buffer overruns. The @var{fifo_size} and
  1481. @var{overrun_nonfatal} options are related to this buffer.
  1482. The list of supported options follows.
  1483. @table @option
  1484. @item buffer_size=@var{size}
  1485. Set the UDP maximum socket buffer size in bytes. This is used to set either
  1486. the receive or send buffer size, depending on what the socket is used for.
  1487. Default is 32 KB for output, 384 KB for input. See also @var{fifo_size}.
  1488. @item bitrate=@var{bitrate}
  1489. If set to nonzero, the output will have the specified constant bitrate if the
  1490. input has enough packets to sustain it.
  1491. @item burst_bits=@var{bits}
  1492. When using @var{bitrate} this specifies the maximum number of bits in
  1493. packet bursts.
  1494. @item localport=@var{port}
  1495. Override the local UDP port to bind with.
  1496. @item localaddr=@var{addr}
  1497. Local IP address of a network interface used for sending packets or joining
  1498. multicast groups.
  1499. @item pkt_size=@var{size}
  1500. Set the size in bytes of UDP packets.
  1501. @item reuse=@var{1|0}
  1502. Explicitly allow or disallow reusing UDP sockets.
  1503. @item ttl=@var{ttl}
  1504. Set the time to live value (for multicast only).
  1505. @item connect=@var{1|0}
  1506. Initialize the UDP socket with @code{connect()}. In this case, the
  1507. destination address can't be changed with ff_udp_set_remote_url later.
  1508. If the destination address isn't known at the start, this option can
  1509. be specified in ff_udp_set_remote_url, too.
  1510. This allows finding out the source address for the packets with getsockname,
  1511. and makes writes return with AVERROR(ECONNREFUSED) if "destination
  1512. unreachable" is received.
  1513. For receiving, this gives the benefit of only receiving packets from
  1514. the specified peer address/port.
  1515. @item sources=@var{address}[,@var{address}]
  1516. Only receive packets sent from the specified addresses. In case of multicast,
  1517. also subscribe to multicast traffic coming from these addresses only.
  1518. @item block=@var{address}[,@var{address}]
  1519. Ignore packets sent from the specified addresses. In case of multicast, also
  1520. exclude the source addresses in the multicast subscription.
  1521. @item fifo_size=@var{units}
  1522. Set the UDP receiving circular buffer size, expressed as a number of
  1523. packets with size of 188 bytes. If not specified defaults to 7*4096.
  1524. @item overrun_nonfatal=@var{1|0}
  1525. Survive in case of UDP receiving circular buffer overrun. Default
  1526. value is 0.
  1527. @item timeout=@var{microseconds}
  1528. Set raise error timeout, expressed in microseconds.
  1529. This option is only relevant in read mode: if no data arrived in more
  1530. than this time interval, raise error.
  1531. @item broadcast=@var{1|0}
  1532. Explicitly allow or disallow UDP broadcasting.
  1533. Note that broadcasting may not work properly on networks having
  1534. a broadcast storm protection.
  1535. @end table
  1536. @subsection Examples
  1537. @itemize
  1538. @item
  1539. Use @command{ffmpeg} to stream over UDP to a remote endpoint:
  1540. @example
  1541. ffmpeg -i @var{input} -f @var{format} udp://@var{hostname}:@var{port}
  1542. @end example
  1543. @item
  1544. Use @command{ffmpeg} to stream in mpegts format over UDP using 188
  1545. sized UDP packets, using a large input buffer:
  1546. @example
  1547. ffmpeg -i @var{input} -f mpegts udp://@var{hostname}:@var{port}?pkt_size=188&buffer_size=65535
  1548. @end example
  1549. @item
  1550. Use @command{ffmpeg} to receive over UDP from a remote endpoint:
  1551. @example
  1552. ffmpeg -i udp://[@var{multicast-address}]:@var{port} ...
  1553. @end example
  1554. @end itemize
  1555. @section unix
  1556. Unix local socket
  1557. The required syntax for a Unix socket URL is:
  1558. @example
  1559. unix://@var{filepath}
  1560. @end example
  1561. The following parameters can be set via command line options
  1562. (or in code via @code{AVOption}s):
  1563. @table @option
  1564. @item timeout
  1565. Timeout in ms.
  1566. @item listen
  1567. Create the Unix socket in listening mode.
  1568. @end table
  1569. @section zmq
  1570. ZeroMQ asynchronous messaging using the libzmq library.
  1571. This library supports unicast streaming to multiple clients without relying on
  1572. an external server.
  1573. The required syntax for streaming or connecting to a stream is:
  1574. @example
  1575. zmq:tcp://ip-address:port
  1576. @end example
  1577. Example:
  1578. Create a localhost stream on port 5555:
  1579. @example
  1580. ffmpeg -re -i input -f mpegts zmq:tcp://127.0.0.1:5555
  1581. @end example
  1582. Multiple clients may connect to the stream using:
  1583. @example
  1584. ffplay zmq:tcp://127.0.0.1:5555
  1585. @end example
  1586. Streaming to multiple clients is implemented using a ZeroMQ Pub-Sub pattern.
  1587. The server side binds to a port and publishes data. Clients connect to the
  1588. server (via IP address/port) and subscribe to the stream. The order in which
  1589. the server and client start generally does not matter.
  1590. ffmpeg must be compiled with the --enable-libzmq option to support
  1591. this protocol.
  1592. Options can be set on the @command{ffmpeg}/@command{ffplay} command
  1593. line. The following options are supported:
  1594. @table @option
  1595. @item pkt_size
  1596. Forces the maximum packet size for sending/receiving data. The default value is
  1597. 131,072 bytes. On the server side, this sets the maximum size of sent packets
  1598. via ZeroMQ. On the clients, it sets an internal buffer size for receiving
  1599. packets. Note that pkt_size on the clients should be equal to or greater than
  1600. pkt_size on the server. Otherwise the received message may be truncated causing
  1601. decoding errors.
  1602. @end table
  1603. @c man end PROTOCOLS