protocols.texi 51 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731
  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 async
  41. Asynchronous data filling wrapper for input stream.
  42. Fill data in a background thread, to decouple I/O operation from demux thread.
  43. @example
  44. async:@var{URL}
  45. async:http://host/resource
  46. async:cache:http://host/resource
  47. @end example
  48. @section bluray
  49. Read BluRay playlist.
  50. The accepted options are:
  51. @table @option
  52. @item angle
  53. BluRay angle
  54. @item chapter
  55. Start chapter (1...N)
  56. @item playlist
  57. Playlist to read (BDMV/PLAYLIST/?????.mpls)
  58. @end table
  59. Examples:
  60. Read longest playlist from BluRay mounted to /mnt/bluray:
  61. @example
  62. bluray:/mnt/bluray
  63. @end example
  64. Read angle 2 of playlist 4 from BluRay mounted to /mnt/bluray, start from chapter 2:
  65. @example
  66. -playlist 4 -angle 2 -chapter 2 bluray:/mnt/bluray
  67. @end example
  68. @section cache
  69. Caching wrapper for input stream.
  70. Cache the input stream to temporary file. It brings seeking capability to live streams.
  71. @example
  72. cache:@var{URL}
  73. @end example
  74. @section concat
  75. Physical concatenation protocol.
  76. Read and seek from many resources in sequence as if they were
  77. a unique resource.
  78. A URL accepted by this protocol has the syntax:
  79. @example
  80. concat:@var{URL1}|@var{URL2}|...|@var{URLN}
  81. @end example
  82. where @var{URL1}, @var{URL2}, ..., @var{URLN} are the urls of the
  83. resource to be concatenated, each one possibly specifying a distinct
  84. protocol.
  85. For example to read a sequence of files @file{split1.mpeg},
  86. @file{split2.mpeg}, @file{split3.mpeg} with @command{ffplay} use the
  87. command:
  88. @example
  89. ffplay concat:split1.mpeg\|split2.mpeg\|split3.mpeg
  90. @end example
  91. Note that you may need to escape the character "|" which is special for
  92. many shells.
  93. @section crypto
  94. AES-encrypted stream reading protocol.
  95. The accepted options are:
  96. @table @option
  97. @item key
  98. Set the AES decryption key binary block from given hexadecimal representation.
  99. @item iv
  100. Set the AES decryption initialization vector binary block from given hexadecimal representation.
  101. @end table
  102. Accepted URL formats:
  103. @example
  104. crypto:@var{URL}
  105. crypto+@var{URL}
  106. @end example
  107. @section data
  108. Data in-line in the URI. See @url{http://en.wikipedia.org/wiki/Data_URI_scheme}.
  109. For example, to convert a GIF file given inline with @command{ffmpeg}:
  110. @example
  111. ffmpeg -i "data:image/gif;base64,R0lGODdhCAAIAMIEAAAAAAAA//8AAP//AP///////////////ywAAAAACAAIAAADF0gEDLojDgdGiJdJqUX02iB4E8Q9jUMkADs=" smiley.png
  112. @end example
  113. @section file
  114. File access protocol.
  115. Read from or write to a file.
  116. A file URL can have the form:
  117. @example
  118. file:@var{filename}
  119. @end example
  120. where @var{filename} is the path of the file to read.
  121. An URL that does not have a protocol prefix will be assumed to be a
  122. file URL. Depending on the build, an URL that looks like a Windows
  123. path with the drive letter at the beginning will also be assumed to be
  124. a file URL (usually not the case in builds for unix-like systems).
  125. For example to read from a file @file{input.mpeg} with @command{ffmpeg}
  126. use the command:
  127. @example
  128. ffmpeg -i file:input.mpeg output.mpeg
  129. @end example
  130. This protocol accepts the following options:
  131. @table @option
  132. @item truncate
  133. Truncate existing files on write, if set to 1. A value of 0 prevents
  134. truncating. Default value is 1.
  135. @item blocksize
  136. Set I/O operation maximum block size, in bytes. Default value is
  137. @code{INT_MAX}, which results in not limiting the requested block size.
  138. Setting this value reasonably low improves user termination request reaction
  139. time, which is valuable for files on slow medium.
  140. @item follow
  141. If set to 1, the protocol will retry reading at the end of the file, allowing
  142. reading files that still are being written. In order for this to terminate,
  143. you either need to use the rw_timeout option, or use the interrupt callback
  144. (for API users).
  145. @item seekable
  146. Controls if seekability is advertised on the file. 0 means non-seekable, -1
  147. means auto (seekable for normal files, non-seekable for named pipes).
  148. Many demuxers handle seekable and non-seekable resources differently,
  149. overriding this might speed up opening certain files at the cost of losing some
  150. features (e.g. accurate seeking).
  151. @end table
  152. @section ftp
  153. FTP (File Transfer Protocol).
  154. Read from or write to remote resources using FTP protocol.
  155. Following syntax is required.
  156. @example
  157. ftp://[user[:password]@@]server[:port]/path/to/remote/resource.mpeg
  158. @end example
  159. This protocol accepts the following options.
  160. @table @option
  161. @item timeout
  162. Set timeout in microseconds of socket I/O operations used by the underlying low level
  163. operation. By default it is set to -1, which means that the timeout is
  164. not specified.
  165. @item ftp-anonymous-password
  166. Password used when login as anonymous user. Typically an e-mail address
  167. should be used.
  168. @item ftp-write-seekable
  169. Control seekability of connection during encoding. If set to 1 the
  170. resource is supposed to be seekable, if set to 0 it is assumed not
  171. to be seekable. Default value is 0.
  172. @end table
  173. NOTE: Protocol can be used as output, but it is recommended to not do
  174. it, unless special care is taken (tests, customized server configuration
  175. etc.). Different FTP servers behave in different way during seek
  176. operation. ff* tools may produce incomplete content due to server limitations.
  177. @section gopher
  178. Gopher protocol.
  179. @section hls
  180. Read Apple HTTP Live Streaming compliant segmented stream as
  181. a uniform one. The M3U8 playlists describing the segments can be
  182. remote HTTP resources or local files, accessed using the standard
  183. file protocol.
  184. The nested protocol is declared by specifying
  185. "+@var{proto}" after the hls URI scheme name, where @var{proto}
  186. is either "file" or "http".
  187. @example
  188. hls+http://host/path/to/remote/resource.m3u8
  189. hls+file://path/to/local/resource.m3u8
  190. @end example
  191. Using this protocol is discouraged - the hls demuxer should work
  192. just as well (if not, please report the issues) and is more complete.
  193. To use the hls demuxer instead, simply use the direct URLs to the
  194. m3u8 files.
  195. @section http
  196. HTTP (Hyper Text Transfer Protocol).
  197. This protocol accepts the following options:
  198. @table @option
  199. @item seekable
  200. Control seekability of connection. If set to 1 the resource is
  201. supposed to be seekable, if set to 0 it is assumed not to be seekable,
  202. if set to -1 it will try to autodetect if it is seekable. Default
  203. value is -1.
  204. @item chunked_post
  205. If set to 1 use chunked Transfer-Encoding for posts, default is 1.
  206. @item content_type
  207. Set a specific content type for the POST messages or for listen mode.
  208. @item http_proxy
  209. set HTTP proxy to tunnel through e.g. http://example.com:1234
  210. @item headers
  211. Set custom HTTP headers, can override built in default headers. The
  212. value must be a string encoding the headers.
  213. @item multiple_requests
  214. Use persistent connections if set to 1, default is 0.
  215. @item post_data
  216. Set custom HTTP post data.
  217. @item referer
  218. Set the Referer header. Include 'Referer: URL' header in HTTP request.
  219. @item user_agent
  220. Override the User-Agent header. If not specified the protocol will use a
  221. string describing the libavformat build. ("Lavf/<version>")
  222. @item user-agent
  223. This is a deprecated option, you can use user_agent instead it.
  224. @item timeout
  225. Set timeout in microseconds of socket I/O operations used by the underlying low level
  226. operation. By default it is set to -1, which means that the timeout is
  227. not specified.
  228. @item reconnect_at_eof
  229. If set then eof is treated like an error and causes reconnection, this is useful
  230. for live / endless streams.
  231. @item reconnect_streamed
  232. If set then even streamed/non seekable streams will be reconnected on errors.
  233. @item reconnect_delay_max
  234. Sets the maximum delay in seconds after which to give up reconnecting
  235. @item mime_type
  236. Export the MIME type.
  237. @item http_version
  238. Exports the HTTP response version number. Usually "1.0" or "1.1".
  239. @item icy
  240. If set to 1 request ICY (SHOUTcast) metadata from the server. If the server
  241. supports this, the metadata has to be retrieved by the application by reading
  242. the @option{icy_metadata_headers} and @option{icy_metadata_packet} options.
  243. The default is 1.
  244. @item icy_metadata_headers
  245. If the server supports ICY metadata, this contains the ICY-specific HTTP reply
  246. headers, separated by newline characters.
  247. @item icy_metadata_packet
  248. If the server supports ICY metadata, and @option{icy} was set to 1, this
  249. contains the last non-empty metadata packet sent by the server. It should be
  250. polled in regular intervals by applications interested in mid-stream metadata
  251. updates.
  252. @item cookies
  253. Set the cookies to be sent in future requests. The format of each cookie is the
  254. same as the value of a Set-Cookie HTTP response field. Multiple cookies can be
  255. delimited by a newline character.
  256. @item offset
  257. Set initial byte offset.
  258. @item end_offset
  259. Try to limit the request to bytes preceding this offset.
  260. @item method
  261. When used as a client option it sets the HTTP method for the request.
  262. When used as a server option it sets the HTTP method that is going to be
  263. expected from the client(s).
  264. If the expected and the received HTTP method do not match the client will
  265. be given a Bad Request response.
  266. When unset the HTTP method is not checked for now. This will be replaced by
  267. autodetection in the future.
  268. @item listen
  269. If set to 1 enables experimental HTTP server. This can be used to send data when
  270. used as an output option, or read data from a client with HTTP POST when used as
  271. an input option.
  272. If set to 2 enables experimental multi-client HTTP server. This is not yet implemented
  273. in ffmpeg.c and thus must not be used as a command line option.
  274. @example
  275. # Server side (sending):
  276. ffmpeg -i somefile.ogg -c copy -listen 1 -f ogg http://@var{server}:@var{port}
  277. # Client side (receiving):
  278. ffmpeg -i http://@var{server}:@var{port} -c copy somefile.ogg
  279. # Client can also be done with wget:
  280. wget http://@var{server}:@var{port} -O somefile.ogg
  281. # Server side (receiving):
  282. ffmpeg -listen 1 -i http://@var{server}:@var{port} -c copy somefile.ogg
  283. # Client side (sending):
  284. ffmpeg -i somefile.ogg -chunked_post 0 -c copy -f ogg http://@var{server}:@var{port}
  285. # Client can also be done with wget:
  286. wget --post-file=somefile.ogg http://@var{server}:@var{port}
  287. @end example
  288. @item send_expect_100
  289. Send an Expect: 100-continue header for POST. If set to 1 it will send, if set
  290. to 0 it won't, if set to -1 it will try to send if it is applicable. Default
  291. value is -1.
  292. @end table
  293. @subsection HTTP Cookies
  294. Some HTTP requests will be denied unless cookie values are passed in with the
  295. request. The @option{cookies} option allows these cookies to be specified. At
  296. the very least, each cookie must specify a value along with a path and domain.
  297. HTTP requests that match both the domain and path will automatically include the
  298. cookie value in the HTTP Cookie header field. Multiple cookies can be delimited
  299. by a newline.
  300. The required syntax to play a stream specifying a cookie is:
  301. @example
  302. ffplay -cookies "nlqptid=nltid=tsn; path=/; domain=somedomain.com;" http://somedomain.com/somestream.m3u8
  303. @end example
  304. @section Icecast
  305. Icecast protocol (stream to Icecast servers)
  306. This protocol accepts the following options:
  307. @table @option
  308. @item ice_genre
  309. Set the stream genre.
  310. @item ice_name
  311. Set the stream name.
  312. @item ice_description
  313. Set the stream description.
  314. @item ice_url
  315. Set the stream website URL.
  316. @item ice_public
  317. Set if the stream should be public.
  318. The default is 0 (not public).
  319. @item user_agent
  320. Override the User-Agent header. If not specified a string of the form
  321. "Lavf/<version>" will be used.
  322. @item password
  323. Set the Icecast mountpoint password.
  324. @item content_type
  325. Set the stream content type. This must be set if it is different from
  326. audio/mpeg.
  327. @item legacy_icecast
  328. This enables support for Icecast versions < 2.4.0, that do not support the
  329. HTTP PUT method but the SOURCE method.
  330. @end table
  331. @example
  332. icecast://[@var{username}[:@var{password}]@@]@var{server}:@var{port}/@var{mountpoint}
  333. @end example
  334. @section mmst
  335. MMS (Microsoft Media Server) protocol over TCP.
  336. @section mmsh
  337. MMS (Microsoft Media Server) protocol over HTTP.
  338. The required syntax is:
  339. @example
  340. mmsh://@var{server}[:@var{port}][/@var{app}][/@var{playpath}]
  341. @end example
  342. @section md5
  343. MD5 output protocol.
  344. Computes the MD5 hash of the data to be written, and on close writes
  345. this to the designated output or stdout if none is specified. It can
  346. be used to test muxers without writing an actual file.
  347. Some examples follow.
  348. @example
  349. # Write the MD5 hash of the encoded AVI file to the file output.avi.md5.
  350. ffmpeg -i input.flv -f avi -y md5:output.avi.md5
  351. # Write the MD5 hash of the encoded AVI file to stdout.
  352. ffmpeg -i input.flv -f avi -y md5:
  353. @end example
  354. Note that some formats (typically MOV) require the output protocol to
  355. be seekable, so they will fail with the MD5 output protocol.
  356. @section pipe
  357. UNIX pipe access protocol.
  358. Read and write from UNIX pipes.
  359. The accepted syntax is:
  360. @example
  361. pipe:[@var{number}]
  362. @end example
  363. @var{number} is the number corresponding to the file descriptor of the
  364. pipe (e.g. 0 for stdin, 1 for stdout, 2 for stderr). If @var{number}
  365. is not specified, by default the stdout file descriptor will be used
  366. for writing, stdin for reading.
  367. For example to read from stdin with @command{ffmpeg}:
  368. @example
  369. cat test.wav | ffmpeg -i pipe:0
  370. # ...this is the same as...
  371. cat test.wav | ffmpeg -i pipe:
  372. @end example
  373. For writing to stdout with @command{ffmpeg}:
  374. @example
  375. ffmpeg -i test.wav -f avi pipe:1 | cat > test.avi
  376. # ...this is the same as...
  377. ffmpeg -i test.wav -f avi pipe: | cat > test.avi
  378. @end example
  379. This protocol accepts the following options:
  380. @table @option
  381. @item blocksize
  382. Set I/O operation maximum block size, in bytes. Default value is
  383. @code{INT_MAX}, which results in not limiting the requested block size.
  384. Setting this value reasonably low improves user termination request reaction
  385. time, which is valuable if data transmission is slow.
  386. @end table
  387. Note that some formats (typically MOV), require the output protocol to
  388. be seekable, so they will fail with the pipe output protocol.
  389. @section prompeg
  390. Pro-MPEG Code of Practice #3 Release 2 FEC protocol.
  391. The Pro-MPEG CoP#3 FEC is a 2D parity-check forward error correction mechanism
  392. for MPEG-2 Transport Streams sent over RTP.
  393. This protocol must be used in conjunction with the @code{rtp_mpegts} muxer and
  394. the @code{rtp} protocol.
  395. The required syntax is:
  396. @example
  397. -f rtp_mpegts -fec prompeg=@var{option}=@var{val}... rtp://@var{hostname}:@var{port}
  398. @end example
  399. The destination UDP ports are @code{port + 2} for the column FEC stream
  400. and @code{port + 4} for the row FEC stream.
  401. This protocol accepts the following options:
  402. @table @option
  403. @item l=@var{n}
  404. The number of columns (4-20, LxD <= 100)
  405. @item d=@var{n}
  406. The number of rows (4-20, LxD <= 100)
  407. @end table
  408. Example usage:
  409. @example
  410. -f rtp_mpegts -fec prompeg=l=8:d=4 rtp://@var{hostname}:@var{port}
  411. @end example
  412. @section rtmp
  413. Real-Time Messaging Protocol.
  414. The Real-Time Messaging Protocol (RTMP) is used for streaming multimedia
  415. content across a TCP/IP network.
  416. The required syntax is:
  417. @example
  418. rtmp://[@var{username}:@var{password}@@]@var{server}[:@var{port}][/@var{app}][/@var{instance}][/@var{playpath}]
  419. @end example
  420. The accepted parameters are:
  421. @table @option
  422. @item username
  423. An optional username (mostly for publishing).
  424. @item password
  425. An optional password (mostly for publishing).
  426. @item server
  427. The address of the RTMP server.
  428. @item port
  429. The number of the TCP port to use (by default is 1935).
  430. @item app
  431. It is the name of the application to access. It usually corresponds to
  432. the path where the application is installed on the RTMP server
  433. (e.g. @file{/ondemand/}, @file{/flash/live/}, etc.). You can override
  434. the value parsed from the URI through the @code{rtmp_app} option, too.
  435. @item playpath
  436. It is the path or name of the resource to play with reference to the
  437. application specified in @var{app}, may be prefixed by "mp4:". You
  438. can override the value parsed from the URI through the @code{rtmp_playpath}
  439. option, too.
  440. @item listen
  441. Act as a server, listening for an incoming connection.
  442. @item timeout
  443. Maximum time to wait for the incoming connection. Implies listen.
  444. @end table
  445. Additionally, the following parameters can be set via command line options
  446. (or in code via @code{AVOption}s):
  447. @table @option
  448. @item rtmp_app
  449. Name of application to connect on the RTMP server. This option
  450. overrides the parameter specified in the URI.
  451. @item rtmp_buffer
  452. Set the client buffer time in milliseconds. The default is 3000.
  453. @item rtmp_conn
  454. Extra arbitrary AMF connection parameters, parsed from a string,
  455. e.g. like @code{B:1 S:authMe O:1 NN:code:1.23 NS:flag:ok O:0}.
  456. Each value is prefixed by a single character denoting the type,
  457. B for Boolean, N for number, S for string, O for object, or Z for null,
  458. followed by a colon. For Booleans the data must be either 0 or 1 for
  459. FALSE or TRUE, respectively. Likewise for Objects the data must be 0 or
  460. 1 to end or begin an object, respectively. Data items in subobjects may
  461. be named, by prefixing the type with 'N' and specifying the name before
  462. the value (i.e. @code{NB:myFlag:1}). This option may be used multiple
  463. times to construct arbitrary AMF sequences.
  464. @item rtmp_flashver
  465. Version of the Flash plugin used to run the SWF player. The default
  466. is LNX 9,0,124,2. (When publishing, the default is FMLE/3.0 (compatible;
  467. <libavformat version>).)
  468. @item rtmp_flush_interval
  469. Number of packets flushed in the same request (RTMPT only). The default
  470. is 10.
  471. @item rtmp_live
  472. Specify that the media is a live stream. No resuming or seeking in
  473. live streams is possible. The default value is @code{any}, which means the
  474. subscriber first tries to play the live stream specified in the
  475. playpath. If a live stream of that name is not found, it plays the
  476. recorded stream. The other possible values are @code{live} and
  477. @code{recorded}.
  478. @item rtmp_pageurl
  479. URL of the web page in which the media was embedded. By default no
  480. value will be sent.
  481. @item rtmp_playpath
  482. Stream identifier to play or to publish. This option overrides the
  483. parameter specified in the URI.
  484. @item rtmp_subscribe
  485. Name of live stream to subscribe to. By default no value will be sent.
  486. It is only sent if the option is specified or if rtmp_live
  487. is set to live.
  488. @item rtmp_swfhash
  489. SHA256 hash of the decompressed SWF file (32 bytes).
  490. @item rtmp_swfsize
  491. Size of the decompressed SWF file, required for SWFVerification.
  492. @item rtmp_swfurl
  493. URL of the SWF player for the media. By default no value will be sent.
  494. @item rtmp_swfverify
  495. URL to player swf file, compute hash/size automatically.
  496. @item rtmp_tcurl
  497. URL of the target stream. Defaults to proto://host[:port]/app.
  498. @end table
  499. For example to read with @command{ffplay} a multimedia resource named
  500. "sample" from the application "vod" from an RTMP server "myserver":
  501. @example
  502. ffplay rtmp://myserver/vod/sample
  503. @end example
  504. To publish to a password protected server, passing the playpath and
  505. app names separately:
  506. @example
  507. ffmpeg -re -i <input> -f flv -rtmp_playpath some/long/path -rtmp_app long/app/name rtmp://username:password@@myserver/
  508. @end example
  509. @section rtmpe
  510. Encrypted Real-Time Messaging Protocol.
  511. The Encrypted Real-Time Messaging Protocol (RTMPE) is used for
  512. streaming multimedia content within standard cryptographic primitives,
  513. consisting of Diffie-Hellman key exchange and HMACSHA256, generating
  514. a pair of RC4 keys.
  515. @section rtmps
  516. Real-Time Messaging Protocol over a secure SSL connection.
  517. The Real-Time Messaging Protocol (RTMPS) is used for streaming
  518. multimedia content across an encrypted connection.
  519. @section rtmpt
  520. Real-Time Messaging Protocol tunneled through HTTP.
  521. The Real-Time Messaging Protocol tunneled through HTTP (RTMPT) is used
  522. for streaming multimedia content within HTTP requests to traverse
  523. firewalls.
  524. @section rtmpte
  525. Encrypted Real-Time Messaging Protocol tunneled through HTTP.
  526. The Encrypted Real-Time Messaging Protocol tunneled through HTTP (RTMPTE)
  527. is used for streaming multimedia content within HTTP requests to traverse
  528. firewalls.
  529. @section rtmpts
  530. Real-Time Messaging Protocol tunneled through HTTPS.
  531. The Real-Time Messaging Protocol tunneled through HTTPS (RTMPTS) is used
  532. for streaming multimedia content within HTTPS requests to traverse
  533. firewalls.
  534. @section libsmbclient
  535. libsmbclient permits one to manipulate CIFS/SMB network resources.
  536. Following syntax is required.
  537. @example
  538. smb://[[domain:]user[:password@@]]server[/share[/path[/file]]]
  539. @end example
  540. This protocol accepts the following options.
  541. @table @option
  542. @item timeout
  543. Set timeout in milliseconds of socket I/O operations used by the underlying
  544. low level operation. By default it is set to -1, which means that the timeout
  545. is not specified.
  546. @item truncate
  547. Truncate existing files on write, if set to 1. A value of 0 prevents
  548. truncating. Default value is 1.
  549. @item workgroup
  550. Set the workgroup used for making connections. By default workgroup is not specified.
  551. @end table
  552. For more information see: @url{http://www.samba.org/}.
  553. @section libssh
  554. Secure File Transfer Protocol via libssh
  555. Read from or write to remote resources using SFTP protocol.
  556. Following syntax is required.
  557. @example
  558. sftp://[user[:password]@@]server[:port]/path/to/remote/resource.mpeg
  559. @end example
  560. This protocol accepts the following options.
  561. @table @option
  562. @item timeout
  563. Set timeout of socket I/O operations used by the underlying low level
  564. operation. By default it is set to -1, which means that the timeout
  565. is not specified.
  566. @item truncate
  567. Truncate existing files on write, if set to 1. A value of 0 prevents
  568. truncating. Default value is 1.
  569. @item private_key
  570. Specify the path of the file containing private key to use during authorization.
  571. By default libssh searches for keys in the @file{~/.ssh/} directory.
  572. @end table
  573. Example: Play a file stored on remote server.
  574. @example
  575. ffplay sftp://user:password@@server_address:22/home/user/resource.mpeg
  576. @end example
  577. @section librtmp rtmp, rtmpe, rtmps, rtmpt, rtmpte
  578. Real-Time Messaging Protocol and its variants supported through
  579. librtmp.
  580. Requires the presence of the librtmp headers and library during
  581. configuration. You need to explicitly configure the build with
  582. "--enable-librtmp". If enabled this will replace the native RTMP
  583. protocol.
  584. This protocol provides most client functions and a few server
  585. functions needed to support RTMP, RTMP tunneled in HTTP (RTMPT),
  586. encrypted RTMP (RTMPE), RTMP over SSL/TLS (RTMPS) and tunneled
  587. variants of these encrypted types (RTMPTE, RTMPTS).
  588. The required syntax is:
  589. @example
  590. @var{rtmp_proto}://@var{server}[:@var{port}][/@var{app}][/@var{playpath}] @var{options}
  591. @end example
  592. where @var{rtmp_proto} is one of the strings "rtmp", "rtmpt", "rtmpe",
  593. "rtmps", "rtmpte", "rtmpts" corresponding to each RTMP variant, and
  594. @var{server}, @var{port}, @var{app} and @var{playpath} have the same
  595. meaning as specified for the RTMP native protocol.
  596. @var{options} contains a list of space-separated options of the form
  597. @var{key}=@var{val}.
  598. See the librtmp manual page (man 3 librtmp) for more information.
  599. For example, to stream a file in real-time to an RTMP server using
  600. @command{ffmpeg}:
  601. @example
  602. ffmpeg -re -i myfile -f flv rtmp://myserver/live/mystream
  603. @end example
  604. To play the same stream using @command{ffplay}:
  605. @example
  606. ffplay "rtmp://myserver/live/mystream live=1"
  607. @end example
  608. @section rtp
  609. Real-time Transport Protocol.
  610. The required syntax for an RTP URL is:
  611. rtp://@var{hostname}[:@var{port}][?@var{option}=@var{val}...]
  612. @var{port} specifies the RTP port to use.
  613. The following URL options are supported:
  614. @table @option
  615. @item ttl=@var{n}
  616. Set the TTL (Time-To-Live) value (for multicast only).
  617. @item rtcpport=@var{n}
  618. Set the remote RTCP port to @var{n}.
  619. @item localrtpport=@var{n}
  620. Set the local RTP port to @var{n}.
  621. @item localrtcpport=@var{n}'
  622. Set the local RTCP port to @var{n}.
  623. @item pkt_size=@var{n}
  624. Set max packet size (in bytes) to @var{n}.
  625. @item connect=0|1
  626. Do a @code{connect()} on the UDP socket (if set to 1) or not (if set
  627. to 0).
  628. @item sources=@var{ip}[,@var{ip}]
  629. List allowed source IP addresses.
  630. @item block=@var{ip}[,@var{ip}]
  631. List disallowed (blocked) source IP addresses.
  632. @item write_to_source=0|1
  633. Send packets to the source address of the latest received packet (if
  634. set to 1) or to a default remote address (if set to 0).
  635. @item localport=@var{n}
  636. Set the local RTP port to @var{n}.
  637. This is a deprecated option. Instead, @option{localrtpport} should be
  638. used.
  639. @end table
  640. Important notes:
  641. @enumerate
  642. @item
  643. If @option{rtcpport} is not set the RTCP port will be set to the RTP
  644. port value plus 1.
  645. @item
  646. If @option{localrtpport} (the local RTP port) is not set any available
  647. port will be used for the local RTP and RTCP ports.
  648. @item
  649. If @option{localrtcpport} (the local RTCP port) is not set it will be
  650. set to the local RTP port value plus 1.
  651. @end enumerate
  652. @section rtsp
  653. Real-Time Streaming Protocol.
  654. RTSP is not technically a protocol handler in libavformat, it is a demuxer
  655. and muxer. The demuxer supports both normal RTSP (with data transferred
  656. over RTP; this is used by e.g. Apple and Microsoft) and Real-RTSP (with
  657. data transferred over RDT).
  658. The muxer can be used to send a stream using RTSP ANNOUNCE to a server
  659. supporting it (currently Darwin Streaming Server and Mischa Spiegelmock's
  660. @uref{https://github.com/revmischa/rtsp-server, RTSP server}).
  661. The required syntax for a RTSP url is:
  662. @example
  663. rtsp://@var{hostname}[:@var{port}]/@var{path}
  664. @end example
  665. Options can be set on the @command{ffmpeg}/@command{ffplay} command
  666. line, or set in code via @code{AVOption}s or in
  667. @code{avformat_open_input}.
  668. The following options are supported.
  669. @table @option
  670. @item initial_pause
  671. Do not start playing the stream immediately if set to 1. Default value
  672. is 0.
  673. @item rtsp_transport
  674. Set RTSP transport protocols.
  675. It accepts the following values:
  676. @table @samp
  677. @item udp
  678. Use UDP as lower transport protocol.
  679. @item tcp
  680. Use TCP (interleaving within the RTSP control channel) as lower
  681. transport protocol.
  682. @item udp_multicast
  683. Use UDP multicast as lower transport protocol.
  684. @item http
  685. Use HTTP tunneling as lower transport protocol, which is useful for
  686. passing proxies.
  687. @end table
  688. Multiple lower transport protocols may be specified, in that case they are
  689. tried one at a time (if the setup of one fails, the next one is tried).
  690. For the muxer, only the @samp{tcp} and @samp{udp} options are supported.
  691. @item rtsp_flags
  692. Set RTSP flags.
  693. The following values are accepted:
  694. @table @samp
  695. @item filter_src
  696. Accept packets only from negotiated peer address and port.
  697. @item listen
  698. Act as a server, listening for an incoming connection.
  699. @item prefer_tcp
  700. Try TCP for RTP transport first, if TCP is available as RTSP RTP transport.
  701. @end table
  702. Default value is @samp{none}.
  703. @item allowed_media_types
  704. Set media types to accept from the server.
  705. The following flags are accepted:
  706. @table @samp
  707. @item video
  708. @item audio
  709. @item data
  710. @end table
  711. By default it accepts all media types.
  712. @item min_port
  713. Set minimum local UDP port. Default value is 5000.
  714. @item max_port
  715. Set maximum local UDP port. Default value is 65000.
  716. @item timeout
  717. Set maximum timeout (in seconds) to wait for incoming connections.
  718. A value of -1 means infinite (default). This option implies the
  719. @option{rtsp_flags} set to @samp{listen}.
  720. @item reorder_queue_size
  721. Set number of packets to buffer for handling of reordered packets.
  722. @item stimeout
  723. Set socket TCP I/O timeout in microseconds.
  724. @item user-agent
  725. Override User-Agent header. If not specified, it defaults to the
  726. libavformat identifier string.
  727. @end table
  728. When receiving data over UDP, the demuxer tries to reorder received packets
  729. (since they may arrive out of order, or packets may get lost totally). This
  730. can be disabled by setting the maximum demuxing delay to zero (via
  731. the @code{max_delay} field of AVFormatContext).
  732. When watching multi-bitrate Real-RTSP streams with @command{ffplay}, the
  733. streams to display can be chosen with @code{-vst} @var{n} and
  734. @code{-ast} @var{n} for video and audio respectively, and can be switched
  735. on the fly by pressing @code{v} and @code{a}.
  736. @subsection Examples
  737. The following examples all make use of the @command{ffplay} and
  738. @command{ffmpeg} tools.
  739. @itemize
  740. @item
  741. Watch a stream over UDP, with a max reordering delay of 0.5 seconds:
  742. @example
  743. ffplay -max_delay 500000 -rtsp_transport udp rtsp://server/video.mp4
  744. @end example
  745. @item
  746. Watch a stream tunneled over HTTP:
  747. @example
  748. ffplay -rtsp_transport http rtsp://server/video.mp4
  749. @end example
  750. @item
  751. Send a stream in realtime to a RTSP server, for others to watch:
  752. @example
  753. ffmpeg -re -i @var{input} -f rtsp -muxdelay 0.1 rtsp://server/live.sdp
  754. @end example
  755. @item
  756. Receive a stream in realtime:
  757. @example
  758. ffmpeg -rtsp_flags listen -i rtsp://ownaddress/live.sdp @var{output}
  759. @end example
  760. @end itemize
  761. @section sap
  762. Session Announcement Protocol (RFC 2974). This is not technically a
  763. protocol handler in libavformat, it is a muxer and demuxer.
  764. It is used for signalling of RTP streams, by announcing the SDP for the
  765. streams regularly on a separate port.
  766. @subsection Muxer
  767. The syntax for a SAP url given to the muxer is:
  768. @example
  769. sap://@var{destination}[:@var{port}][?@var{options}]
  770. @end example
  771. The RTP packets are sent to @var{destination} on port @var{port},
  772. or to port 5004 if no port is specified.
  773. @var{options} is a @code{&}-separated list. The following options
  774. are supported:
  775. @table @option
  776. @item announce_addr=@var{address}
  777. Specify the destination IP address for sending the announcements to.
  778. If omitted, the announcements are sent to the commonly used SAP
  779. announcement multicast address 224.2.127.254 (sap.mcast.net), or
  780. ff0e::2:7ffe if @var{destination} is an IPv6 address.
  781. @item announce_port=@var{port}
  782. Specify the port to send the announcements on, defaults to
  783. 9875 if not specified.
  784. @item ttl=@var{ttl}
  785. Specify the time to live value for the announcements and RTP packets,
  786. defaults to 255.
  787. @item same_port=@var{0|1}
  788. If set to 1, send all RTP streams on the same port pair. If zero (the
  789. default), all streams are sent on unique ports, with each stream on a
  790. port 2 numbers higher than the previous.
  791. VLC/Live555 requires this to be set to 1, to be able to receive the stream.
  792. The RTP stack in libavformat for receiving requires all streams to be sent
  793. on unique ports.
  794. @end table
  795. Example command lines follow.
  796. To broadcast a stream on the local subnet, for watching in VLC:
  797. @example
  798. ffmpeg -re -i @var{input} -f sap sap://224.0.0.255?same_port=1
  799. @end example
  800. Similarly, for watching in @command{ffplay}:
  801. @example
  802. ffmpeg -re -i @var{input} -f sap sap://224.0.0.255
  803. @end example
  804. And for watching in @command{ffplay}, over IPv6:
  805. @example
  806. ffmpeg -re -i @var{input} -f sap sap://[ff0e::1:2:3:4]
  807. @end example
  808. @subsection Demuxer
  809. The syntax for a SAP url given to the demuxer is:
  810. @example
  811. sap://[@var{address}][:@var{port}]
  812. @end example
  813. @var{address} is the multicast address to listen for announcements on,
  814. if omitted, the default 224.2.127.254 (sap.mcast.net) is used. @var{port}
  815. is the port that is listened on, 9875 if omitted.
  816. The demuxers listens for announcements on the given address and port.
  817. Once an announcement is received, it tries to receive that particular stream.
  818. Example command lines follow.
  819. To play back the first stream announced on the normal SAP multicast address:
  820. @example
  821. ffplay sap://
  822. @end example
  823. To play back the first stream announced on one the default IPv6 SAP multicast address:
  824. @example
  825. ffplay sap://[ff0e::2:7ffe]
  826. @end example
  827. @section sctp
  828. Stream Control Transmission Protocol.
  829. The accepted URL syntax is:
  830. @example
  831. sctp://@var{host}:@var{port}[?@var{options}]
  832. @end example
  833. The protocol accepts the following options:
  834. @table @option
  835. @item listen
  836. If set to any value, listen for an incoming connection. Outgoing connection is done by default.
  837. @item max_streams
  838. Set the maximum number of streams. By default no limit is set.
  839. @end table
  840. @section srt
  841. Haivision Secure Reliable Transport Protocol via libsrt.
  842. The supported syntax for a SRT URL is:
  843. @example
  844. srt://@var{hostname}:@var{port}[?@var{options}]
  845. @end example
  846. @var{options} contains a list of &-separated options of the form
  847. @var{key}=@var{val}.
  848. or
  849. @example
  850. @var{options} srt://@var{hostname}:@var{port}
  851. @end example
  852. @var{options} contains a list of '-@var{key} @var{val}'
  853. options.
  854. This protocol accepts the following options.
  855. @table @option
  856. @item connect_timeout
  857. Connection timeout; SRT cannot connect for RTT > 1500 msec
  858. (2 handshake exchanges) with the default connect timeout of
  859. 3 seconds. This option applies to the caller and rendezvous
  860. connection modes. The connect timeout is 10 times the value
  861. set for the rendezvous mode (which can be used as a
  862. workaround for this connection problem with earlier versions).
  863. @item ffs=@var{bytes}
  864. Flight Flag Size (Window Size), in bytes. FFS is actually an
  865. internal parameter and you should set it to not less than
  866. @option{recv_buffer_size} and @option{mss}. The default value
  867. is relatively large, therefore unless you set a very large receiver buffer,
  868. you do not need to change this option. Default value is 25600.
  869. @item inputbw=@var{bytes/seconds}
  870. Sender nominal input rate, in bytes per seconds. Used along with
  871. @option{oheadbw}, when @option{maxbw} is set to relative (0), to
  872. calculate maximum sending rate when recovery packets are sent
  873. along with the main media stream:
  874. @option{inputbw} * (100 + @option{oheadbw}) / 100
  875. if @option{inputbw} is not set while @option{maxbw} is set to
  876. relative (0), the actual input rate is evaluated inside
  877. the library. Default value is 0.
  878. @item iptos=@var{tos}
  879. IP Type of Service. Applies to sender only. Default value is 0xB8.
  880. @item ipttl=@var{ttl}
  881. IP Time To Live. Applies to sender only. Default value is 64.
  882. @item latency
  883. Timestamp-based Packet Delivery Delay.
  884. Used to absorb bursts of missed packet retransmissions.
  885. This flag sets both @option{rcvlatency} and @option{peerlatency}
  886. to the same value. Note that prior to version 1.3.0
  887. this is the only flag to set the latency, however
  888. this is effectively equivalent to setting @option{peerlatency},
  889. when side is sender and @option{rcvlatency}
  890. when side is receiver, and the bidirectional stream
  891. sending is not supported.
  892. @item listen_timeout
  893. Set socket listen timeout.
  894. @item maxbw=@var{bytes/seconds}
  895. Maximum sending bandwidth, in bytes per seconds.
  896. -1 infinite (CSRTCC limit is 30mbps)
  897. 0 relative to input rate (see @option{inputbw})
  898. >0 absolute limit value
  899. Default value is 0 (relative)
  900. @item mode=@var{caller|listener|rendezvous}
  901. Connection mode.
  902. @option{caller} opens client connection.
  903. @option{listener} starts server to listen for incoming connections.
  904. @option{rendezvous} use Rendez-Vous connection mode.
  905. Default value is caller.
  906. @item mss=@var{bytes}
  907. Maximum Segment Size, in bytes. Used for buffer allocation
  908. and rate calculation using a packet counter assuming fully
  909. filled packets. The smallest MSS between the peers is
  910. used. This is 1500 by default in the overall internet.
  911. This is the maximum size of the UDP packet and can be
  912. only decreased, unless you have some unusual dedicated
  913. network settings. Default value is 1500.
  914. @item nakreport=@var{1|0}
  915. If set to 1, Receiver will send `UMSG_LOSSREPORT` messages
  916. periodically until a lost packet is retransmitted or
  917. intentionally dropped. Default value is 1.
  918. @item oheadbw=@var{percents}
  919. Recovery bandwidth overhead above input rate, in percents.
  920. See @option{inputbw}. Default value is 25%.
  921. @item passphrase=@var{string}
  922. HaiCrypt Encryption/Decryption Passphrase string, length
  923. from 10 to 79 characters. The passphrase is the shared
  924. secret between the sender and the receiver. It is used
  925. to generate the Key Encrypting Key using PBKDF2
  926. (Password-Based Key Derivation Function). It is used
  927. only if @option{pbkeylen} is non-zero. It is used on
  928. the receiver only if the received data is encrypted.
  929. The configured passphrase cannot be recovered (write-only).
  930. @item payload_size=@var{bytes}
  931. Sets the maximum declared size of a packet transferred
  932. during the single call to the sending function in Live
  933. mode. Use 0 if this value isn't used (which is default in
  934. file mode).
  935. Default is -1 (automatic), which typically means MPEG-TS;
  936. if you are going to use SRT
  937. to send any different kind of payload, such as, for example,
  938. wrapping a live stream in very small frames, then you can
  939. use a bigger maximum frame size, though not greater than
  940. 1456 bytes.
  941. @item pkt_size=@var{bytes}
  942. Alias for @samp{payload_size}.
  943. @item peerlatency
  944. The latency value (as described in @option{rcvlatency}) that is
  945. set by the sender side as a minimum value for the receiver.
  946. @item pbkeylen=@var{bytes}
  947. Sender encryption key length, in bytes.
  948. Only can be set to 0, 16, 24 and 32.
  949. Enable sender encryption if not 0.
  950. Not required on receiver (set to 0),
  951. key size obtained from sender in HaiCrypt handshake.
  952. Default value is 0.
  953. @item rcvlatency
  954. The time that should elapse since the moment when the
  955. packet was sent and the moment when it's delivered to
  956. the receiver application in the receiving function.
  957. This time should be a buffer time large enough to cover
  958. the time spent for sending, unexpectedly extended RTT
  959. time, and the time needed to retransmit the lost UDP
  960. packet. The effective latency value will be the maximum
  961. of this options' value and the value of @option{peerlatency}
  962. set by the peer side. Before version 1.3.0 this option
  963. is only available as @option{latency}.
  964. @item recv_buffer_size=@var{bytes}
  965. Set UDP receive buffer size, expressed in bytes.
  966. @item send_buffer_size=@var{bytes}
  967. Set UDP send buffer size, expressed in bytes.
  968. @item rw_timeout
  969. Set raise error timeout for read/write optations.
  970. This option is only relevant in read mode:
  971. if no data arrived in more than this time
  972. interval, raise error.
  973. @item tlpktdrop=@var{1|0}
  974. Too-late Packet Drop. When enabled on receiver, it skips
  975. missing packets that have not been delivered in time and
  976. delivers the following packets to the application when
  977. their time-to-play has come. It also sends a fake ACK to
  978. the sender. When enabled on sender and enabled on the
  979. receiving peer, the sender drops the older packets that
  980. have no chance of being delivered in time. It was
  981. automatically enabled in the sender if the receiver
  982. supports it.
  983. @item sndbuf=@var{bytes}
  984. Set send buffer size, expressed in bytes.
  985. @item rcvbuf=@var{bytes}
  986. Set receive buffer size, expressed in bytes.
  987. Receive buffer must not be greater than @option{ffs}.
  988. @item lossmaxttl=@var{packets}
  989. The value up to which the Reorder Tolerance may grow. When
  990. Reorder Tolerance is > 0, then packet loss report is delayed
  991. until that number of packets come in. Reorder Tolerance
  992. increases every time a "belated" packet has come, but it
  993. wasn't due to retransmission (that is, when UDP packets tend
  994. to come out of order), with the difference between the latest
  995. sequence and this packet's sequence, and not more than the
  996. value of this option. By default it's 0, which means that this
  997. mechanism is turned off, and the loss report is always sent
  998. immediately upon experiencing a "gap" in sequences.
  999. @item minversion
  1000. The minimum SRT version that is required from the peer. A connection
  1001. to a peer that does not satisfy the minimum version requirement
  1002. will be rejected.
  1003. The version format in hex is 0xXXYYZZ for x.y.z in human readable
  1004. form.
  1005. @item streamid=@var{string}
  1006. A string limited to 512 characters that can be set on the socket prior
  1007. to connecting. This stream ID will be able to be retrieved by the
  1008. listener side from the socket that is returned from srt_accept and
  1009. was connected by a socket with that set stream ID. SRT does not enforce
  1010. any special interpretation of the contents of this string.
  1011. This option doesn’t make sense in Rendezvous connection; the result
  1012. might be that simply one side will override the value from the other
  1013. side and it’s the matter of luck which one would win
  1014. @item smoother=@var{live|file}
  1015. The type of Smoother used for the transmission for that socket, which
  1016. is responsible for the transmission and congestion control. The Smoother
  1017. type must be exactly the same on both connecting parties, otherwise
  1018. the connection is rejected.
  1019. @item messageapi=@var{1|0}
  1020. When set, this socket uses the Message API, otherwise it uses Buffer
  1021. API. Note that in live mode (see @option{transtype}) there’s only
  1022. message API available. In File mode you can chose to use one of two modes:
  1023. Stream API (default, when this option is false). In this mode you may
  1024. send as many data as you wish with one sending instruction, or even use
  1025. dedicated functions that read directly from a file. The internal facility
  1026. will take care of any speed and congestion control. When receiving, you
  1027. can also receive as many data as desired, the data not extracted will be
  1028. waiting for the next call. There is no boundary between data portions in
  1029. the Stream mode.
  1030. Message API. In this mode your single sending instruction passes exactly
  1031. one piece of data that has boundaries (a message). Contrary to Live mode,
  1032. this message may span across multiple UDP packets and the only size
  1033. limitation is that it shall fit as a whole in the sending buffer. The
  1034. receiver shall use as large buffer as necessary to receive the message,
  1035. otherwise the message will not be given up. When the message is not
  1036. complete (not all packets received or there was a packet loss) it will
  1037. not be given up.
  1038. @item transtype=@var{live|file}
  1039. Sets the transmission type for the socket, in particular, setting this
  1040. option sets multiple other parameters to their default values as required
  1041. for a particular transmission type.
  1042. live: Set options as for live transmission. In this mode, you should
  1043. send by one sending instruction only so many data that fit in one UDP packet,
  1044. and limited to the value defined first in @option{payload_size} (1316 is
  1045. default in this mode). There is no speed control in this mode, only the
  1046. bandwidth control, if configured, in order to not exceed the bandwidth with
  1047. the overhead transmission (retransmitted and control packets).
  1048. file: Set options as for non-live transmission. See @option{messageapi}
  1049. for further explanations
  1050. @end table
  1051. For more information see: @url{https://github.com/Haivision/srt}.
  1052. @section srtp
  1053. Secure Real-time Transport Protocol.
  1054. The accepted options are:
  1055. @table @option
  1056. @item srtp_in_suite
  1057. @item srtp_out_suite
  1058. Select input and output encoding suites.
  1059. Supported values:
  1060. @table @samp
  1061. @item AES_CM_128_HMAC_SHA1_80
  1062. @item SRTP_AES128_CM_HMAC_SHA1_80
  1063. @item AES_CM_128_HMAC_SHA1_32
  1064. @item SRTP_AES128_CM_HMAC_SHA1_32
  1065. @end table
  1066. @item srtp_in_params
  1067. @item srtp_out_params
  1068. Set input and output encoding parameters, which are expressed by a
  1069. base64-encoded representation of a binary block. The first 16 bytes of
  1070. this binary block are used as master key, the following 14 bytes are
  1071. used as master salt.
  1072. @end table
  1073. @section subfile
  1074. Virtually extract a segment of a file or another stream.
  1075. The underlying stream must be seekable.
  1076. Accepted options:
  1077. @table @option
  1078. @item start
  1079. Start offset of the extracted segment, in bytes.
  1080. @item end
  1081. End offset of the extracted segment, in bytes.
  1082. If set to 0, extract till end of file.
  1083. @end table
  1084. Examples:
  1085. Extract a chapter from a DVD VOB file (start and end sectors obtained
  1086. externally and multiplied by 2048):
  1087. @example
  1088. subfile,,start,153391104,end,268142592,,:/media/dvd/VIDEO_TS/VTS_08_1.VOB
  1089. @end example
  1090. Play an AVI file directly from a TAR archive:
  1091. @example
  1092. subfile,,start,183241728,end,366490624,,:archive.tar
  1093. @end example
  1094. Play a MPEG-TS file from start offset till end:
  1095. @example
  1096. subfile,,start,32815239,end,0,,:video.ts
  1097. @end example
  1098. @section tee
  1099. Writes the output to multiple protocols. The individual outputs are separated
  1100. by |
  1101. @example
  1102. tee:file://path/to/local/this.avi|file://path/to/local/that.avi
  1103. @end example
  1104. @section tcp
  1105. Transmission Control Protocol.
  1106. The required syntax for a TCP url is:
  1107. @example
  1108. tcp://@var{hostname}:@var{port}[?@var{options}]
  1109. @end example
  1110. @var{options} contains a list of &-separated options of the form
  1111. @var{key}=@var{val}.
  1112. The list of supported options follows.
  1113. @table @option
  1114. @item listen=@var{1|0}
  1115. Listen for an incoming connection. Default value is 0.
  1116. @item timeout=@var{microseconds}
  1117. Set raise error timeout, expressed in microseconds.
  1118. This option is only relevant in read mode: if no data arrived in more
  1119. than this time interval, raise error.
  1120. @item listen_timeout=@var{milliseconds}
  1121. Set listen timeout, expressed in milliseconds.
  1122. @item recv_buffer_size=@var{bytes}
  1123. Set receive buffer size, expressed bytes.
  1124. @item send_buffer_size=@var{bytes}
  1125. Set send buffer size, expressed bytes.
  1126. @item tcp_nodelay=@var{1|0}
  1127. Set TCP_NODELAY to disable Nagle's algorithm. Default value is 0.
  1128. @item tcp_mss=@var{bytes}
  1129. Set maximum segment size for outgoing TCP packets, expressed in bytes.
  1130. @end table
  1131. The following example shows how to setup a listening TCP connection
  1132. with @command{ffmpeg}, which is then accessed with @command{ffplay}:
  1133. @example
  1134. ffmpeg -i @var{input} -f @var{format} tcp://@var{hostname}:@var{port}?listen
  1135. ffplay tcp://@var{hostname}:@var{port}
  1136. @end example
  1137. @section tls
  1138. Transport Layer Security (TLS) / Secure Sockets Layer (SSL)
  1139. The required syntax for a TLS/SSL url is:
  1140. @example
  1141. tls://@var{hostname}:@var{port}[?@var{options}]
  1142. @end example
  1143. The following parameters can be set via command line options
  1144. (or in code via @code{AVOption}s):
  1145. @table @option
  1146. @item ca_file, cafile=@var{filename}
  1147. A file containing certificate authority (CA) root certificates to treat
  1148. as trusted. If the linked TLS library contains a default this might not
  1149. need to be specified for verification to work, but not all libraries and
  1150. setups have defaults built in.
  1151. The file must be in OpenSSL PEM format.
  1152. @item tls_verify=@var{1|0}
  1153. If enabled, try to verify the peer that we are communicating with.
  1154. Note, if using OpenSSL, this currently only makes sure that the
  1155. peer certificate is signed by one of the root certificates in the CA
  1156. database, but it does not validate that the certificate actually
  1157. matches the host name we are trying to connect to. (With other backends,
  1158. the host name is validated as well.)
  1159. This is disabled by default since it requires a CA database to be
  1160. provided by the caller in many cases.
  1161. @item cert_file, cert=@var{filename}
  1162. A file containing a certificate to use in the handshake with the peer.
  1163. (When operating as server, in listen mode, this is more often required
  1164. by the peer, while client certificates only are mandated in certain
  1165. setups.)
  1166. @item key_file, key=@var{filename}
  1167. A file containing the private key for the certificate.
  1168. @item listen=@var{1|0}
  1169. If enabled, listen for connections on the provided port, and assume
  1170. the server role in the handshake instead of the client role.
  1171. @end table
  1172. Example command lines:
  1173. To create a TLS/SSL server that serves an input stream.
  1174. @example
  1175. ffmpeg -i @var{input} -f @var{format} tls://@var{hostname}:@var{port}?listen&cert=@var{server.crt}&key=@var{server.key}
  1176. @end example
  1177. To play back a stream from the TLS/SSL server using @command{ffplay}:
  1178. @example
  1179. ffplay tls://@var{hostname}:@var{port}
  1180. @end example
  1181. @section udp
  1182. User Datagram Protocol.
  1183. The required syntax for an UDP URL is:
  1184. @example
  1185. udp://@var{hostname}:@var{port}[?@var{options}]
  1186. @end example
  1187. @var{options} contains a list of &-separated options of the form @var{key}=@var{val}.
  1188. In case threading is enabled on the system, a circular buffer is used
  1189. to store the incoming data, which allows one to reduce loss of data due to
  1190. UDP socket buffer overruns. The @var{fifo_size} and
  1191. @var{overrun_nonfatal} options are related to this buffer.
  1192. The list of supported options follows.
  1193. @table @option
  1194. @item buffer_size=@var{size}
  1195. Set the UDP maximum socket buffer size in bytes. This is used to set either
  1196. the receive or send buffer size, depending on what the socket is used for.
  1197. Default is 64KB. See also @var{fifo_size}.
  1198. @item bitrate=@var{bitrate}
  1199. If set to nonzero, the output will have the specified constant bitrate if the
  1200. input has enough packets to sustain it.
  1201. @item burst_bits=@var{bits}
  1202. When using @var{bitrate} this specifies the maximum number of bits in
  1203. packet bursts.
  1204. @item localport=@var{port}
  1205. Override the local UDP port to bind with.
  1206. @item localaddr=@var{addr}
  1207. Local IP address of a network interface used for sending packets or joining
  1208. multicast groups.
  1209. @item pkt_size=@var{size}
  1210. Set the size in bytes of UDP packets.
  1211. @item reuse=@var{1|0}
  1212. Explicitly allow or disallow reusing UDP sockets.
  1213. @item ttl=@var{ttl}
  1214. Set the time to live value (for multicast only).
  1215. @item connect=@var{1|0}
  1216. Initialize the UDP socket with @code{connect()}. In this case, the
  1217. destination address can't be changed with ff_udp_set_remote_url later.
  1218. If the destination address isn't known at the start, this option can
  1219. be specified in ff_udp_set_remote_url, too.
  1220. This allows finding out the source address for the packets with getsockname,
  1221. and makes writes return with AVERROR(ECONNREFUSED) if "destination
  1222. unreachable" is received.
  1223. For receiving, this gives the benefit of only receiving packets from
  1224. the specified peer address/port.
  1225. @item sources=@var{address}[,@var{address}]
  1226. Only receive packets sent from the specified addresses. In case of multicast,
  1227. also subscribe to multicast traffic coming from these addresses only.
  1228. @item block=@var{address}[,@var{address}]
  1229. Ignore packets sent from the specified addresses. In case of multicast, also
  1230. exclude the source addresses in the multicast subscription.
  1231. @item fifo_size=@var{units}
  1232. Set the UDP receiving circular buffer size, expressed as a number of
  1233. packets with size of 188 bytes. If not specified defaults to 7*4096.
  1234. @item overrun_nonfatal=@var{1|0}
  1235. Survive in case of UDP receiving circular buffer overrun. Default
  1236. value is 0.
  1237. @item timeout=@var{microseconds}
  1238. Set raise error timeout, expressed in microseconds.
  1239. This option is only relevant in read mode: if no data arrived in more
  1240. than this time interval, raise error.
  1241. @item broadcast=@var{1|0}
  1242. Explicitly allow or disallow UDP broadcasting.
  1243. Note that broadcasting may not work properly on networks having
  1244. a broadcast storm protection.
  1245. @end table
  1246. @subsection Examples
  1247. @itemize
  1248. @item
  1249. Use @command{ffmpeg} to stream over UDP to a remote endpoint:
  1250. @example
  1251. ffmpeg -i @var{input} -f @var{format} udp://@var{hostname}:@var{port}
  1252. @end example
  1253. @item
  1254. Use @command{ffmpeg} to stream in mpegts format over UDP using 188
  1255. sized UDP packets, using a large input buffer:
  1256. @example
  1257. ffmpeg -i @var{input} -f mpegts udp://@var{hostname}:@var{port}?pkt_size=188&buffer_size=65535
  1258. @end example
  1259. @item
  1260. Use @command{ffmpeg} to receive over UDP from a remote endpoint:
  1261. @example
  1262. ffmpeg -i udp://[@var{multicast-address}]:@var{port} ...
  1263. @end example
  1264. @end itemize
  1265. @section unix
  1266. Unix local socket
  1267. The required syntax for a Unix socket URL is:
  1268. @example
  1269. unix://@var{filepath}
  1270. @end example
  1271. The following parameters can be set via command line options
  1272. (or in code via @code{AVOption}s):
  1273. @table @option
  1274. @item timeout
  1275. Timeout in ms.
  1276. @item listen
  1277. Create the Unix socket in listening mode.
  1278. @end table
  1279. @c man end PROTOCOLS