cf29c4c30607364634f8f92d2c090df314049949
[libav.git] / doc / indevs.texi
1 @chapter Input Devices
2 @c man begin INPUT DEVICES
3
4 Input devices are configured elements in FFmpeg which allow to access
5 the data coming from a multimedia device attached to your system.
6
7 When you configure your FFmpeg build, all the supported input devices
8 are enabled by default. You can list them using the configure option
9 "--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 to capture 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 audio_beos
55
56 BeOS audio input device.
57
58 @section bktr
59
60 BSD video input device.
61
62 @section dv1394
63
64 Linux DV 1394 input device.
65
66 @section jack
67
68 Jack input device.
69
70 To enable this input device during configuration you need libjack
71 installed on your system.
72
73 A jack input device creates one or more jack writable clients, one for
74 each audio channel, with name @var{client_name}:input_@var{N}, where
75 @var{client_name} is the name provided by the application, and @var{N}
76 is a number which identifies the channel.
77 Each writable client will send the acquired data to the FFmpeg input
78 device.
79
80 Once you have created one or more jack readable clients, you need to
81 connect them to one or more jack writable clients.
82
83 To connect or disconnect jack clients you can use the
84 @file{jack_connect} and @file{jack_disconnect} programs, or do it
85 through a graphical interface, for example with @file{qjackctl}.
86
87 To list the jack clients and their properties you can invoke the command
88 @file{jack_lsp}.
89
90 Follows an example which shows how to capture a jack readable client
91 with @file{ffmpeg}.
92 @example
93 # create a jack writable client with name "ffmpeg"
94 $ ffmpeg -f jack -i ffmpeg -y out.wav
95
96 # start the sample jack_metro readable client
97 $ jack_metro -b 120 -d 0.2 -f 4000
98
99 # list the current jack clients
100 $ jack_lsp -c
101 system:capture_1
102 system:capture_2
103 system:playback_1
104 system:playback_2
105 ffmpeg:input_1
106 metro:120_bpm
107
108 # connect metro to the ffmpeg writable client
109 $ jack_connect metro:120_bpm ffmpeg:input_1
110 @end example
111
112 For more information read:
113 @url{http://jackaudio.org/}
114
115 @section libdc1394
116
117 IIDC1394 input device, based on libdc1394 and libraw1394.
118
119 @section oss
120
121 Open Sound System input device.
122
123 The filename to provide to the input device is the device node
124 representing the OSS input device, and is usually set to
125 @file{/dev/dsp/}.
126
127 For example to grab from @file{/dev/dsp/} using @file{ffmpeg} use the
128 command:
129 @example
130 ffmpeg -f oss -i /dev/dsp /tmp/oss.wav
131 @end example
132
133 For more information about OSS see:
134 @url{http://manuals.opensound.com/usersguide/dsp.html}
135
136 @section video4linux and video4linux2
137
138 Video4Linux and Video4Linux2 input video devices.
139
140 The name of the device to grab is a file device node, usually Linux
141 systems tend to automatically create such nodes when the device
142 (e.g. an USB webcam) is plugged to the system, and has a name of the
143 kind @file{/dev/video@var{N}}, where @var{N} is a number associated to
144 the device.
145
146 Video4Linux and Video4Linux2 devices only support a limited set of
147 @var{width}x@var{height} sizes and framerates. You can check which are
148 supported for example using the command @file{dov4l} for Video4Linux
149 devices, and the command @file{v4l-info} for Video4Linux2 devices.
150
151 If the size for the device is set to 0x0, the input device will
152 try to autodetect the size to use.
153
154 Video4Linux support is deprecated since Linux 2.6.30, and will be
155 dropped in later versions.
156
157 Follow some usage examples of the video4linux devices with the ff*
158 tools.
159 @example
160 # grab and show the input of a video4linux device
161 ffplay -s 320x240 -f video4linux /dev/video0
162
163 # grab and show the input of a video4linux2 device, autoadjust size
164 ffplay -f video4linux2 /dev/video0
165
166 # grab and record the input of a video4linux2 device, autoadjust size
167 ffmpeg -f video4linux2 -i /dev/video0 out.mpeg
168 @end example
169
170 @section vfwcap
171
172 VFW (Video For Window) catpure input device.
173
174 @section x11grab
175
176 X11 video input device.
177
178 This device allows to capture a region of an X11 display.
179
180 The filename passed in input has the syntax:
181 @example
182 [@var{hostname}]:@var{display_number}.@var{screen_number}[+@var{x_offset},@var{y_offset}]
183 @end example
184
185 @var{hostname}:@var{display_number}.@var{screen_number} specifies the
186 X11 display name of the screen to grab from. @var{hostname} can be not
187 specified, and defaults to "localhost". The environment variable
188 @env{DISPLAY} contains the default display name.
189
190 @var{x_offset} and @var{y_offset} specify the offsets of the grabbed
191 area with respect to the top/left border of the X11 screen image. They
192 default to 0.
193
194 Check the X11 documentation (e.g. man X) for more detailed information.
195
196 Use the @file{dpyinfo} program for getting basic information about the
197 properties of your X11 display screen (e.g. grep for "name" or
198 "dimensions").
199
200 For example to grab from @file{:0.0} using @file{ffmpeg}:
201 @example
202 ffmpeg -f x11grab -r 25 -s cif -i :0.0 out.mpg
203
204 # grab at position 10,20
205 ffmpeg -f x11grab -25 -s cif -i :0.0+10,20 out.mpg
206 @end example
207
208 @c man end INPUT DEVICES