indevs.texi 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. @chapter Input Devices
  2. @c man begin INPUT DEVICES
  3. Input devices are configured elements in FFmpeg which allow to access
  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 "-formats" of the ff* tools will display the list of
  13. supported input devices (amongst the demuxers).
  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 @file{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. @section bktr
  39. BSD video input device.
  40. @section dv1394
  41. Linux DV 1394 input device.
  42. @section fbdev
  43. Linux framebuffer input device.
  44. The Linux framebuffer is a graphic hardware-independent abstraction
  45. layer to show graphics on a computer monitor, typically on the
  46. console. It is accessed through a file device node, usually
  47. @file{/dev/fb0}.
  48. For more detailed information read the file
  49. Documentation/fb/framebuffer.txt included in the Linux source tree.
  50. To record from the framebuffer device @file{/dev/fb0} with
  51. @file{ffmpeg}:
  52. @example
  53. ffmpeg -f fbdev -r 10 -i /dev/fb0 out.avi
  54. @end example
  55. You can take a single screenshot image with the command:
  56. @example
  57. ffmpeg -f fbdev -vframes 1 -r 1 -i /dev/fb0 screenshot.jpeg
  58. @end example
  59. See also @url{http://linux-fbdev.sourceforge.net/}, and fbset(1).
  60. @section jack
  61. JACK input device.
  62. To enable this input device during configuration you need libjack
  63. installed on your system.
  64. A JACK input device creates one or more JACK writable clients, one for
  65. each audio channel, with name @var{client_name}:input_@var{N}, where
  66. @var{client_name} is the name provided by the application, and @var{N}
  67. is a number which identifies the channel.
  68. Each writable client will send the acquired data to the FFmpeg input
  69. device.
  70. Once you have created one or more JACK readable clients, you need to
  71. connect them to one or more JACK writable clients.
  72. To connect or disconnect JACK clients you can use the
  73. @file{jack_connect} and @file{jack_disconnect} programs, or do it
  74. through a graphical interface, for example with @file{qjackctl}.
  75. To list the JACK clients and their properties you can invoke the command
  76. @file{jack_lsp}.
  77. Follows an example which shows how to capture a JACK readable client
  78. with @file{ffmpeg}.
  79. @example
  80. # Create a JACK writable client with name "ffmpeg".
  81. $ ffmpeg -f jack -i ffmpeg -y out.wav
  82. # Start the sample jack_metro readable client.
  83. $ jack_metro -b 120 -d 0.2 -f 4000
  84. # List the current JACK clients.
  85. $ jack_lsp -c
  86. system:capture_1
  87. system:capture_2
  88. system:playback_1
  89. system:playback_2
  90. ffmpeg:input_1
  91. metro:120_bpm
  92. # Connect metro to the ffmpeg writable client.
  93. $ jack_connect metro:120_bpm ffmpeg:input_1
  94. @end example
  95. For more information read:
  96. @url{http://jackaudio.org/}
  97. @section libdc1394
  98. IIDC1394 input device, based on libdc1394 and libraw1394.
  99. @section oss
  100. Open Sound System input device.
  101. The filename to provide to the input device is the device node
  102. representing the OSS input device, and is usually set to
  103. @file{/dev/dsp}.
  104. For example to grab from @file{/dev/dsp} using @file{ffmpeg} use the
  105. command:
  106. @example
  107. ffmpeg -f oss -i /dev/dsp /tmp/oss.wav
  108. @end example
  109. For more information about OSS see:
  110. @url{http://manuals.opensound.com/usersguide/dsp.html}
  111. @section sndio
  112. sndio input device.
  113. To enable this input device during configuration you need libsndio
  114. installed on your system.
  115. The filename to provide to the input device is the device node
  116. representing the sndio input device, and is usually set to
  117. @file{/dev/audio0}.
  118. For example to grab from @file{/dev/audio0} using @file{ffmpeg} use the
  119. command:
  120. @example
  121. ffmpeg -f sndio -i /dev/audio0 /tmp/oss.wav
  122. @end example
  123. @section video4linux and video4linux2
  124. Video4Linux and Video4Linux2 input video devices.
  125. The name of the device to grab is a file device node, usually Linux
  126. systems tend to automatically create such nodes when the device
  127. (e.g. an USB webcam) is plugged into the system, and has a name of the
  128. kind @file{/dev/video@var{N}}, where @var{N} is a number associated to
  129. the device.
  130. Video4Linux and Video4Linux2 devices only support a limited set of
  131. @var{width}x@var{height} sizes and framerates. You can check which are
  132. supported for example with the command @file{dov4l} for Video4Linux
  133. devices and the command @file{v4l-info} for Video4Linux2 devices.
  134. If the size for the device is set to 0x0, the input device will
  135. try to autodetect the size to use.
  136. Only for the video4linux2 device, if the frame rate is set to 0/0 the
  137. input device will use the frame rate value already set in the driver.
  138. Video4Linux support is deprecated since Linux 2.6.30, and will be
  139. dropped in later versions.
  140. Follow some usage examples of the video4linux devices with the ff*
  141. tools.
  142. @example
  143. # Grab and show the input of a video4linux device, frame rate is set
  144. # to the default of 25/1.
  145. ffplay -s 320x240 -f video4linux /dev/video0
  146. # Grab and show the input of a video4linux2 device, autoadjust size.
  147. ffplay -f video4linux2 /dev/video0
  148. # Grab and record the input of a video4linux2 device, autoadjust size,
  149. # frame rate value defaults to 0/0 so it is read from the video4linux2
  150. # driver.
  151. ffmpeg -f video4linux2 -i /dev/video0 out.mpeg
  152. @end example
  153. @section vfwcap
  154. VfW (Video for Windows) capture input device.
  155. The filename passed as input is the capture driver number, ranging from
  156. 0 to 9. You may use "list" as filename to print a list of drivers. Any
  157. other filename will be interpreted as device number 0.
  158. @section x11grab
  159. X11 video input device.
  160. This device allows to capture a region of an X11 display.
  161. The filename passed as input has the syntax:
  162. @example
  163. [@var{hostname}]:@var{display_number}.@var{screen_number}[+@var{x_offset},@var{y_offset}]
  164. @end example
  165. @var{hostname}:@var{display_number}.@var{screen_number} specifies the
  166. X11 display name of the screen to grab from. @var{hostname} can be
  167. ommitted, and defaults to "localhost". The environment variable
  168. @env{DISPLAY} contains the default display name.
  169. @var{x_offset} and @var{y_offset} specify the offsets of the grabbed
  170. area with respect to the top-left border of the X11 screen. They
  171. default to 0.
  172. Check the X11 documentation (e.g. man X) for more detailed information.
  173. Use the @file{dpyinfo} program for getting basic information about the
  174. properties of your X11 display (e.g. grep for "name" or "dimensions").
  175. For example to grab from @file{:0.0} using @file{ffmpeg}:
  176. @example
  177. ffmpeg -f x11grab -r 25 -s cif -i :0.0 out.mpg
  178. # Grab at position 10,20.
  179. ffmpeg -f x11grab -25 -s cif -i :0.0+10,20 out.mpg
  180. @end example
  181. @c man end INPUT DEVICES