protocols.texi 63 KB

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