OSDN Git Service

avconv: move rate_emu to options context.
[coroid/libav_saccubus.git] / doc / indevs.texi
1 @chapter Input Devices
2 @c man begin INPUT DEVICES
3
4 Input devices are configured elements in Libav which allow to access
5 the data coming from a multimedia device attached to your system.
6
7 When you configure your Libav build, all the supported input devices
8 are enabled by default. You can list all available ones using the
9 configure option "--list-indevs".
10
11 You can disable all the input devices using the configure option
12 "--disable-indevs", and selectively enable an input device using the
13 option "--enable-indev=@var{INDEV}", or you can disable a particular
14 input device using the option "--disable-indev=@var{INDEV}".
15
16 The option "-formats" of the ff* tools will display the list of
17 supported input devices (amongst the demuxers).
18
19 A description of the currently available input devices follows.
20
21 @section alsa
22
23 ALSA (Advanced Linux Sound Architecture) input device.
24
25 To enable this input device during configuration you need libasound
26 installed on your system.
27
28 This device allows capturing from an ALSA device. The name of the
29 device to capture has to be an ALSA card identifier.
30
31 An ALSA identifier has the syntax:
32 @example
33 hw:@var{CARD}[,@var{DEV}[,@var{SUBDEV}]]
34 @end example
35
36 where the @var{DEV} and @var{SUBDEV} components are optional.
37
38 The three arguments (in order: @var{CARD},@var{DEV},@var{SUBDEV})
39 specify card number or identifier, device number and subdevice number
40 (-1 means any).
41
42 To see the list of cards currently recognized by your system check the
43 files @file{/proc/asound/cards} and @file{/proc/asound/devices}.
44
45 For example to capture with @file{ffmpeg} from an ALSA device with
46 card id 0, you may run the command:
47 @example
48 ffmpeg -f alsa -i hw:0 alsaout.wav
49 @end example
50
51 For more information see:
52 @url{http://www.alsa-project.org/alsa-doc/alsa-lib/pcm.html}
53
54 @section bktr
55
56 BSD video input device.
57
58 @section dv1394
59
60 Linux DV 1394 input device.
61
62 @section fbdev
63
64 Linux framebuffer input device.
65
66 The Linux framebuffer is a graphic hardware-independent abstraction
67 layer to show graphics on a computer monitor, typically on the
68 console. It is accessed through a file device node, usually
69 @file{/dev/fb0}.
70
71 For more detailed information read the file
72 Documentation/fb/framebuffer.txt included in the Linux source tree.
73
74 To record from the framebuffer device @file{/dev/fb0} with
75 @file{ffmpeg}:
76 @example
77 ffmpeg -f fbdev -r 10 -i /dev/fb0 out.avi
78 @end example
79
80 You can take a single screenshot image with the command:
81 @example
82 ffmpeg -f fbdev -vframes 1 -r 1 -i /dev/fb0 screenshot.jpeg
83 @end example
84
85 See also @url{http://linux-fbdev.sourceforge.net/}, and fbset(1).
86
87 @section jack
88
89 JACK input device.
90
91 To enable this input device during configuration you need libjack
92 installed on your system.
93
94 A JACK input device creates one or more JACK writable clients, one for
95 each audio channel, with name @var{client_name}:input_@var{N}, where
96 @var{client_name} is the name provided by the application, and @var{N}
97 is a number which identifies the channel.
98 Each writable client will send the acquired data to the Libav input
99 device.
100
101 Once you have created one or more JACK readable clients, you need to
102 connect them to one or more JACK writable clients.
103
104 To connect or disconnect JACK clients you can use the
105 @file{jack_connect} and @file{jack_disconnect} programs, or do it
106 through a graphical interface, for example with @file{qjackctl}.
107
108 To list the JACK clients and their properties you can invoke the command
109 @file{jack_lsp}.
110
111 Follows an example which shows how to capture a JACK readable client
112 with @file{ffmpeg}.
113 @example
114 # Create a JACK writable client with name "ffmpeg".
115 $ ffmpeg -f jack -i ffmpeg -y out.wav
116
117 # Start the sample jack_metro readable client.
118 $ jack_metro -b 120 -d 0.2 -f 4000
119
120 # List the current JACK clients.
121 $ jack_lsp -c
122 system:capture_1
123 system:capture_2
124 system:playback_1
125 system:playback_2
126 ffmpeg:input_1
127 metro:120_bpm
128
129 # Connect metro to the ffmpeg writable client.
130 $ jack_connect metro:120_bpm ffmpeg:input_1
131 @end example
132
133 For more information read:
134 @url{http://jackaudio.org/}
135
136 @section libdc1394
137
138 IIDC1394 input device, based on libdc1394 and libraw1394.
139
140 @section oss
141
142 Open Sound System input device.
143
144 The filename to provide to the input device is the device node
145 representing the OSS input device, and is usually set to
146 @file{/dev/dsp}.
147
148 For example to grab from @file{/dev/dsp} using @file{ffmpeg} use the
149 command:
150 @example
151 ffmpeg -f oss -i /dev/dsp /tmp/oss.wav
152 @end example
153
154 For more information about OSS see:
155 @url{http://manuals.opensound.com/usersguide/dsp.html}
156
157 @section sndio
158
159 sndio input device.
160
161 To enable this input device during configuration you need libsndio
162 installed on your system.
163
164 The filename to provide to the input device is the device node
165 representing the sndio input device, and is usually set to
166 @file{/dev/audio0}.
167
168 For example to grab from @file{/dev/audio0} using @file{ffmpeg} use the
169 command:
170 @example
171 ffmpeg -f sndio -i /dev/audio0 /tmp/oss.wav
172 @end example
173
174 @section video4linux and video4linux2
175
176 Video4Linux and Video4Linux2 input video devices.
177
178 The name of the device to grab is a file device node, usually Linux
179 systems tend to automatically create such nodes when the device
180 (e.g. an USB webcam) is plugged into the system, and has a name of the
181 kind @file{/dev/video@var{N}}, where @var{N} is a number associated to
182 the device.
183
184 Video4Linux and Video4Linux2 devices only support a limited set of
185 @var{width}x@var{height} sizes and framerates. You can check which are
186 supported for example with the command @file{dov4l} for Video4Linux
187 devices and the command @file{v4l-info} for Video4Linux2 devices.
188
189 If the size for the device is set to 0x0, the input device will
190 try to autodetect the size to use.
191 Only for the video4linux2 device, if the frame rate is set to 0/0 the
192 input device will use the frame rate value already set in the driver.
193
194 Video4Linux support is deprecated since Linux 2.6.30, and will be
195 dropped in later versions.
196
197 Follow some usage examples of the video4linux devices with the ff*
198 tools.
199 @example
200 # Grab and show the input of a video4linux device, frame rate is set
201 # to the default of 25/1.
202 avplay -s 320x240 -f video4linux /dev/video0
203
204 # Grab and show the input of a video4linux2 device, autoadjust size.
205 avplay -f video4linux2 /dev/video0
206
207 # Grab and record the input of a video4linux2 device, autoadjust size,
208 # frame rate value defaults to 0/0 so it is read from the video4linux2
209 # driver.
210 ffmpeg -f video4linux2 -i /dev/video0 out.mpeg
211 @end example
212
213 @section vfwcap
214
215 VfW (Video for Windows) capture input device.
216
217 The filename passed as input is the capture driver number, ranging from
218 0 to 9. You may use "list" as filename to print a list of drivers. Any
219 other filename will be interpreted as device number 0.
220
221 @section x11grab
222
223 X11 video input device.
224
225 This device allows to capture a region of an X11 display.
226
227 The filename passed as input has the syntax:
228 @example
229 [@var{hostname}]:@var{display_number}.@var{screen_number}[+@var{x_offset},@var{y_offset}]
230 @end example
231
232 @var{hostname}:@var{display_number}.@var{screen_number} specifies the
233 X11 display name of the screen to grab from. @var{hostname} can be
234 ommitted, and defaults to "localhost". The environment variable
235 @env{DISPLAY} contains the default display name.
236
237 @var{x_offset} and @var{y_offset} specify the offsets of the grabbed
238 area with respect to the top-left border of the X11 screen. They
239 default to 0.
240
241 Check the X11 documentation (e.g. man X) for more detailed information.
242
243 Use the @file{dpyinfo} program for getting basic information about the
244 properties of your X11 display (e.g. grep for "name" or "dimensions").
245
246 For example to grab from @file{:0.0} using @file{ffmpeg}:
247 @example
248 ffmpeg -f x11grab -r 25 -s cif -i :0.0 out.mpg
249
250 # Grab at position 10,20.
251 ffmpeg -f x11grab -r 25 -s cif -i :0.0+10,20 out.mpg
252 @end example
253
254 @subsection @var{follow_mouse} AVOption
255
256 The syntax is:
257 @example
258 -follow_mouse centered|@var{PIXELS}
259 @end example
260
261 When it is specified with "centered", the grabbing region follows the mouse
262 pointer and keeps the pointer at the center of region; otherwise, the region
263 follows only when the mouse pointer reaches within @var{PIXELS} (greater than
264 zero) to the edge of region.
265
266 For example:
267 @example
268 ffmpeg -f x11grab -follow_mouse centered -r 25 -s cif -i :0.0 out.mpg
269
270 # Follows only when the mouse pointer reaches within 100 pixels to edge
271 ffmpeg -f x11grab -follow_mouse 100 -r 25 -s cif -i :0.0 out.mpg
272 @end example
273
274 @subsection @var{show_region} AVOption
275
276 The syntax is:
277 @example
278 -show_region 1
279 @end example
280
281 If @var{show_region} AVOption is specified with @var{1}, then the grabbing
282 region will be indicated on screen. With this option, it's easy to know what is
283 being grabbed if only a portion of the screen is grabbed.
284
285 For example:
286 @example
287 ffmpeg -f x11grab -show_region 1 -r 25 -s cif -i :0.0+10,20 out.mpg
288
289 # With follow_mouse
290 ffmpeg -f x11grab -follow_mouse centered -show_region 1  -r 25 -s cif -i :0.0 out.mpg
291 @end example
292
293 @c man end INPUT DEVICES