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.

372 lines
10KB

  1. @chapter Input Devices
  2. @c man begin INPUT DEVICES
  3. Input devices are configured elements in Libav which allow to access
  4. the data coming from a multimedia device attached to your system.
  5. When you configure your Libav 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 av* 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 @command{avconv} from an ALSA device with
  32. card id 0, you may run the command:
  33. @example
  34. avconv -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 fbdev
  41. Linux framebuffer input device.
  42. The Linux framebuffer is a graphic hardware-independent abstraction
  43. layer to show graphics on a computer monitor, typically on the
  44. console. It is accessed through a file device node, usually
  45. @file{/dev/fb0}.
  46. For more detailed information read the file
  47. Documentation/fb/framebuffer.txt included in the Linux source tree.
  48. To record from the framebuffer device @file{/dev/fb0} with
  49. @command{avconv}:
  50. @example
  51. avconv -f fbdev -r 10 -i /dev/fb0 out.avi
  52. @end example
  53. You can take a single screenshot image with the command:
  54. @example
  55. avconv -f fbdev -frames:v 1 -r 1 -i /dev/fb0 screenshot.jpeg
  56. @end example
  57. See also @url{http://linux-fbdev.sourceforge.net/}, and fbset(1).
  58. @section jack
  59. JACK input device.
  60. To enable this input device during configuration you need libjack
  61. installed on your system.
  62. A JACK input device creates one or more JACK writable clients, one for
  63. each audio channel, with name @var{client_name}:input_@var{N}, where
  64. @var{client_name} is the name provided by the application, and @var{N}
  65. is a number which identifies the channel.
  66. Each writable client will send the acquired data to the Libav input
  67. device.
  68. Once you have created one or more JACK readable clients, you need to
  69. connect them to one or more JACK writable clients.
  70. To connect or disconnect JACK clients you can use the
  71. @file{jack_connect} and @file{jack_disconnect} programs, or do it
  72. through a graphical interface, for example with @file{qjackctl}.
  73. To list the JACK clients and their properties you can invoke the command
  74. @file{jack_lsp}.
  75. Follows an example which shows how to capture a JACK readable client
  76. with @command{avconv}.
  77. @example
  78. # Create a JACK writable client with name "libav".
  79. $ avconv -f jack -i libav -y out.wav
  80. # Start the sample jack_metro readable client.
  81. $ jack_metro -b 120 -d 0.2 -f 4000
  82. # List the current JACK clients.
  83. $ jack_lsp -c
  84. system:capture_1
  85. system:capture_2
  86. system:playback_1
  87. system:playback_2
  88. libav:input_1
  89. metro:120_bpm
  90. # Connect metro to the avconv writable client.
  91. $ jack_connect metro:120_bpm libav:input_1
  92. @end example
  93. For more information read:
  94. @url{http://jackaudio.org/}
  95. @section libdc1394
  96. IIDC1394 input device, based on libdc1394 and libraw1394.
  97. @section oss
  98. Open Sound System input device.
  99. The filename to provide to the input device is the device node
  100. representing the OSS input device, and is usually set to
  101. @file{/dev/dsp}.
  102. For example to grab from @file{/dev/dsp} using @command{avconv} use the
  103. command:
  104. @example
  105. avconv -f oss -i /dev/dsp /tmp/oss.wav
  106. @end example
  107. For more information about OSS see:
  108. @url{http://manuals.opensound.com/usersguide/dsp.html}
  109. @section pulse
  110. pulseaudio input device.
  111. To enable this input device during configuration you need libpulse-simple
  112. installed in your system.
  113. The filename to provide to the input device is a source device or the
  114. string "default"
  115. To list the pulse source devices and their properties you can invoke
  116. the command @file{pactl list sources}.
  117. @example
  118. avconv -f pulse -i default /tmp/pulse.wav
  119. @end example
  120. @subsection @var{server} AVOption
  121. The syntax is:
  122. @example
  123. -server @var{server name}
  124. @end example
  125. Connects to a specific server.
  126. @subsection @var{name} AVOption
  127. The syntax is:
  128. @example
  129. -name @var{application name}
  130. @end example
  131. Specify the application name pulse will use when showing active clients,
  132. by default it is "libav"
  133. @subsection @var{stream_name} AVOption
  134. The syntax is:
  135. @example
  136. -stream_name @var{stream name}
  137. @end example
  138. Specify the stream name pulse will use when showing active streams,
  139. by default it is "record"
  140. @subsection @var{sample_rate} AVOption
  141. The syntax is:
  142. @example
  143. -sample_rate @var{samplerate}
  144. @end example
  145. Specify the samplerate in Hz, by default 48kHz is used.
  146. @subsection @var{channels} AVOption
  147. The syntax is:
  148. @example
  149. -channels @var{N}
  150. @end example
  151. Specify the channels in use, by default 2 (stereo) is set.
  152. @subsection @var{frame_size} AVOption
  153. The syntax is:
  154. @example
  155. -frame_size @var{bytes}
  156. @end example
  157. Specify the number of byte per frame, by default it is set to 1024.
  158. @subsection @var{fragment_size} AVOption
  159. The syntax is:
  160. @example
  161. -fragment_size @var{bytes}
  162. @end example
  163. Specify the minimal buffering fragment in pulseaudio, it will affect the
  164. audio latency. By default it is unset.
  165. @section sndio
  166. sndio input device.
  167. To enable this input device during configuration you need libsndio
  168. installed on your system.
  169. The filename to provide to the input device is the device node
  170. representing the sndio input device, and is usually set to
  171. @file{/dev/audio0}.
  172. For example to grab from @file{/dev/audio0} using @command{avconv} use the
  173. command:
  174. @example
  175. avconv -f sndio -i /dev/audio0 /tmp/oss.wav
  176. @end example
  177. @section video4linux2
  178. Video4Linux2 input video device.
  179. The name of the device to grab is a file device node, usually Linux
  180. systems tend to automatically create such nodes when the device
  181. (e.g. an USB webcam) is plugged into the system, and has a name of the
  182. kind @file{/dev/video@var{N}}, where @var{N} is a number associated to
  183. the device.
  184. Video4Linux2 devices usually support a limited set of
  185. @var{width}x@var{height} sizes and framerates. You can check which are
  186. supported using @command{-list_formats all} for Video4Linux2 devices.
  187. Some usage examples of the video4linux2 devices with avconv and avplay:
  188. @example
  189. # List supported formats for a video4linux2 device.
  190. avplay -f video4linux2 -list_formats all /dev/video0
  191. # Grab and show the input of a video4linux2 device.
  192. avplay -f video4linux2 -framerate 30 -video_size hd720 /dev/video0
  193. # Grab and record the input of a video4linux2 device, leave the
  194. framerate and size as previously set.
  195. avconv -f video4linux2 -input_format mjpeg -i /dev/video0 out.mpeg
  196. @end example
  197. @section vfwcap
  198. VfW (Video for Windows) capture input device.
  199. The filename passed as input is the capture driver number, ranging from
  200. 0 to 9. You may use "list" as filename to print a list of drivers. Any
  201. other filename will be interpreted as device number 0.
  202. @section x11grab
  203. X11 video input device.
  204. This device allows to capture a region of an X11 display.
  205. The filename passed as input has the syntax:
  206. @example
  207. [@var{hostname}]:@var{display_number}.@var{screen_number}[+@var{x_offset},@var{y_offset}]
  208. @end example
  209. @var{hostname}:@var{display_number}.@var{screen_number} specifies the
  210. X11 display name of the screen to grab from. @var{hostname} can be
  211. omitted, and defaults to "localhost". The environment variable
  212. @env{DISPLAY} contains the default display name.
  213. @var{x_offset} and @var{y_offset} specify the offsets of the grabbed
  214. area with respect to the top-left border of the X11 screen. They
  215. default to 0.
  216. Check the X11 documentation (e.g. man X) for more detailed information.
  217. Use the @file{dpyinfo} program for getting basic information about the
  218. properties of your X11 display (e.g. grep for "name" or "dimensions").
  219. For example to grab from @file{:0.0} using @command{avconv}:
  220. @example
  221. avconv -f x11grab -r 25 -s cif -i :0.0 out.mpg
  222. # Grab at position 10,20.
  223. avconv -f x11grab -r 25 -s cif -i :0.0+10,20 out.mpg
  224. @end example
  225. @subsection @var{follow_mouse} AVOption
  226. The syntax is:
  227. @example
  228. -follow_mouse centered|@var{PIXELS}
  229. @end example
  230. When it is specified with "centered", the grabbing region follows the mouse
  231. pointer and keeps the pointer at the center of region; otherwise, the region
  232. follows only when the mouse pointer reaches within @var{PIXELS} (greater than
  233. zero) to the edge of region.
  234. For example:
  235. @example
  236. avconv -f x11grab -follow_mouse centered -r 25 -s cif -i :0.0 out.mpg
  237. # Follows only when the mouse pointer reaches within 100 pixels to edge
  238. avconv -f x11grab -follow_mouse 100 -r 25 -s cif -i :0.0 out.mpg
  239. @end example
  240. @subsection @var{show_region} AVOption
  241. The syntax is:
  242. @example
  243. -show_region 1
  244. @end example
  245. If @var{show_region} AVOption is specified with @var{1}, then the grabbing
  246. region will be indicated on screen. With this option, it's easy to know what is
  247. being grabbed if only a portion of the screen is grabbed.
  248. For example:
  249. @example
  250. avconv -f x11grab -show_region 1 -r 25 -s cif -i :0.0+10,20 out.mpg
  251. # With follow_mouse
  252. avconv -f x11grab -follow_mouse centered -show_region 1 -r 25 -s cif -i :0.0 out.mpg
  253. @end example
  254. @subsection @var{grab_x} @var{grab_y} AVOption
  255. The syntax is:
  256. @example
  257. -grab_x @var{x_offset} -grab_y @var{y_offset}
  258. @end example
  259. Set the grabbing region coordinates. The are expressed as offset from the top left
  260. corner of the X11 window. The default value is 0.
  261. @c man end INPUT DEVICES