You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1425 lines
41KB

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