indevs.texi 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368
  1. @chapter Input Devices
  2. @c man begin INPUT DEVICES
  3. Input devices are configured elements in FFmpeg which enable accessing
  4. the data coming from a multimedia device attached to your system.
  5. When you configure your FFmpeg build, all the supported input devices
  6. are enabled by default. You can list all available ones using the
  7. configure option "--list-indevs".
  8. You can disable all the input devices using the configure option
  9. "--disable-indevs", and selectively enable an input device using the
  10. option "--enable-indev=@var{INDEV}", or you can disable a particular
  11. input device using the option "--disable-indev=@var{INDEV}".
  12. The option "-devices" of the ff* tools will display the list of
  13. supported input devices.
  14. A description of the currently available input devices follows.
  15. @section alsa
  16. ALSA (Advanced Linux Sound Architecture) input device.
  17. To enable this input device during configuration you need libasound
  18. installed on your system.
  19. This device allows capturing from an ALSA device. The name of the
  20. device to capture has to be an ALSA card identifier.
  21. An ALSA identifier has the syntax:
  22. @example
  23. hw:@var{CARD}[,@var{DEV}[,@var{SUBDEV}]]
  24. @end example
  25. where the @var{DEV} and @var{SUBDEV} components are optional.
  26. The three arguments (in order: @var{CARD},@var{DEV},@var{SUBDEV})
  27. specify card number or identifier, device number and subdevice number
  28. (-1 means any).
  29. To see the list of cards currently recognized by your system check the
  30. files @file{/proc/asound/cards} and @file{/proc/asound/devices}.
  31. For example to capture with @command{ffmpeg} from an ALSA device with
  32. card id 0, you may run the command:
  33. @example
  34. ffmpeg -f alsa -i hw:0 alsaout.wav
  35. @end example
  36. For more information see:
  37. @url{http://www.alsa-project.org/alsa-doc/alsa-lib/pcm.html}
  38. @subsection Options
  39. @table @option
  40. @item sample_rate
  41. Set the sample rate in Hz. Default is 48000.
  42. @item channels
  43. Set the number of channels. Default is 2.
  44. @end table
  45. @section avfoundation
  46. AVFoundation input device.
  47. AVFoundation is the currently recommended framework by Apple for streamgrabbing on OSX >= 10.7 as well as on iOS.
  48. The older QTKit framework has been marked deprecated since OSX version 10.7.
  49. The input filename has to be given in the following syntax:
  50. @example
  51. -i "[[VIDEO]:[AUDIO]]"
  52. @end example
  53. The first entry selects the video input while the latter selects the audio input.
  54. The stream has to be specified by the device name or the device index as shown by the device list.
  55. Alternatively, the video and/or audio input device can be chosen by index using the
  56. @option{
  57. -video_device_index <INDEX>
  58. }
  59. and/or
  60. @option{
  61. -audio_device_index <INDEX>
  62. }
  63. , overriding any
  64. device name or index given in the input filename.
  65. All available devices can be enumerated by using @option{-list_devices true}, listing
  66. all device names and corresponding indices.
  67. There are two device name aliases:
  68. @table @code
  69. @item default
  70. Select the AVFoundation default device of the corresponding type.
  71. @item none
  72. Do not record the corresponding media type.
  73. This is equivalent to specifying an empty device name or index.
  74. @end table
  75. @subsection Options
  76. AVFoundation supports the following options:
  77. @table @option
  78. @item -list_devices <TRUE|FALSE>
  79. If set to true, a list of all available input devices is given showing all
  80. device names and indices.
  81. @item -video_device_index <INDEX>
  82. Specify the video device by its index. Overrides anything given in the input filename.
  83. @item -audio_device_index <INDEX>
  84. Specify the audio device by its index. Overrides anything given in the input filename.
  85. @item -pixel_format <FORMAT>
  86. Request the video device to use a specific pixel format.
  87. If the specified format is not supported, a list of available formats is given
  88. und the first one in this list is used instead. Available pixel formats are:
  89. @code{monob, rgb555be, rgb555le, rgb565be, rgb565le, rgb24, bgr24, 0rgb, bgr0, 0bgr, rgb0,
  90. bgr48be, uyvy422, yuva444p, yuva444p16le, yuv444p, yuv422p16, yuv422p10, yuv444p10,
  91. yuv420p, nv12, yuyv422, gray}
  92. @item -framerate
  93. Set the grabbing frame rate. Default is @code{ntsc}, corresponding to a
  94. frame rate of @code{30000/1001}.
  95. @item -video_size
  96. Set the video frame size.
  97. @item -capture_cursor
  98. Capture the mouse pointer. Default is 0.
  99. @item -capture_mouse_clicks
  100. Capture the screen mouse clicks. Default is 0.
  101. @end table
  102. @subsection Examples
  103. @itemize
  104. @item
  105. Print the list of AVFoundation supported devices and exit:
  106. @example
  107. $ ffmpeg -f avfoundation -list_devices true -i ""
  108. @end example
  109. @item
  110. Record video from video device 0 and audio from audio device 0 into out.avi:
  111. @example
  112. $ ffmpeg -f avfoundation -i "0:0" out.avi
  113. @end example
  114. @item
  115. Record video from video device 2 and audio from audio device 1 into out.avi:
  116. @example
  117. $ ffmpeg -f avfoundation -video_device_index 2 -i ":1" out.avi
  118. @end example
  119. @item
  120. Record video from the system default video device using the pixel format bgr0 and do not record any audio into out.avi:
  121. @example
  122. $ ffmpeg -f avfoundation -pixel_format bgr0 -i "default:none" out.avi
  123. @end example
  124. @end itemize
  125. @section bktr
  126. BSD video input device.
  127. @subsection Options
  128. @table @option
  129. @item framerate
  130. Set the frame rate.
  131. @item video_size
  132. Set the video frame size. Default is @code{vga}.
  133. @item standard
  134. Available values are:
  135. @table @samp
  136. @item pal
  137. @item ntsc
  138. @item secam
  139. @item paln
  140. @item palm
  141. @item ntscj
  142. @end table
  143. @end table
  144. @section decklink
  145. The decklink input device provides capture capabilities for Blackmagic
  146. DeckLink devices.
  147. To enable this input device, you need the Blackmagic DeckLink SDK and you
  148. need to configure with the appropriate @code{--extra-cflags}
  149. and @code{--extra-ldflags}.
  150. On Windows, you need to run the IDL files through @command{widl}.
  151. DeckLink is very picky about the formats it supports. Pixel format is
  152. uyvy422 or v210, framerate and video size must be determined for your device with
  153. @command{-list_formats 1}. Audio sample rate is always 48 kHz and the number
  154. of channels can be 2, 8 or 16.
  155. @subsection Options
  156. @table @option
  157. @item list_devices
  158. If set to @option{true}, print a list of devices and exit.
  159. Defaults to @option{false}.
  160. @item list_formats
  161. If set to @option{true}, print a list of supported formats and exit.
  162. Defaults to @option{false}.
  163. @item bm_v210
  164. If set to @samp{1}, video is captured in 10 bit v210 instead
  165. of uyvy422. Not all Blackmagic devices support this option.
  166. @end table
  167. @subsection Examples
  168. @itemize
  169. @item
  170. List input devices:
  171. @example
  172. ffmpeg -f decklink -list_devices 1 -i dummy
  173. @end example
  174. @item
  175. List supported formats:
  176. @example
  177. ffmpeg -f decklink -list_formats 1 -i 'Intensity Pro'
  178. @end example
  179. @item
  180. Capture video clip at 1080i50 (format 11):
  181. @example
  182. ffmpeg -f decklink -i 'Intensity Pro@@11' -acodec copy -vcodec copy output.avi
  183. @end example
  184. @item
  185. Capture video clip at 1080i50 10 bit:
  186. @example
  187. ffmpeg -bm_v210 1 -f decklink -i 'UltraStudio Mini Recorder@@11' -acodec copy -vcodec copy output.avi
  188. @end example
  189. @end itemize
  190. @section dshow
  191. Windows DirectShow input device.
  192. DirectShow support is enabled when FFmpeg is built with the mingw-w64 project.
  193. Currently only audio and video devices are supported.
  194. Multiple devices may be opened as separate inputs, but they may also be
  195. opened on the same input, which should improve synchronism between them.
  196. The input name should be in the format:
  197. @example
  198. @var{TYPE}=@var{NAME}[:@var{TYPE}=@var{NAME}]
  199. @end example
  200. where @var{TYPE} can be either @var{audio} or @var{video},
  201. and @var{NAME} is the device's name or alternative name..
  202. @subsection Options
  203. If no options are specified, the device's defaults are used.
  204. If the device does not support the requested options, it will
  205. fail to open.
  206. @table @option
  207. @item video_size
  208. Set the video size in the captured video.
  209. @item framerate
  210. Set the frame rate in the captured video.
  211. @item sample_rate
  212. Set the sample rate (in Hz) of the captured audio.
  213. @item sample_size
  214. Set the sample size (in bits) of the captured audio.
  215. @item channels
  216. Set the number of channels in the captured audio.
  217. @item list_devices
  218. If set to @option{true}, print a list of devices and exit.
  219. @item list_options
  220. If set to @option{true}, print a list of selected device's options
  221. and exit.
  222. @item video_device_number
  223. Set video device number for devices with the same name (starts at 0,
  224. defaults to 0).
  225. @item audio_device_number
  226. Set audio device number for devices with the same name (starts at 0,
  227. defaults to 0).
  228. @item pixel_format
  229. Select pixel format to be used by DirectShow. This may only be set when
  230. the video codec is not set or set to rawvideo.
  231. @item audio_buffer_size
  232. Set audio device buffer size in milliseconds (which can directly
  233. impact latency, depending on the device).
  234. Defaults to using the audio device's
  235. default buffer size (typically some multiple of 500ms).
  236. Setting this value too low can degrade performance.
  237. See also
  238. @url{http://msdn.microsoft.com/en-us/library/windows/desktop/dd377582(v=vs.85).aspx}
  239. @item video_pin_name
  240. Select video capture pin to use by name or alternative name.
  241. @item audio_pin_name
  242. Select audio capture pin to use by name or alternative name.
  243. @item crossbar_video_input_pin_number
  244. Select video input pin number for crossbar device. This will be
  245. routed to the crossbar device's Video Decoder output pin.
  246. Note that changing this value can affect future invocations
  247. (sets a new default) until system reboot occurs.
  248. @item crossbar_audio_input_pin_number
  249. Select audio input pin number for crossbar device. This will be
  250. routed to the crossbar device's Audio Decoder output pin.
  251. Note that changing this value can affect future invocations
  252. (sets a new default) until system reboot occurs.
  253. @item show_video_device_dialog
  254. If set to @option{true}, before capture starts, popup a display dialog
  255. to the end user, allowing them to change video filter properties
  256. and configurations manually.
  257. Note that for crossbar devices, adjusting values in this dialog
  258. may be needed at times to toggle between PAL (25 fps) and NTSC (29.97)
  259. input frame rates, sizes, interlacing, etc. Changing these values can
  260. enable different scan rates/frame rates and avoiding green bars at
  261. the bottom, flickering scan lines, etc.
  262. Note that with some devices, changing these properties can also affect future
  263. invocations (sets new defaults) until system reboot occurs.
  264. @item show_audio_device_dialog
  265. If set to @option{true}, before capture starts, popup a display dialog
  266. to the end user, allowing them to change audio filter properties
  267. and configurations manually.
  268. @item show_video_crossbar_connection_dialog
  269. If set to @option{true}, before capture starts, popup a display
  270. dialog to the end user, allowing them to manually
  271. modify crossbar pin routings, when it opens a video device.
  272. @item show_audio_crossbar_connection_dialog
  273. If set to @option{true}, before capture starts, popup a display
  274. dialog to the end user, allowing them to manually
  275. modify crossbar pin routings, when it opens an audio device.
  276. @item show_analog_tv_tuner_dialog
  277. If set to @option{true}, before capture starts, popup a display
  278. dialog to the end user, allowing them to manually
  279. modify TV channels and frequencies.
  280. @item show_analog_tv_tuner_audio_dialog
  281. If set to @option{true}, before capture starts, popup a display
  282. dialog to the end user, allowing them to manually
  283. modify TV audio (like mono vs. stereo, Language A,B or C).
  284. @item audio_device_load
  285. Load an audio capture filter device from file instead of searching
  286. it by name. It may load additional parameters too, if the filter
  287. supports the serialization of its properties to.
  288. To use this an audio capture source has to be specified, but it can
  289. be anything even fake one.
  290. @item audio_device_save
  291. Save the currently used audio capture filter device and its
  292. parameters (if the filter supports it) to a file.
  293. If a file with the same name exists it will be overwritten.
  294. @item video_device_load
  295. Load a video capture filter device from file instead of searching
  296. it by name. It may load additional parameters too, if the filter
  297. supports the serialization of its properties to.
  298. To use this a video capture source has to be specified, but it can
  299. be anything even fake one.
  300. @item video_device_save
  301. Save the currently used video capture filter device and its
  302. parameters (if the filter supports it) to a file.
  303. If a file with the same name exists it will be overwritten.
  304. @end table
  305. @subsection Examples
  306. @itemize
  307. @item
  308. Print the list of DirectShow supported devices and exit:
  309. @example
  310. $ ffmpeg -list_devices true -f dshow -i dummy
  311. @end example
  312. @item
  313. Open video device @var{Camera}:
  314. @example
  315. $ ffmpeg -f dshow -i video="Camera"
  316. @end example
  317. @item
  318. Open second video device with name @var{Camera}:
  319. @example
  320. $ ffmpeg -f dshow -video_device_number 1 -i video="Camera"
  321. @end example
  322. @item
  323. Open video device @var{Camera} and audio device @var{Microphone}:
  324. @example
  325. $ ffmpeg -f dshow -i video="Camera":audio="Microphone"
  326. @end example
  327. @item
  328. Print the list of supported options in selected device and exit:
  329. @example
  330. $ ffmpeg -list_options true -f dshow -i video="Camera"
  331. @end example
  332. @item
  333. Specify pin names to capture by name or alternative name, specify alternative device name:
  334. @example
  335. $ ffmpeg -f dshow -audio_pin_name "Audio Out" -video_pin_name 2 -i video=video="@@device_pnp_\\?\pci#ven_1a0a&dev_6200&subsys_62021461&rev_01#4&e2c7dd6&0&00e1#@{65e8773d-8f56-11d0-a3b9-00a0c9223196@}\@{ca465100-deb0-4d59-818f-8c477184adf6@}":audio="Microphone"
  336. @end example
  337. @item
  338. Configure a crossbar device, specifying crossbar pins, allow user to adjust video capture properties at startup:
  339. @example
  340. $ ffmpeg -f dshow -show_video_device_dialog true -crossbar_video_input_pin_number 0
  341. -crossbar_audio_input_pin_number 3 -i video="AVerMedia BDA Analog Capture":audio="AVerMedia BDA Analog Capture"
  342. @end example
  343. @end itemize
  344. @section dv1394
  345. Linux DV 1394 input device.
  346. @subsection Options
  347. @table @option
  348. @item framerate
  349. Set the frame rate. Default is 25.
  350. @item standard
  351. Available values are:
  352. @table @samp
  353. @item pal
  354. @item ntsc
  355. @end table
  356. Default value is @code{ntsc}.
  357. @end table
  358. @section fbdev
  359. Linux framebuffer input device.
  360. The Linux framebuffer is a graphic hardware-independent abstraction
  361. layer to show graphics on a computer monitor, typically on the
  362. console. It is accessed through a file device node, usually
  363. @file{/dev/fb0}.
  364. For more detailed information read the file
  365. Documentation/fb/framebuffer.txt included in the Linux source tree.
  366. See also @url{http://linux-fbdev.sourceforge.net/}, and fbset(1).
  367. To record from the framebuffer device @file{/dev/fb0} with
  368. @command{ffmpeg}:
  369. @example
  370. ffmpeg -f fbdev -framerate 10 -i /dev/fb0 out.avi
  371. @end example
  372. You can take a single screenshot image with the command:
  373. @example
  374. ffmpeg -f fbdev -framerate 1 -i /dev/fb0 -frames:v 1 screenshot.jpeg
  375. @end example
  376. @subsection Options
  377. @table @option
  378. @item framerate
  379. Set the frame rate. Default is 25.
  380. @end table
  381. @section gdigrab
  382. Win32 GDI-based screen capture device.
  383. This device allows you to capture a region of the display on Windows.
  384. There are two options for the input filename:
  385. @example
  386. desktop
  387. @end example
  388. or
  389. @example
  390. title=@var{window_title}
  391. @end example
  392. The first option will capture the entire desktop, or a fixed region of the
  393. desktop. The second option will instead capture the contents of a single
  394. window, regardless of its position on the screen.
  395. For example, to grab the entire desktop using @command{ffmpeg}:
  396. @example
  397. ffmpeg -f gdigrab -framerate 6 -i desktop out.mpg
  398. @end example
  399. Grab a 640x480 region at position @code{10,20}:
  400. @example
  401. ffmpeg -f gdigrab -framerate 6 -offset_x 10 -offset_y 20 -video_size vga -i desktop out.mpg
  402. @end example
  403. Grab the contents of the window named "Calculator"
  404. @example
  405. ffmpeg -f gdigrab -framerate 6 -i title=Calculator out.mpg
  406. @end example
  407. @subsection Options
  408. @table @option
  409. @item draw_mouse
  410. Specify whether to draw the mouse pointer. Use the value @code{0} to
  411. not draw the pointer. Default value is @code{1}.
  412. @item framerate
  413. Set the grabbing frame rate. Default value is @code{ntsc},
  414. corresponding to a frame rate of @code{30000/1001}.
  415. @item show_region
  416. Show grabbed region on screen.
  417. If @var{show_region} is specified with @code{1}, then the grabbing
  418. region will be indicated on screen. With this option, it is easy to
  419. know what is being grabbed if only a portion of the screen is grabbed.
  420. Note that @var{show_region} is incompatible with grabbing the contents
  421. of a single window.
  422. For example:
  423. @example
  424. ffmpeg -f gdigrab -show_region 1 -framerate 6 -video_size cif -offset_x 10 -offset_y 20 -i desktop out.mpg
  425. @end example
  426. @item video_size
  427. Set the video frame size. The default is to capture the full screen if @file{desktop} is selected, or the full window size if @file{title=@var{window_title}} is selected.
  428. @item offset_x
  429. When capturing a region with @var{video_size}, set the distance from the left edge of the screen or desktop.
  430. Note that the offset calculation is from the top left corner of the primary monitor on Windows. If you have a monitor positioned to the left of your primary monitor, you will need to use a negative @var{offset_x} value to move the region to that monitor.
  431. @item offset_y
  432. When capturing a region with @var{video_size}, set the distance from the top edge of the screen or desktop.
  433. Note that the offset calculation is from the top left corner of the primary monitor on Windows. If you have a monitor positioned above your primary monitor, you will need to use a negative @var{offset_y} value to move the region to that monitor.
  434. @end table
  435. @section iec61883
  436. FireWire DV/HDV input device using libiec61883.
  437. To enable this input device, you need libiec61883, libraw1394 and
  438. libavc1394 installed on your system. Use the configure option
  439. @code{--enable-libiec61883} to compile with the device enabled.
  440. The iec61883 capture device supports capturing from a video device
  441. connected via IEEE1394 (FireWire), using libiec61883 and the new Linux
  442. FireWire stack (juju). This is the default DV/HDV input method in Linux
  443. Kernel 2.6.37 and later, since the old FireWire stack was removed.
  444. Specify the FireWire port to be used as input file, or "auto"
  445. to choose the first port connected.
  446. @subsection Options
  447. @table @option
  448. @item dvtype
  449. Override autodetection of DV/HDV. This should only be used if auto
  450. detection does not work, or if usage of a different device type
  451. should be prohibited. Treating a DV device as HDV (or vice versa) will
  452. not work and result in undefined behavior.
  453. The values @option{auto}, @option{dv} and @option{hdv} are supported.
  454. @item dvbuffer
  455. Set maximum size of buffer for incoming data, in frames. For DV, this
  456. is an exact value. For HDV, it is not frame exact, since HDV does
  457. not have a fixed frame size.
  458. @item dvguid
  459. Select the capture device by specifying it's GUID. Capturing will only
  460. be performed from the specified device and fails if no device with the
  461. given GUID is found. This is useful to select the input if multiple
  462. devices are connected at the same time.
  463. Look at /sys/bus/firewire/devices to find out the GUIDs.
  464. @end table
  465. @subsection Examples
  466. @itemize
  467. @item
  468. Grab and show the input of a FireWire DV/HDV device.
  469. @example
  470. ffplay -f iec61883 -i auto
  471. @end example
  472. @item
  473. Grab and record the input of a FireWire DV/HDV device,
  474. using a packet buffer of 100000 packets if the source is HDV.
  475. @example
  476. ffmpeg -f iec61883 -i auto -hdvbuffer 100000 out.mpg
  477. @end example
  478. @end itemize
  479. @section jack
  480. JACK input device.
  481. To enable this input device during configuration you need libjack
  482. installed on your system.
  483. A JACK input device creates one or more JACK writable clients, one for
  484. each audio channel, with name @var{client_name}:input_@var{N}, where
  485. @var{client_name} is the name provided by the application, and @var{N}
  486. is a number which identifies the channel.
  487. Each writable client will send the acquired data to the FFmpeg input
  488. device.
  489. Once you have created one or more JACK readable clients, you need to
  490. connect them to one or more JACK writable clients.
  491. To connect or disconnect JACK clients you can use the @command{jack_connect}
  492. and @command{jack_disconnect} programs, or do it through a graphical interface,
  493. for example with @command{qjackctl}.
  494. To list the JACK clients and their properties you can invoke the command
  495. @command{jack_lsp}.
  496. Follows an example which shows how to capture a JACK readable client
  497. with @command{ffmpeg}.
  498. @example
  499. # Create a JACK writable client with name "ffmpeg".
  500. $ ffmpeg -f jack -i ffmpeg -y out.wav
  501. # Start the sample jack_metro readable client.
  502. $ jack_metro -b 120 -d 0.2 -f 4000
  503. # List the current JACK clients.
  504. $ jack_lsp -c
  505. system:capture_1
  506. system:capture_2
  507. system:playback_1
  508. system:playback_2
  509. ffmpeg:input_1
  510. metro:120_bpm
  511. # Connect metro to the ffmpeg writable client.
  512. $ jack_connect metro:120_bpm ffmpeg:input_1
  513. @end example
  514. For more information read:
  515. @url{http://jackaudio.org/}
  516. @subsection Options
  517. @table @option
  518. @item channels
  519. Set the number of channels. Default is 2.
  520. @end table
  521. @section lavfi
  522. Libavfilter input virtual device.
  523. This input device reads data from the open output pads of a libavfilter
  524. filtergraph.
  525. For each filtergraph open output, the input device will create a
  526. corresponding stream which is mapped to the generated output. Currently
  527. only video data is supported. The filtergraph is specified through the
  528. option @option{graph}.
  529. @subsection Options
  530. @table @option
  531. @item graph
  532. Specify the filtergraph to use as input. Each video open output must be
  533. labelled by a unique string of the form "out@var{N}", where @var{N} is a
  534. number starting from 0 corresponding to the mapped input stream
  535. generated by the device.
  536. The first unlabelled output is automatically assigned to the "out0"
  537. label, but all the others need to be specified explicitly.
  538. The suffix "+subcc" can be appended to the output label to create an extra
  539. stream with the closed captions packets attached to that output
  540. (experimental; only for EIA-608 / CEA-708 for now).
  541. The subcc streams are created after all the normal streams, in the order of
  542. the corresponding stream.
  543. For example, if there is "out19+subcc", "out7+subcc" and up to "out42", the
  544. stream #43 is subcc for stream #7 and stream #44 is subcc for stream #19.
  545. If not specified defaults to the filename specified for the input
  546. device.
  547. @item graph_file
  548. Set the filename of the filtergraph to be read and sent to the other
  549. filters. Syntax of the filtergraph is the same as the one specified by
  550. the option @var{graph}.
  551. @item dumpgraph
  552. Dump graph to stderr.
  553. @end table
  554. @subsection Examples
  555. @itemize
  556. @item
  557. Create a color video stream and play it back with @command{ffplay}:
  558. @example
  559. ffplay -f lavfi -graph "color=c=pink [out0]" dummy
  560. @end example
  561. @item
  562. As the previous example, but use filename for specifying the graph
  563. description, and omit the "out0" label:
  564. @example
  565. ffplay -f lavfi color=c=pink
  566. @end example
  567. @item
  568. Create three different video test filtered sources and play them:
  569. @example
  570. ffplay -f lavfi -graph "testsrc [out0]; testsrc,hflip [out1]; testsrc,negate [out2]" test3
  571. @end example
  572. @item
  573. Read an audio stream from a file using the amovie source and play it
  574. back with @command{ffplay}:
  575. @example
  576. ffplay -f lavfi "amovie=test.wav"
  577. @end example
  578. @item
  579. Read an audio stream and a video stream and play it back with
  580. @command{ffplay}:
  581. @example
  582. ffplay -f lavfi "movie=test.avi[out0];amovie=test.wav[out1]"
  583. @end example
  584. @item
  585. Dump decoded frames to images and closed captions to a file (experimental):
  586. @example
  587. ffmpeg -f lavfi -i "movie=test.ts[out0+subcc]" -map v frame%08d.png -map s -c copy -f rawvideo subcc.bin
  588. @end example
  589. @end itemize
  590. @section libcdio
  591. Audio-CD input device based on libcdio.
  592. To enable this input device during configuration you need libcdio
  593. installed on your system. It requires the configure option
  594. @code{--enable-libcdio}.
  595. This device allows playing and grabbing from an Audio-CD.
  596. For example to copy with @command{ffmpeg} the entire Audio-CD in @file{/dev/sr0},
  597. you may run the command:
  598. @example
  599. ffmpeg -f libcdio -i /dev/sr0 cd.wav
  600. @end example
  601. @subsection Options
  602. @table @option
  603. @item speed
  604. Set drive reading speed. Default value is 0.
  605. The speed is specified CD-ROM speed units. The speed is set through
  606. the libcdio @code{cdio_cddap_speed_set} function. On many CD-ROM
  607. drives, specifying a value too large will result in using the fastest
  608. speed.
  609. @item paranoia_mode
  610. Set paranoia recovery mode flags. It accepts one of the following values:
  611. @table @samp
  612. @item disable
  613. @item verify
  614. @item overlap
  615. @item neverskip
  616. @item full
  617. @end table
  618. Default value is @samp{disable}.
  619. For more information about the available recovery modes, consult the
  620. paranoia project documentation.
  621. @end table
  622. @section libdc1394
  623. IIDC1394 input device, based on libdc1394 and libraw1394.
  624. Requires the configure option @code{--enable-libdc1394}.
  625. @section openal
  626. The OpenAL input device provides audio capture on all systems with a
  627. working OpenAL 1.1 implementation.
  628. To enable this input device during configuration, you need OpenAL
  629. headers and libraries installed on your system, and need to configure
  630. FFmpeg with @code{--enable-openal}.
  631. OpenAL headers and libraries should be provided as part of your OpenAL
  632. implementation, or as an additional download (an SDK). Depending on your
  633. installation you may need to specify additional flags via the
  634. @code{--extra-cflags} and @code{--extra-ldflags} for allowing the build
  635. system to locate the OpenAL headers and libraries.
  636. An incomplete list of OpenAL implementations follows:
  637. @table @strong
  638. @item Creative
  639. The official Windows implementation, providing hardware acceleration
  640. with supported devices and software fallback.
  641. See @url{http://openal.org/}.
  642. @item OpenAL Soft
  643. Portable, open source (LGPL) software implementation. Includes
  644. backends for the most common sound APIs on the Windows, Linux,
  645. Solaris, and BSD operating systems.
  646. See @url{http://kcat.strangesoft.net/openal.html}.
  647. @item Apple
  648. OpenAL is part of Core Audio, the official Mac OS X Audio interface.
  649. See @url{http://developer.apple.com/technologies/mac/audio-and-video.html}
  650. @end table
  651. This device allows one to capture from an audio input device handled
  652. through OpenAL.
  653. You need to specify the name of the device to capture in the provided
  654. filename. If the empty string is provided, the device will
  655. automatically select the default device. You can get the list of the
  656. supported devices by using the option @var{list_devices}.
  657. @subsection Options
  658. @table @option
  659. @item channels
  660. Set the number of channels in the captured audio. Only the values
  661. @option{1} (monaural) and @option{2} (stereo) are currently supported.
  662. Defaults to @option{2}.
  663. @item sample_size
  664. Set the sample size (in bits) of the captured audio. Only the values
  665. @option{8} and @option{16} are currently supported. Defaults to
  666. @option{16}.
  667. @item sample_rate
  668. Set the sample rate (in Hz) of the captured audio.
  669. Defaults to @option{44.1k}.
  670. @item list_devices
  671. If set to @option{true}, print a list of devices and exit.
  672. Defaults to @option{false}.
  673. @end table
  674. @subsection Examples
  675. Print the list of OpenAL supported devices and exit:
  676. @example
  677. $ ffmpeg -list_devices true -f openal -i dummy out.ogg
  678. @end example
  679. Capture from the OpenAL device @file{DR-BT101 via PulseAudio}:
  680. @example
  681. $ ffmpeg -f openal -i 'DR-BT101 via PulseAudio' out.ogg
  682. @end example
  683. Capture from the default device (note the empty string '' as filename):
  684. @example
  685. $ ffmpeg -f openal -i '' out.ogg
  686. @end example
  687. Capture from two devices simultaneously, writing to two different files,
  688. within the same @command{ffmpeg} command:
  689. @example
  690. $ ffmpeg -f openal -i 'DR-BT101 via PulseAudio' out1.ogg -f openal -i 'ALSA Default' out2.ogg
  691. @end example
  692. Note: not all OpenAL implementations support multiple simultaneous capture -
  693. try the latest OpenAL Soft if the above does not work.
  694. @section oss
  695. Open Sound System input device.
  696. The filename to provide to the input device is the device node
  697. representing the OSS input device, and is usually set to
  698. @file{/dev/dsp}.
  699. For example to grab from @file{/dev/dsp} using @command{ffmpeg} use the
  700. command:
  701. @example
  702. ffmpeg -f oss -i /dev/dsp /tmp/oss.wav
  703. @end example
  704. For more information about OSS see:
  705. @url{http://manuals.opensound.com/usersguide/dsp.html}
  706. @subsection Options
  707. @table @option
  708. @item sample_rate
  709. Set the sample rate in Hz. Default is 48000.
  710. @item channels
  711. Set the number of channels. Default is 2.
  712. @end table
  713. @section pulse
  714. PulseAudio input device.
  715. To enable this output device you need to configure FFmpeg with @code{--enable-libpulse}.
  716. The filename to provide to the input device is a source device or the
  717. string "default"
  718. To list the PulseAudio source devices and their properties you can invoke
  719. the command @command{pactl list sources}.
  720. More information about PulseAudio can be found on @url{http://www.pulseaudio.org}.
  721. @subsection Options
  722. @table @option
  723. @item server
  724. Connect to a specific PulseAudio server, specified by an IP address.
  725. Default server is used when not provided.
  726. @item name
  727. Specify the application name PulseAudio will use when showing active clients,
  728. by default it is the @code{LIBAVFORMAT_IDENT} string.
  729. @item stream_name
  730. Specify the stream name PulseAudio will use when showing active streams,
  731. by default it is "record".
  732. @item sample_rate
  733. Specify the samplerate in Hz, by default 48kHz is used.
  734. @item channels
  735. Specify the channels in use, by default 2 (stereo) is set.
  736. @item frame_size
  737. Specify the number of bytes per frame, by default it is set to 1024.
  738. @item fragment_size
  739. Specify the minimal buffering fragment in PulseAudio, it will affect the
  740. audio latency. By default it is unset.
  741. @item wallclock
  742. Set the initial PTS using the current time. Default is 1.
  743. @end table
  744. @subsection Examples
  745. Record a stream from default device:
  746. @example
  747. ffmpeg -f pulse -i default /tmp/pulse.wav
  748. @end example
  749. @section qtkit
  750. QTKit input device.
  751. The filename passed as input is parsed to contain either a device name or index.
  752. The device index can also be given by using -video_device_index.
  753. A given device index will override any given device name.
  754. If the desired device consists of numbers only, use -video_device_index to identify it.
  755. The default device will be chosen if an empty string or the device name "default" is given.
  756. The available devices can be enumerated by using -list_devices.
  757. @example
  758. ffmpeg -f qtkit -i "0" out.mpg
  759. @end example
  760. @example
  761. ffmpeg -f qtkit -video_device_index 0 -i "" out.mpg
  762. @end example
  763. @example
  764. ffmpeg -f qtkit -i "default" out.mpg
  765. @end example
  766. @example
  767. ffmpeg -f qtkit -list_devices true -i ""
  768. @end example
  769. @subsection Options
  770. @table @option
  771. @item frame_rate
  772. Set frame rate. Default is 30.
  773. @item list_devices
  774. If set to @code{true}, print a list of devices and exit. Default is
  775. @code{false}.
  776. @item video_device_index
  777. Select the video device by index for devices with the same name (starts at 0).
  778. @end table
  779. @section sndio
  780. sndio input device.
  781. To enable this input device during configuration you need libsndio
  782. installed on your system.
  783. The filename to provide to the input device is the device node
  784. representing the sndio input device, and is usually set to
  785. @file{/dev/audio0}.
  786. For example to grab from @file{/dev/audio0} using @command{ffmpeg} use the
  787. command:
  788. @example
  789. ffmpeg -f sndio -i /dev/audio0 /tmp/oss.wav
  790. @end example
  791. @subsection Options
  792. @table @option
  793. @item sample_rate
  794. Set the sample rate in Hz. Default is 48000.
  795. @item channels
  796. Set the number of channels. Default is 2.
  797. @end table
  798. @section video4linux2, v4l2
  799. Video4Linux2 input video device.
  800. "v4l2" can be used as alias for "video4linux2".
  801. If FFmpeg is built with v4l-utils support (by using the
  802. @code{--enable-libv4l2} configure option), it is possible to use it with the
  803. @code{-use_libv4l2} input device option.
  804. The name of the device to grab is a file device node, usually Linux
  805. systems tend to automatically create such nodes when the device
  806. (e.g. an USB webcam) is plugged into the system, and has a name of the
  807. kind @file{/dev/video@var{N}}, where @var{N} is a number associated to
  808. the device.
  809. Video4Linux2 devices usually support a limited set of
  810. @var{width}x@var{height} sizes and frame rates. You can check which are
  811. supported using @command{-list_formats all} for Video4Linux2 devices.
  812. Some devices, like TV cards, support one or more standards. It is possible
  813. to list all the supported standards using @command{-list_standards all}.
  814. The time base for the timestamps is 1 microsecond. Depending on the kernel
  815. version and configuration, the timestamps may be derived from the real time
  816. clock (origin at the Unix Epoch) or the monotonic clock (origin usually at
  817. boot time, unaffected by NTP or manual changes to the clock). The
  818. @option{-timestamps abs} or @option{-ts abs} option can be used to force
  819. conversion into the real time clock.
  820. Some usage examples of the video4linux2 device with @command{ffmpeg}
  821. and @command{ffplay}:
  822. @itemize
  823. @item
  824. List supported formats for a video4linux2 device:
  825. @example
  826. ffplay -f video4linux2 -list_formats all /dev/video0
  827. @end example
  828. @item
  829. Grab and show the input of a video4linux2 device:
  830. @example
  831. ffplay -f video4linux2 -framerate 30 -video_size hd720 /dev/video0
  832. @end example
  833. @item
  834. Grab and record the input of a video4linux2 device, leave the
  835. frame rate and size as previously set:
  836. @example
  837. ffmpeg -f video4linux2 -input_format mjpeg -i /dev/video0 out.mpeg
  838. @end example
  839. @end itemize
  840. For more information about Video4Linux, check @url{http://linuxtv.org/}.
  841. @subsection Options
  842. @table @option
  843. @item standard
  844. Set the standard. Must be the name of a supported standard. To get a
  845. list of the supported standards, use the @option{list_standards}
  846. option.
  847. @item channel
  848. Set the input channel number. Default to -1, which means using the
  849. previously selected channel.
  850. @item video_size
  851. Set the video frame size. The argument must be a string in the form
  852. @var{WIDTH}x@var{HEIGHT} or a valid size abbreviation.
  853. @item pixel_format
  854. Select the pixel format (only valid for raw video input).
  855. @item input_format
  856. Set the preferred pixel format (for raw video) or a codec name.
  857. This option allows one to select the input format, when several are
  858. available.
  859. @item framerate
  860. Set the preferred video frame rate.
  861. @item list_formats
  862. List available formats (supported pixel formats, codecs, and frame
  863. sizes) and exit.
  864. Available values are:
  865. @table @samp
  866. @item all
  867. Show all available (compressed and non-compressed) formats.
  868. @item raw
  869. Show only raw video (non-compressed) formats.
  870. @item compressed
  871. Show only compressed formats.
  872. @end table
  873. @item list_standards
  874. List supported standards and exit.
  875. Available values are:
  876. @table @samp
  877. @item all
  878. Show all supported standards.
  879. @end table
  880. @item timestamps, ts
  881. Set type of timestamps for grabbed frames.
  882. Available values are:
  883. @table @samp
  884. @item default
  885. Use timestamps from the kernel.
  886. @item abs
  887. Use absolute timestamps (wall clock).
  888. @item mono2abs
  889. Force conversion from monotonic to absolute timestamps.
  890. @end table
  891. Default value is @code{default}.
  892. @item use_libv4l2
  893. Use libv4l2 (v4l-utils) conversion functions. Default is 0.
  894. @end table
  895. @section vfwcap
  896. VfW (Video for Windows) capture input device.
  897. The filename passed as input is the capture driver number, ranging from
  898. 0 to 9. You may use "list" as filename to print a list of drivers. Any
  899. other filename will be interpreted as device number 0.
  900. @subsection Options
  901. @table @option
  902. @item video_size
  903. Set the video frame size.
  904. @item framerate
  905. Set the grabbing frame rate. Default value is @code{ntsc},
  906. corresponding to a frame rate of @code{30000/1001}.
  907. @end table
  908. @section x11grab
  909. X11 video input device.
  910. To enable this input device during configuration you need libxcb
  911. installed on your system. It will be automatically detected during
  912. configuration.
  913. Alternatively, the configure option @option{--enable-x11grab} exists
  914. for legacy Xlib users.
  915. This device allows one to capture a region of an X11 display.
  916. The filename passed as input has the syntax:
  917. @example
  918. [@var{hostname}]:@var{display_number}.@var{screen_number}[+@var{x_offset},@var{y_offset}]
  919. @end example
  920. @var{hostname}:@var{display_number}.@var{screen_number} specifies the
  921. X11 display name of the screen to grab from. @var{hostname} can be
  922. omitted, and defaults to "localhost". The environment variable
  923. @env{DISPLAY} contains the default display name.
  924. @var{x_offset} and @var{y_offset} specify the offsets of the grabbed
  925. area with respect to the top-left border of the X11 screen. They
  926. default to 0.
  927. Check the X11 documentation (e.g. @command{man X}) for more detailed
  928. information.
  929. Use the @command{xdpyinfo} program for getting basic information about
  930. the properties of your X11 display (e.g. grep for "name" or
  931. "dimensions").
  932. For example to grab from @file{:0.0} using @command{ffmpeg}:
  933. @example
  934. ffmpeg -f x11grab -framerate 25 -video_size cif -i :0.0 out.mpg
  935. @end example
  936. Grab at position @code{10,20}:
  937. @example
  938. ffmpeg -f x11grab -framerate 25 -video_size cif -i :0.0+10,20 out.mpg
  939. @end example
  940. @subsection Options
  941. @table @option
  942. @item draw_mouse
  943. Specify whether to draw the mouse pointer. A value of @code{0} specify
  944. not to draw the pointer. Default value is @code{1}.
  945. @item follow_mouse
  946. Make the grabbed area follow the mouse. The argument can be
  947. @code{centered} or a number of pixels @var{PIXELS}.
  948. When it is specified with "centered", the grabbing region follows the mouse
  949. pointer and keeps the pointer at the center of region; otherwise, the region
  950. follows only when the mouse pointer reaches within @var{PIXELS} (greater than
  951. zero) to the edge of region.
  952. For example:
  953. @example
  954. ffmpeg -f x11grab -follow_mouse centered -framerate 25 -video_size cif -i :0.0 out.mpg
  955. @end example
  956. To follow only when the mouse pointer reaches within 100 pixels to edge:
  957. @example
  958. ffmpeg -f x11grab -follow_mouse 100 -framerate 25 -video_size cif -i :0.0 out.mpg
  959. @end example
  960. @item framerate
  961. Set the grabbing frame rate. Default value is @code{ntsc},
  962. corresponding to a frame rate of @code{30000/1001}.
  963. @item show_region
  964. Show grabbed region on screen.
  965. If @var{show_region} is specified with @code{1}, then the grabbing
  966. region will be indicated on screen. With this option, it is easy to
  967. know what is being grabbed if only a portion of the screen is grabbed.
  968. @item region_border
  969. Set the region border thickness if @option{-show_region 1} is used.
  970. Range is 1 to 128 and default is 3 (XCB-based x11grab only).
  971. For example:
  972. @example
  973. ffmpeg -f x11grab -show_region 1 -framerate 25 -video_size cif -i :0.0+10,20 out.mpg
  974. @end example
  975. With @var{follow_mouse}:
  976. @example
  977. ffmpeg -f x11grab -follow_mouse centered -show_region 1 -framerate 25 -video_size cif -i :0.0 out.mpg
  978. @end example
  979. @item video_size
  980. Set the video frame size. Default value is @code{vga}.
  981. @item use_shm
  982. Use the MIT-SHM extension for shared memory. Default value is @code{1}.
  983. It may be necessary to disable it for remote displays (legacy x11grab
  984. only).
  985. @end table
  986. @subsection @var{grab_x} @var{grab_y} AVOption
  987. The syntax is:
  988. @example
  989. -grab_x @var{x_offset} -grab_y @var{y_offset}
  990. @end example
  991. Set the grabbing region coordinates. They are expressed as offset from the top left
  992. corner of the X11 window. The default value is 0.
  993. @c man end INPUT DEVICES