indevs.texi 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  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 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 @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 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. @command{avconv}:
  52. @example
  53. avconv -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. avconv -f fbdev -frames:v 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 Libav 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 @command{avconv}.
  79. @example
  80. # Create a JACK writable client with name "libav".
  81. $ avconv -f jack -i libav -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. libav:input_1
  91. metro:120_bpm
  92. # Connect metro to the avconv writable client.
  93. $ jack_connect metro:120_bpm libav: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 @command{avconv} use the
  105. command:
  106. @example
  107. avconv -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 pulse
  112. pulseaudio input device.
  113. To enable this input device during configuration you need libpulse-simple
  114. installed in your system.
  115. The filename to provide to the input device is a source device or the
  116. string "default"
  117. To list the pulse source devices and their properties you can invoke
  118. the command @file{pactl list sources}.
  119. @example
  120. avconv -f pulse -i default /tmp/pulse.wav
  121. @end example
  122. @subsection @var{server} AVOption
  123. The syntax is:
  124. @example
  125. -server @var{server name}
  126. @end example
  127. Connects to a specific server.
  128. @subsection @var{name} AVOption
  129. The syntax is:
  130. @example
  131. -name @var{application name}
  132. @end example
  133. Specify the application name pulse will use when showing active clients,
  134. by default it is "libav"
  135. @subsection @var{stream_name} AVOption
  136. The syntax is:
  137. @example
  138. -stream_name @var{stream name}
  139. @end example
  140. Specify the stream name pulse will use when showing active streams,
  141. by default it is "record"
  142. @subsection @var{sample_rate} AVOption
  143. The syntax is:
  144. @example
  145. -sample_rate @var{samplerate}
  146. @end example
  147. Specify the samplerate in Hz, by default 48kHz is used.
  148. @subsection @var{channels} AVOption
  149. The syntax is:
  150. @example
  151. -channels @var{N}
  152. @end example
  153. Specify the channels in use, by default 2 (stereo) is set.
  154. @subsection @var{frame_size} AVOption
  155. The syntax is:
  156. @example
  157. -frame_size @var{bytes}
  158. @end example
  159. Specify the number of byte per frame, by default it is set to 1024.
  160. @subsection @var{fragment_size} AVOption
  161. The syntax is:
  162. @example
  163. -fragment_size @var{bytes}
  164. @end example
  165. Specify the minimal buffering fragment in pulseaudio, it will affect the
  166. audio latency. By default it is unset.
  167. @section sndio
  168. sndio input device.
  169. To enable this input device during configuration you need libsndio
  170. installed on your system.
  171. The filename to provide to the input device is the device node
  172. representing the sndio input device, and is usually set to
  173. @file{/dev/audio0}.
  174. For example to grab from @file{/dev/audio0} using @command{avconv} use the
  175. command:
  176. @example
  177. avconv -f sndio -i /dev/audio0 /tmp/oss.wav
  178. @end example
  179. @section video4linux2
  180. Video4Linux2 input video device.
  181. The name of the device to grab is a file device node, usually Linux
  182. systems tend to automatically create such nodes when the device
  183. (e.g. an USB webcam) is plugged into the system, and has a name of the
  184. kind @file{/dev/video@var{N}}, where @var{N} is a number associated to
  185. the device.
  186. Video4Linux2 devices usually support a limited set of
  187. @var{width}x@var{height} sizes and framerates. You can check which are
  188. supported using @command{-list_formats all} for Video4Linux2 devices.
  189. Some usage examples of the video4linux2 devices with avconv and avplay:
  190. @example
  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. @c man end INPUT DEVICES