protocols.texi 38 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369
  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. The list of supported options follows:
  7. @table @option
  8. @item protocol_whitelist @var{list} (@emph{input})
  9. Set a ","-separated list of allowed protocols. "ALL" matches all protocols. Protocols
  10. prefixed by "-" are disabled.
  11. All protocols are allowed by default but protocols used by an another
  12. protocol (nested protocols) are restricted to a per protocol subset.
  13. @end table
  14. @c man end PROTOCOL OPTIONS
  15. @chapter Protocols
  16. @c man begin PROTOCOLS
  17. Protocols are configured elements in FFmpeg that enable access to
  18. resources that require specific protocols.
  19. When you configure your FFmpeg build, all the supported protocols are
  20. enabled by default. You can list all available ones using the
  21. configure option "--list-protocols".
  22. You can disable all the protocols using the configure option
  23. "--disable-protocols", and selectively enable a protocol using the
  24. option "--enable-protocol=@var{PROTOCOL}", or you can disable a
  25. particular protocol using the option
  26. "--disable-protocol=@var{PROTOCOL}".
  27. The option "-protocols" of the ff* tools will display the list of
  28. supported protocols.
  29. A description of the currently available protocols follows.
  30. @section async
  31. Asynchronous data filling wrapper for input stream.
  32. Fill data in a background thread, to decouple I/O operation from demux thread.
  33. @example
  34. async:@var{URL}
  35. async:http://host/resource
  36. async:cache:http://host/resource
  37. @end example
  38. @section bluray
  39. Read BluRay playlist.
  40. The accepted options are:
  41. @table @option
  42. @item angle
  43. BluRay angle
  44. @item chapter
  45. Start chapter (1...N)
  46. @item playlist
  47. Playlist to read (BDMV/PLAYLIST/?????.mpls)
  48. @end table
  49. Examples:
  50. Read longest playlist from BluRay mounted to /mnt/bluray:
  51. @example
  52. bluray:/mnt/bluray
  53. @end example
  54. Read angle 2 of playlist 4 from BluRay mounted to /mnt/bluray, start from chapter 2:
  55. @example
  56. -playlist 4 -angle 2 -chapter 2 bluray:/mnt/bluray
  57. @end example
  58. @section cache
  59. Caching wrapper for input stream.
  60. Cache the input stream to temporary file. It brings seeking capability to live streams.
  61. @example
  62. cache:@var{URL}
  63. @end example
  64. @section concat
  65. Physical concatenation protocol.
  66. Read and seek from many resources in sequence as if they were
  67. a unique resource.
  68. A URL accepted by this protocol has the syntax:
  69. @example
  70. concat:@var{URL1}|@var{URL2}|...|@var{URLN}
  71. @end example
  72. where @var{URL1}, @var{URL2}, ..., @var{URLN} are the urls of the
  73. resource to be concatenated, each one possibly specifying a distinct
  74. protocol.
  75. For example to read a sequence of files @file{split1.mpeg},
  76. @file{split2.mpeg}, @file{split3.mpeg} with @command{ffplay} use the
  77. command:
  78. @example
  79. ffplay concat:split1.mpeg\|split2.mpeg\|split3.mpeg
  80. @end example
  81. Note that you may need to escape the character "|" which is special for
  82. many shells.
  83. @section crypto
  84. AES-encrypted stream reading protocol.
  85. The accepted options are:
  86. @table @option
  87. @item key
  88. Set the AES decryption key binary block from given hexadecimal representation.
  89. @item iv
  90. Set the AES decryption initialization vector binary block from given hexadecimal representation.
  91. @end table
  92. Accepted URL formats:
  93. @example
  94. crypto:@var{URL}
  95. crypto+@var{URL}
  96. @end example
  97. @section data
  98. Data in-line in the URI. See @url{http://en.wikipedia.org/wiki/Data_URI_scheme}.
  99. For example, to convert a GIF file given inline with @command{ffmpeg}:
  100. @example
  101. ffmpeg -i "data:image/gif;base64,R0lGODdhCAAIAMIEAAAAAAAA//8AAP//AP///////////////ywAAAAACAAIAAADF0gEDLojDgdGiJdJqUX02iB4E8Q9jUMkADs=" smiley.png
  102. @end example
  103. @section file
  104. File access protocol.
  105. Read from or write to a file.
  106. A file URL can have the form:
  107. @example
  108. file:@var{filename}
  109. @end example
  110. where @var{filename} is the path of the file to read.
  111. An URL that does not have a protocol prefix will be assumed to be a
  112. file URL. Depending on the build, an URL that looks like a Windows
  113. path with the drive letter at the beginning will also be assumed to be
  114. a file URL (usually not the case in builds for unix-like systems).
  115. For example to read from a file @file{input.mpeg} with @command{ffmpeg}
  116. use the command:
  117. @example
  118. ffmpeg -i file:input.mpeg output.mpeg
  119. @end example
  120. This protocol accepts the following options:
  121. @table @option
  122. @item truncate
  123. Truncate existing files on write, if set to 1. A value of 0 prevents
  124. truncating. Default value is 1.
  125. @item blocksize
  126. Set I/O operation maximum block size, in bytes. Default value is
  127. @code{INT_MAX}, which results in not limiting the requested block size.
  128. Setting this value reasonably low improves user termination request reaction
  129. time, which is valuable for files on slow medium.
  130. @end table
  131. @section ftp
  132. FTP (File Transfer Protocol).
  133. Read from or write to remote resources using FTP protocol.
  134. Following syntax is required.
  135. @example
  136. ftp://[user[:password]@@]server[:port]/path/to/remote/resource.mpeg
  137. @end example
  138. This protocol accepts the following options.
  139. @table @option
  140. @item timeout
  141. Set timeout in microseconds of socket I/O operations used by the underlying low level
  142. operation. By default it is set to -1, which means that the timeout is
  143. not specified.
  144. @item ftp-anonymous-password
  145. Password used when login as anonymous user. Typically an e-mail address
  146. should be used.
  147. @item ftp-write-seekable
  148. Control seekability of connection during encoding. If set to 1 the
  149. resource is supposed to be seekable, if set to 0 it is assumed not
  150. to be seekable. Default value is 0.
  151. @end table
  152. NOTE: Protocol can be used as output, but it is recommended to not do
  153. it, unless special care is taken (tests, customized server configuration
  154. etc.). Different FTP servers behave in different way during seek
  155. operation. ff* tools may produce incomplete content due to server limitations.
  156. @section gopher
  157. Gopher protocol.
  158. @section hls
  159. Read Apple HTTP Live Streaming compliant segmented stream as
  160. a uniform one. The M3U8 playlists describing the segments can be
  161. remote HTTP resources or local files, accessed using the standard
  162. file protocol.
  163. The nested protocol is declared by specifying
  164. "+@var{proto}" after the hls URI scheme name, where @var{proto}
  165. is either "file" or "http".
  166. @example
  167. hls+http://host/path/to/remote/resource.m3u8
  168. hls+file://path/to/local/resource.m3u8
  169. @end example
  170. Using this protocol is discouraged - the hls demuxer should work
  171. just as well (if not, please report the issues) and is more complete.
  172. To use the hls demuxer instead, simply use the direct URLs to the
  173. m3u8 files.
  174. @section http
  175. HTTP (Hyper Text Transfer Protocol).
  176. This protocol accepts the following options:
  177. @table @option
  178. @item seekable
  179. Control seekability of connection. If set to 1 the resource is
  180. supposed to be seekable, if set to 0 it is assumed not to be seekable,
  181. if set to -1 it will try to autodetect if it is seekable. Default
  182. value is -1.
  183. @item chunked_post
  184. If set to 1 use chunked Transfer-Encoding for posts, default is 1.
  185. @item content_type
  186. Set a specific content type for the POST messages.
  187. @item http_proxy
  188. set HTTP proxy to tunnel through e.g. http://example.com:1234
  189. @item headers
  190. Set custom HTTP headers, can override built in default headers. The
  191. value must be a string encoding the headers.
  192. @item multiple_requests
  193. Use persistent connections if set to 1, default is 0.
  194. @item post_data
  195. Set custom HTTP post data.
  196. @item user-agent
  197. @item user_agent
  198. Override the User-Agent header. If not specified the protocol will use a
  199. string describing the libavformat build. ("Lavf/<version>")
  200. @item timeout
  201. Set timeout in microseconds of socket I/O operations used by the underlying low level
  202. operation. By default it is set to -1, which means that the timeout is
  203. not specified.
  204. @item reconnect_at_eof
  205. If set then eof is treated like an error and causes reconnection, this is useful
  206. for live / endless streams.
  207. @item reconnect_streamed
  208. If set then even streamed/non seekable streams will be reconnected on errors.
  209. @item reconnect_delay_max
  210. Sets the maximum delay in seconds after which to give up reconnecting
  211. @item mime_type
  212. Export the MIME type.
  213. @item icy
  214. If set to 1 request ICY (SHOUTcast) metadata from the server. If the server
  215. supports this, the metadata has to be retrieved by the application by reading
  216. the @option{icy_metadata_headers} and @option{icy_metadata_packet} options.
  217. The default is 1.
  218. @item icy_metadata_headers
  219. If the server supports ICY metadata, this contains the ICY-specific HTTP reply
  220. headers, separated by newline characters.
  221. @item icy_metadata_packet
  222. If the server supports ICY metadata, and @option{icy} was set to 1, this
  223. contains the last non-empty metadata packet sent by the server. It should be
  224. polled in regular intervals by applications interested in mid-stream metadata
  225. updates.
  226. @item cookies
  227. Set the cookies to be sent in future requests. The format of each cookie is the
  228. same as the value of a Set-Cookie HTTP response field. Multiple cookies can be
  229. delimited by a newline character.
  230. @item offset
  231. Set initial byte offset.
  232. @item end_offset
  233. Try to limit the request to bytes preceding this offset.
  234. @item method
  235. When used as a client option it sets the HTTP method for the request.
  236. When used as a server option it sets the HTTP method that is going to be
  237. expected from the client(s).
  238. If the expected and the received HTTP method do not match the client will
  239. be given a Bad Request response.
  240. When unset the HTTP method is not checked for now. This will be replaced by
  241. autodetection in the future.
  242. @item listen
  243. If set to 1 enables experimental HTTP server. This can be used to send data when
  244. used as an output option, or read data from a client with HTTP POST when used as
  245. an input option.
  246. If set to 2 enables experimental mutli-client HTTP server. This is not yet implemented
  247. in ffmpeg.c or ffserver.c and thus must not be used as a command line option.
  248. @example
  249. # Server side (sending):
  250. ffmpeg -i somefile.ogg -c copy -listen 1 -f ogg http://@var{server}:@var{port}
  251. # Client side (receiving):
  252. ffmpeg -i http://@var{server}:@var{port} -c copy somefile.ogg
  253. # Client can also be done with wget:
  254. wget http://@var{server}:@var{port} -O somefile.ogg
  255. # Server side (receiving):
  256. ffmpeg -listen 1 -i http://@var{server}:@var{port} -c copy somefile.ogg
  257. # Client side (sending):
  258. ffmpeg -i somefile.ogg -chunked_post 0 -c copy -f ogg http://@var{server}:@var{port}
  259. # Client can also be done with wget:
  260. wget --post-file=somefile.ogg http://@var{server}:@var{port}
  261. @end example
  262. @end table
  263. @subsection HTTP Cookies
  264. Some HTTP requests will be denied unless cookie values are passed in with the
  265. request. The @option{cookies} option allows these cookies to be specified. At
  266. the very least, each cookie must specify a value along with a path and domain.
  267. HTTP requests that match both the domain and path will automatically include the
  268. cookie value in the HTTP Cookie header field. Multiple cookies can be delimited
  269. by a newline.
  270. The required syntax to play a stream specifying a cookie is:
  271. @example
  272. ffplay -cookies "nlqptid=nltid=tsn; path=/; domain=somedomain.com;" http://somedomain.com/somestream.m3u8
  273. @end example
  274. @section Icecast
  275. Icecast protocol (stream to Icecast servers)
  276. This protocol accepts the following options:
  277. @table @option
  278. @item ice_genre
  279. Set the stream genre.
  280. @item ice_name
  281. Set the stream name.
  282. @item ice_description
  283. Set the stream description.
  284. @item ice_url
  285. Set the stream website URL.
  286. @item ice_public
  287. Set if the stream should be public.
  288. The default is 0 (not public).
  289. @item user_agent
  290. Override the User-Agent header. If not specified a string of the form
  291. "Lavf/<version>" will be used.
  292. @item password
  293. Set the Icecast mountpoint password.
  294. @item content_type
  295. Set the stream content type. This must be set if it is different from
  296. audio/mpeg.
  297. @item legacy_icecast
  298. This enables support for Icecast versions < 2.4.0, that do not support the
  299. HTTP PUT method but the SOURCE method.
  300. @end table
  301. @example
  302. icecast://[@var{username}[:@var{password}]@@]@var{server}:@var{port}/@var{mountpoint}
  303. @end example
  304. @section mmst
  305. MMS (Microsoft Media Server) protocol over TCP.
  306. @section mmsh
  307. MMS (Microsoft Media Server) protocol over HTTP.
  308. The required syntax is:
  309. @example
  310. mmsh://@var{server}[:@var{port}][/@var{app}][/@var{playpath}]
  311. @end example
  312. @section md5
  313. MD5 output protocol.
  314. Computes the MD5 hash of the data to be written, and on close writes
  315. this to the designated output or stdout if none is specified. It can
  316. be used to test muxers without writing an actual file.
  317. Some examples follow.
  318. @example
  319. # Write the MD5 hash of the encoded AVI file to the file output.avi.md5.
  320. ffmpeg -i input.flv -f avi -y md5:output.avi.md5
  321. # Write the MD5 hash of the encoded AVI file to stdout.
  322. ffmpeg -i input.flv -f avi -y md5:
  323. @end example
  324. Note that some formats (typically MOV) require the output protocol to
  325. be seekable, so they will fail with the MD5 output protocol.
  326. @section pipe
  327. UNIX pipe access protocol.
  328. Read and write from UNIX pipes.
  329. The accepted syntax is:
  330. @example
  331. pipe:[@var{number}]
  332. @end example
  333. @var{number} is the number corresponding to the file descriptor of the
  334. pipe (e.g. 0 for stdin, 1 for stdout, 2 for stderr). If @var{number}
  335. is not specified, by default the stdout file descriptor will be used
  336. for writing, stdin for reading.
  337. For example to read from stdin with @command{ffmpeg}:
  338. @example
  339. cat test.wav | ffmpeg -i pipe:0
  340. # ...this is the same as...
  341. cat test.wav | ffmpeg -i pipe:
  342. @end example
  343. For writing to stdout with @command{ffmpeg}:
  344. @example
  345. ffmpeg -i test.wav -f avi pipe:1 | cat > test.avi
  346. # ...this is the same as...
  347. ffmpeg -i test.wav -f avi pipe: | cat > test.avi
  348. @end example
  349. This protocol accepts the following options:
  350. @table @option
  351. @item blocksize
  352. Set I/O operation maximum block size, in bytes. Default value is
  353. @code{INT_MAX}, which results in not limiting the requested block size.
  354. Setting this value reasonably low improves user termination request reaction
  355. time, which is valuable if data transmission is slow.
  356. @end table
  357. Note that some formats (typically MOV), require the output protocol to
  358. be seekable, so they will fail with the pipe output protocol.
  359. @section rtmp
  360. Real-Time Messaging Protocol.
  361. The Real-Time Messaging Protocol (RTMP) is used for streaming multimedia
  362. content across a TCP/IP network.
  363. The required syntax is:
  364. @example
  365. rtmp://[@var{username}:@var{password}@@]@var{server}[:@var{port}][/@var{app}][/@var{instance}][/@var{playpath}]
  366. @end example
  367. The accepted parameters are:
  368. @table @option
  369. @item username
  370. An optional username (mostly for publishing).
  371. @item password
  372. An optional password (mostly for publishing).
  373. @item server
  374. The address of the RTMP server.
  375. @item port
  376. The number of the TCP port to use (by default is 1935).
  377. @item app
  378. It is the name of the application to access. It usually corresponds to
  379. the path where the application is installed on the RTMP server
  380. (e.g. @file{/ondemand/}, @file{/flash/live/}, etc.). You can override
  381. the value parsed from the URI through the @code{rtmp_app} option, too.
  382. @item playpath
  383. It is the path or name of the resource to play with reference to the
  384. application specified in @var{app}, may be prefixed by "mp4:". You
  385. can override the value parsed from the URI through the @code{rtmp_playpath}
  386. option, too.
  387. @item listen
  388. Act as a server, listening for an incoming connection.
  389. @item timeout
  390. Maximum time to wait for the incoming connection. Implies listen.
  391. @end table
  392. Additionally, the following parameters can be set via command line options
  393. (or in code via @code{AVOption}s):
  394. @table @option
  395. @item rtmp_app
  396. Name of application to connect on the RTMP server. This option
  397. overrides the parameter specified in the URI.
  398. @item rtmp_buffer
  399. Set the client buffer time in milliseconds. The default is 3000.
  400. @item rtmp_conn
  401. Extra arbitrary AMF connection parameters, parsed from a string,
  402. e.g. like @code{B:1 S:authMe O:1 NN:code:1.23 NS:flag:ok O:0}.
  403. Each value is prefixed by a single character denoting the type,
  404. B for Boolean, N for number, S for string, O for object, or Z for null,
  405. followed by a colon. For Booleans the data must be either 0 or 1 for
  406. FALSE or TRUE, respectively. Likewise for Objects the data must be 0 or
  407. 1 to end or begin an object, respectively. Data items in subobjects may
  408. be named, by prefixing the type with 'N' and specifying the name before
  409. the value (i.e. @code{NB:myFlag:1}). This option may be used multiple
  410. times to construct arbitrary AMF sequences.
  411. @item rtmp_flashver
  412. Version of the Flash plugin used to run the SWF player. The default
  413. is LNX 9,0,124,2. (When publishing, the default is FMLE/3.0 (compatible;
  414. <libavformat version>).)
  415. @item rtmp_flush_interval
  416. Number of packets flushed in the same request (RTMPT only). The default
  417. is 10.
  418. @item rtmp_live
  419. Specify that the media is a live stream. No resuming or seeking in
  420. live streams is possible. The default value is @code{any}, which means the
  421. subscriber first tries to play the live stream specified in the
  422. playpath. If a live stream of that name is not found, it plays the
  423. recorded stream. The other possible values are @code{live} and
  424. @code{recorded}.
  425. @item rtmp_pageurl
  426. URL of the web page in which the media was embedded. By default no
  427. value will be sent.
  428. @item rtmp_playpath
  429. Stream identifier to play or to publish. This option overrides the
  430. parameter specified in the URI.
  431. @item rtmp_subscribe
  432. Name of live stream to subscribe to. By default no value will be sent.
  433. It is only sent if the option is specified or if rtmp_live
  434. is set to live.
  435. @item rtmp_swfhash
  436. SHA256 hash of the decompressed SWF file (32 bytes).
  437. @item rtmp_swfsize
  438. Size of the decompressed SWF file, required for SWFVerification.
  439. @item rtmp_swfurl
  440. URL of the SWF player for the media. By default no value will be sent.
  441. @item rtmp_swfverify
  442. URL to player swf file, compute hash/size automatically.
  443. @item rtmp_tcurl
  444. URL of the target stream. Defaults to proto://host[:port]/app.
  445. @end table
  446. For example to read with @command{ffplay} a multimedia resource named
  447. "sample" from the application "vod" from an RTMP server "myserver":
  448. @example
  449. ffplay rtmp://myserver/vod/sample
  450. @end example
  451. To publish to a password protected server, passing the playpath and
  452. app names separately:
  453. @example
  454. ffmpeg -re -i <input> -f flv -rtmp_playpath some/long/path -rtmp_app long/app/name rtmp://username:password@@myserver/
  455. @end example
  456. @section rtmpe
  457. Encrypted Real-Time Messaging Protocol.
  458. The Encrypted Real-Time Messaging Protocol (RTMPE) is used for
  459. streaming multimedia content within standard cryptographic primitives,
  460. consisting of Diffie-Hellman key exchange and HMACSHA256, generating
  461. a pair of RC4 keys.
  462. @section rtmps
  463. Real-Time Messaging Protocol over a secure SSL connection.
  464. The Real-Time Messaging Protocol (RTMPS) is used for streaming
  465. multimedia content across an encrypted connection.
  466. @section rtmpt
  467. Real-Time Messaging Protocol tunneled through HTTP.
  468. The Real-Time Messaging Protocol tunneled through HTTP (RTMPT) is used
  469. for streaming multimedia content within HTTP requests to traverse
  470. firewalls.
  471. @section rtmpte
  472. Encrypted Real-Time Messaging Protocol tunneled through HTTP.
  473. The Encrypted Real-Time Messaging Protocol tunneled through HTTP (RTMPTE)
  474. is used for streaming multimedia content within HTTP requests to traverse
  475. firewalls.
  476. @section rtmpts
  477. Real-Time Messaging Protocol tunneled through HTTPS.
  478. The Real-Time Messaging Protocol tunneled through HTTPS (RTMPTS) is used
  479. for streaming multimedia content within HTTPS requests to traverse
  480. firewalls.
  481. @section libsmbclient
  482. libsmbclient permits one to manipulate CIFS/SMB network resources.
  483. Following syntax is required.
  484. @example
  485. smb://[[domain:]user[:password@@]]server[/share[/path[/file]]]
  486. @end example
  487. This protocol accepts the following options.
  488. @table @option
  489. @item timeout
  490. Set timeout in miliseconds of socket I/O operations used by the underlying
  491. low level operation. By default it is set to -1, which means that the timeout
  492. is not specified.
  493. @item truncate
  494. Truncate existing files on write, if set to 1. A value of 0 prevents
  495. truncating. Default value is 1.
  496. @item workgroup
  497. Set the workgroup used for making connections. By default workgroup is not specified.
  498. @end table
  499. For more information see: @url{http://www.samba.org/}.
  500. @section libssh
  501. Secure File Transfer Protocol via libssh
  502. Read from or write to remote resources using SFTP protocol.
  503. Following syntax is required.
  504. @example
  505. sftp://[user[:password]@@]server[:port]/path/to/remote/resource.mpeg
  506. @end example
  507. This protocol accepts the following options.
  508. @table @option
  509. @item timeout
  510. Set timeout of socket I/O operations used by the underlying low level
  511. operation. By default it is set to -1, which means that the timeout
  512. is not specified.
  513. @item truncate
  514. Truncate existing files on write, if set to 1. A value of 0 prevents
  515. truncating. Default value is 1.
  516. @item private_key
  517. Specify the path of the file containing private key to use during authorization.
  518. By default libssh searches for keys in the @file{~/.ssh/} directory.
  519. @end table
  520. Example: Play a file stored on remote server.
  521. @example
  522. ffplay sftp://user:password@@server_address:22/home/user/resource.mpeg
  523. @end example
  524. @section librtmp rtmp, rtmpe, rtmps, rtmpt, rtmpte
  525. Real-Time Messaging Protocol and its variants supported through
  526. librtmp.
  527. Requires the presence of the librtmp headers and library during
  528. configuration. You need to explicitly configure the build with
  529. "--enable-librtmp". If enabled this will replace the native RTMP
  530. protocol.
  531. This protocol provides most client functions and a few server
  532. functions needed to support RTMP, RTMP tunneled in HTTP (RTMPT),
  533. encrypted RTMP (RTMPE), RTMP over SSL/TLS (RTMPS) and tunneled
  534. variants of these encrypted types (RTMPTE, RTMPTS).
  535. The required syntax is:
  536. @example
  537. @var{rtmp_proto}://@var{server}[:@var{port}][/@var{app}][/@var{playpath}] @var{options}
  538. @end example
  539. where @var{rtmp_proto} is one of the strings "rtmp", "rtmpt", "rtmpe",
  540. "rtmps", "rtmpte", "rtmpts" corresponding to each RTMP variant, and
  541. @var{server}, @var{port}, @var{app} and @var{playpath} have the same
  542. meaning as specified for the RTMP native protocol.
  543. @var{options} contains a list of space-separated options of the form
  544. @var{key}=@var{val}.
  545. See the librtmp manual page (man 3 librtmp) for more information.
  546. For example, to stream a file in real-time to an RTMP server using
  547. @command{ffmpeg}:
  548. @example
  549. ffmpeg -re -i myfile -f flv rtmp://myserver/live/mystream
  550. @end example
  551. To play the same stream using @command{ffplay}:
  552. @example
  553. ffplay "rtmp://myserver/live/mystream live=1"
  554. @end example
  555. @section rtp
  556. Real-time Transport Protocol.
  557. The required syntax for an RTP URL is:
  558. rtp://@var{hostname}[:@var{port}][?@var{option}=@var{val}...]
  559. @var{port} specifies the RTP port to use.
  560. The following URL options are supported:
  561. @table @option
  562. @item ttl=@var{n}
  563. Set the TTL (Time-To-Live) value (for multicast only).
  564. @item rtcpport=@var{n}
  565. Set the remote RTCP port to @var{n}.
  566. @item localrtpport=@var{n}
  567. Set the local RTP port to @var{n}.
  568. @item localrtcpport=@var{n}'
  569. Set the local RTCP port to @var{n}.
  570. @item pkt_size=@var{n}
  571. Set max packet size (in bytes) to @var{n}.
  572. @item connect=0|1
  573. Do a @code{connect()} on the UDP socket (if set to 1) or not (if set
  574. to 0).
  575. @item sources=@var{ip}[,@var{ip}]
  576. List allowed source IP addresses.
  577. @item block=@var{ip}[,@var{ip}]
  578. List disallowed (blocked) source IP addresses.
  579. @item write_to_source=0|1
  580. Send packets to the source address of the latest received packet (if
  581. set to 1) or to a default remote address (if set to 0).
  582. @item localport=@var{n}
  583. Set the local RTP port to @var{n}.
  584. This is a deprecated option. Instead, @option{localrtpport} should be
  585. used.
  586. @end table
  587. Important notes:
  588. @enumerate
  589. @item
  590. If @option{rtcpport} is not set the RTCP port will be set to the RTP
  591. port value plus 1.
  592. @item
  593. If @option{localrtpport} (the local RTP port) is not set any available
  594. port will be used for the local RTP and RTCP ports.
  595. @item
  596. If @option{localrtcpport} (the local RTCP port) is not set it will be
  597. set to the local RTP port value plus 1.
  598. @end enumerate
  599. @section rtsp
  600. Real-Time Streaming Protocol.
  601. RTSP is not technically a protocol handler in libavformat, it is a demuxer
  602. and muxer. The demuxer supports both normal RTSP (with data transferred
  603. over RTP; this is used by e.g. Apple and Microsoft) and Real-RTSP (with
  604. data transferred over RDT).
  605. The muxer can be used to send a stream using RTSP ANNOUNCE to a server
  606. supporting it (currently Darwin Streaming Server and Mischa Spiegelmock's
  607. @uref{https://github.com/revmischa/rtsp-server, RTSP server}).
  608. The required syntax for a RTSP url is:
  609. @example
  610. rtsp://@var{hostname}[:@var{port}]/@var{path}
  611. @end example
  612. Options can be set on the @command{ffmpeg}/@command{ffplay} command
  613. line, or set in code via @code{AVOption}s or in
  614. @code{avformat_open_input}.
  615. The following options are supported.
  616. @table @option
  617. @item initial_pause
  618. Do not start playing the stream immediately if set to 1. Default value
  619. is 0.
  620. @item rtsp_transport
  621. Set RTSP transport protocols.
  622. It accepts the following values:
  623. @table @samp
  624. @item udp
  625. Use UDP as lower transport protocol.
  626. @item tcp
  627. Use TCP (interleaving within the RTSP control channel) as lower
  628. transport protocol.
  629. @item udp_multicast
  630. Use UDP multicast as lower transport protocol.
  631. @item http
  632. Use HTTP tunneling as lower transport protocol, which is useful for
  633. passing proxies.
  634. @end table
  635. Multiple lower transport protocols may be specified, in that case they are
  636. tried one at a time (if the setup of one fails, the next one is tried).
  637. For the muxer, only the @samp{tcp} and @samp{udp} options are supported.
  638. @item rtsp_flags
  639. Set RTSP flags.
  640. The following values are accepted:
  641. @table @samp
  642. @item filter_src
  643. Accept packets only from negotiated peer address and port.
  644. @item listen
  645. Act as a server, listening for an incoming connection.
  646. @item prefer_tcp
  647. Try TCP for RTP transport first, if TCP is available as RTSP RTP transport.
  648. @end table
  649. Default value is @samp{none}.
  650. @item allowed_media_types
  651. Set media types to accept from the server.
  652. The following flags are accepted:
  653. @table @samp
  654. @item video
  655. @item audio
  656. @item data
  657. @end table
  658. By default it accepts all media types.
  659. @item min_port
  660. Set minimum local UDP port. Default value is 5000.
  661. @item max_port
  662. Set maximum local UDP port. Default value is 65000.
  663. @item timeout
  664. Set maximum timeout (in seconds) to wait for incoming connections.
  665. A value of -1 means infinite (default). This option implies the
  666. @option{rtsp_flags} set to @samp{listen}.
  667. @item reorder_queue_size
  668. Set number of packets to buffer for handling of reordered packets.
  669. @item stimeout
  670. Set socket TCP I/O timeout in microseconds.
  671. @item user-agent
  672. Override User-Agent header. If not specified, it defaults to the
  673. libavformat identifier string.
  674. @end table
  675. When receiving data over UDP, the demuxer tries to reorder received packets
  676. (since they may arrive out of order, or packets may get lost totally). This
  677. can be disabled by setting the maximum demuxing delay to zero (via
  678. the @code{max_delay} field of AVFormatContext).
  679. When watching multi-bitrate Real-RTSP streams with @command{ffplay}, the
  680. streams to display can be chosen with @code{-vst} @var{n} and
  681. @code{-ast} @var{n} for video and audio respectively, and can be switched
  682. on the fly by pressing @code{v} and @code{a}.
  683. @subsection Examples
  684. The following examples all make use of the @command{ffplay} and
  685. @command{ffmpeg} tools.
  686. @itemize
  687. @item
  688. Watch a stream over UDP, with a max reordering delay of 0.5 seconds:
  689. @example
  690. ffplay -max_delay 500000 -rtsp_transport udp rtsp://server/video.mp4
  691. @end example
  692. @item
  693. Watch a stream tunneled over HTTP:
  694. @example
  695. ffplay -rtsp_transport http rtsp://server/video.mp4
  696. @end example
  697. @item
  698. Send a stream in realtime to a RTSP server, for others to watch:
  699. @example
  700. ffmpeg -re -i @var{input} -f rtsp -muxdelay 0.1 rtsp://server/live.sdp
  701. @end example
  702. @item
  703. Receive a stream in realtime:
  704. @example
  705. ffmpeg -rtsp_flags listen -i rtsp://ownaddress/live.sdp @var{output}
  706. @end example
  707. @end itemize
  708. @section sap
  709. Session Announcement Protocol (RFC 2974). This is not technically a
  710. protocol handler in libavformat, it is a muxer and demuxer.
  711. It is used for signalling of RTP streams, by announcing the SDP for the
  712. streams regularly on a separate port.
  713. @subsection Muxer
  714. The syntax for a SAP url given to the muxer is:
  715. @example
  716. sap://@var{destination}[:@var{port}][?@var{options}]
  717. @end example
  718. The RTP packets are sent to @var{destination} on port @var{port},
  719. or to port 5004 if no port is specified.
  720. @var{options} is a @code{&}-separated list. The following options
  721. are supported:
  722. @table @option
  723. @item announce_addr=@var{address}
  724. Specify the destination IP address for sending the announcements to.
  725. If omitted, the announcements are sent to the commonly used SAP
  726. announcement multicast address 224.2.127.254 (sap.mcast.net), or
  727. ff0e::2:7ffe if @var{destination} is an IPv6 address.
  728. @item announce_port=@var{port}
  729. Specify the port to send the announcements on, defaults to
  730. 9875 if not specified.
  731. @item ttl=@var{ttl}
  732. Specify the time to live value for the announcements and RTP packets,
  733. defaults to 255.
  734. @item same_port=@var{0|1}
  735. If set to 1, send all RTP streams on the same port pair. If zero (the
  736. default), all streams are sent on unique ports, with each stream on a
  737. port 2 numbers higher than the previous.
  738. VLC/Live555 requires this to be set to 1, to be able to receive the stream.
  739. The RTP stack in libavformat for receiving requires all streams to be sent
  740. on unique ports.
  741. @end table
  742. Example command lines follow.
  743. To broadcast a stream on the local subnet, for watching in VLC:
  744. @example
  745. ffmpeg -re -i @var{input} -f sap sap://224.0.0.255?same_port=1
  746. @end example
  747. Similarly, for watching in @command{ffplay}:
  748. @example
  749. ffmpeg -re -i @var{input} -f sap sap://224.0.0.255
  750. @end example
  751. And for watching in @command{ffplay}, over IPv6:
  752. @example
  753. ffmpeg -re -i @var{input} -f sap sap://[ff0e::1:2:3:4]
  754. @end example
  755. @subsection Demuxer
  756. The syntax for a SAP url given to the demuxer is:
  757. @example
  758. sap://[@var{address}][:@var{port}]
  759. @end example
  760. @var{address} is the multicast address to listen for announcements on,
  761. if omitted, the default 224.2.127.254 (sap.mcast.net) is used. @var{port}
  762. is the port that is listened on, 9875 if omitted.
  763. The demuxers listens for announcements on the given address and port.
  764. Once an announcement is received, it tries to receive that particular stream.
  765. Example command lines follow.
  766. To play back the first stream announced on the normal SAP multicast address:
  767. @example
  768. ffplay sap://
  769. @end example
  770. To play back the first stream announced on one the default IPv6 SAP multicast address:
  771. @example
  772. ffplay sap://[ff0e::2:7ffe]
  773. @end example
  774. @section sctp
  775. Stream Control Transmission Protocol.
  776. The accepted URL syntax is:
  777. @example
  778. sctp://@var{host}:@var{port}[?@var{options}]
  779. @end example
  780. The protocol accepts the following options:
  781. @table @option
  782. @item listen
  783. If set to any value, listen for an incoming connection. Outgoing connection is done by default.
  784. @item max_streams
  785. Set the maximum number of streams. By default no limit is set.
  786. @end table
  787. @section srtp
  788. Secure Real-time Transport Protocol.
  789. The accepted options are:
  790. @table @option
  791. @item srtp_in_suite
  792. @item srtp_out_suite
  793. Select input and output encoding suites.
  794. Supported values:
  795. @table @samp
  796. @item AES_CM_128_HMAC_SHA1_80
  797. @item SRTP_AES128_CM_HMAC_SHA1_80
  798. @item AES_CM_128_HMAC_SHA1_32
  799. @item SRTP_AES128_CM_HMAC_SHA1_32
  800. @end table
  801. @item srtp_in_params
  802. @item srtp_out_params
  803. Set input and output encoding parameters, which are expressed by a
  804. base64-encoded representation of a binary block. The first 16 bytes of
  805. this binary block are used as master key, the following 14 bytes are
  806. used as master salt.
  807. @end table
  808. @section subfile
  809. Virtually extract a segment of a file or another stream.
  810. The underlying stream must be seekable.
  811. Accepted options:
  812. @table @option
  813. @item start
  814. Start offset of the extracted segment, in bytes.
  815. @item end
  816. End offset of the extracted segment, in bytes.
  817. @end table
  818. Examples:
  819. Extract a chapter from a DVD VOB file (start and end sectors obtained
  820. externally and multiplied by 2048):
  821. @example
  822. subfile,,start,153391104,end,268142592,,:/media/dvd/VIDEO_TS/VTS_08_1.VOB
  823. @end example
  824. Play an AVI file directly from a TAR archive:
  825. @example
  826. subfile,,start,183241728,end,366490624,,:archive.tar
  827. @end example
  828. @section tcp
  829. Transmission Control Protocol.
  830. The required syntax for a TCP url is:
  831. @example
  832. tcp://@var{hostname}:@var{port}[?@var{options}]
  833. @end example
  834. @var{options} contains a list of &-separated options of the form
  835. @var{key}=@var{val}.
  836. The list of supported options follows.
  837. @table @option
  838. @item listen=@var{1|0}
  839. Listen for an incoming connection. Default value is 0.
  840. @item timeout=@var{microseconds}
  841. Set raise error timeout, expressed in microseconds.
  842. This option is only relevant in read mode: if no data arrived in more
  843. than this time interval, raise error.
  844. @item listen_timeout=@var{milliseconds}
  845. Set listen timeout, expressed in milliseconds.
  846. @item recv_buffer_size=@var{bytes}
  847. Set receive buffer size, expressed bytes.
  848. @item send_buffer_size=@var{bytes}
  849. Set send buffer size, expressed bytes.
  850. @end table
  851. The following example shows how to setup a listening TCP connection
  852. with @command{ffmpeg}, which is then accessed with @command{ffplay}:
  853. @example
  854. ffmpeg -i @var{input} -f @var{format} tcp://@var{hostname}:@var{port}?listen
  855. ffplay tcp://@var{hostname}:@var{port}
  856. @end example
  857. @section tls
  858. Transport Layer Security (TLS) / Secure Sockets Layer (SSL)
  859. The required syntax for a TLS/SSL url is:
  860. @example
  861. tls://@var{hostname}:@var{port}[?@var{options}]
  862. @end example
  863. The following parameters can be set via command line options
  864. (or in code via @code{AVOption}s):
  865. @table @option
  866. @item ca_file, cafile=@var{filename}
  867. A file containing certificate authority (CA) root certificates to treat
  868. as trusted. If the linked TLS library contains a default this might not
  869. need to be specified for verification to work, but not all libraries and
  870. setups have defaults built in.
  871. The file must be in OpenSSL PEM format.
  872. @item tls_verify=@var{1|0}
  873. If enabled, try to verify the peer that we are communicating with.
  874. Note, if using OpenSSL, this currently only makes sure that the
  875. peer certificate is signed by one of the root certificates in the CA
  876. database, but it does not validate that the certificate actually
  877. matches the host name we are trying to connect to. (With GnuTLS,
  878. the host name is validated as well.)
  879. This is disabled by default since it requires a CA database to be
  880. provided by the caller in many cases.
  881. @item cert_file, cert=@var{filename}
  882. A file containing a certificate to use in the handshake with the peer.
  883. (When operating as server, in listen mode, this is more often required
  884. by the peer, while client certificates only are mandated in certain
  885. setups.)
  886. @item key_file, key=@var{filename}
  887. A file containing the private key for the certificate.
  888. @item listen=@var{1|0}
  889. If enabled, listen for connections on the provided port, and assume
  890. the server role in the handshake instead of the client role.
  891. @end table
  892. Example command lines:
  893. To create a TLS/SSL server that serves an input stream.
  894. @example
  895. ffmpeg -i @var{input} -f @var{format} tls://@var{hostname}:@var{port}?listen&cert=@var{server.crt}&key=@var{server.key}
  896. @end example
  897. To play back a stream from the TLS/SSL server using @command{ffplay}:
  898. @example
  899. ffplay tls://@var{hostname}:@var{port}
  900. @end example
  901. @section udp
  902. User Datagram Protocol.
  903. The required syntax for an UDP URL is:
  904. @example
  905. udp://@var{hostname}:@var{port}[?@var{options}]
  906. @end example
  907. @var{options} contains a list of &-separated options of the form @var{key}=@var{val}.
  908. In case threading is enabled on the system, a circular buffer is used
  909. to store the incoming data, which allows one to reduce loss of data due to
  910. UDP socket buffer overruns. The @var{fifo_size} and
  911. @var{overrun_nonfatal} options are related to this buffer.
  912. The list of supported options follows.
  913. @table @option
  914. @item buffer_size=@var{size}
  915. Set the UDP maximum socket buffer size in bytes. This is used to set either
  916. the receive or send buffer size, depending on what the socket is used for.
  917. Default is 64KB. See also @var{fifo_size}.
  918. @item localport=@var{port}
  919. Override the local UDP port to bind with.
  920. @item localaddr=@var{addr}
  921. Choose the local IP address. This is useful e.g. if sending multicast
  922. and the host has multiple interfaces, where the user can choose
  923. which interface to send on by specifying the IP address of that interface.
  924. @item pkt_size=@var{size}
  925. Set the size in bytes of UDP packets.
  926. @item reuse=@var{1|0}
  927. Explicitly allow or disallow reusing UDP sockets.
  928. @item ttl=@var{ttl}
  929. Set the time to live value (for multicast only).
  930. @item connect=@var{1|0}
  931. Initialize the UDP socket with @code{connect()}. In this case, the
  932. destination address can't be changed with ff_udp_set_remote_url later.
  933. If the destination address isn't known at the start, this option can
  934. be specified in ff_udp_set_remote_url, too.
  935. This allows finding out the source address for the packets with getsockname,
  936. and makes writes return with AVERROR(ECONNREFUSED) if "destination
  937. unreachable" is received.
  938. For receiving, this gives the benefit of only receiving packets from
  939. the specified peer address/port.
  940. @item sources=@var{address}[,@var{address}]
  941. Only receive packets sent to the multicast group from one of the
  942. specified sender IP addresses.
  943. @item block=@var{address}[,@var{address}]
  944. Ignore packets sent to the multicast group from the specified
  945. sender IP addresses.
  946. @item fifo_size=@var{units}
  947. Set the UDP receiving circular buffer size, expressed as a number of
  948. packets with size of 188 bytes. If not specified defaults to 7*4096.
  949. @item overrun_nonfatal=@var{1|0}
  950. Survive in case of UDP receiving circular buffer overrun. Default
  951. value is 0.
  952. @item timeout=@var{microseconds}
  953. Set raise error timeout, expressed in microseconds.
  954. This option is only relevant in read mode: if no data arrived in more
  955. than this time interval, raise error.
  956. @item broadcast=@var{1|0}
  957. Explicitly allow or disallow UDP broadcasting.
  958. Note that broadcasting may not work properly on networks having
  959. a broadcast storm protection.
  960. @end table
  961. @subsection Examples
  962. @itemize
  963. @item
  964. Use @command{ffmpeg} to stream over UDP to a remote endpoint:
  965. @example
  966. ffmpeg -i @var{input} -f @var{format} udp://@var{hostname}:@var{port}
  967. @end example
  968. @item
  969. Use @command{ffmpeg} to stream in mpegts format over UDP using 188
  970. sized UDP packets, using a large input buffer:
  971. @example
  972. ffmpeg -i @var{input} -f mpegts udp://@var{hostname}:@var{port}?pkt_size=188&buffer_size=65535
  973. @end example
  974. @item
  975. Use @command{ffmpeg} to receive over UDP from a remote endpoint:
  976. @example
  977. ffmpeg -i udp://[@var{multicast-address}]:@var{port} ...
  978. @end example
  979. @end itemize
  980. @section unix
  981. Unix local socket
  982. The required syntax for a Unix socket URL is:
  983. @example
  984. unix://@var{filepath}
  985. @end example
  986. The following parameters can be set via command line options
  987. (or in code via @code{AVOption}s):
  988. @table @option
  989. @item timeout
  990. Timeout in ms.
  991. @item listen
  992. Create the Unix socket in listening mode.
  993. @end table
  994. @c man end PROTOCOLS