protocols.texi 45 KB

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