cosmetics: fix dashed line length after 070c5d0
[libav.git] / doc / indevs.texi
CommitLineData
c32ccf7c 1@chapter Input Devices
4419c8bf
SS
2@c man begin INPUT DEVICES
3
f8a45fa1 4Input devices are configured elements in Libav which allow to access
4419c8bf
SS
5the data coming from a multimedia device attached to your system.
6
f8a45fa1 7When you configure your Libav build, all the supported input devices
2f6bc4e7
SS
8are enabled by default. You can list all available ones using the
9configure option "--list-indevs".
4419c8bf
SS
10
11You can disable all the input devices using the configure option
12"--disable-indevs", and selectively enable an input device using the
13option "--enable-indev=@var{INDEV}", or you can disable a particular
14input device using the option "--disable-indev=@var{INDEV}".
15
16The option "-formats" of the ff* tools will display the list of
17supported input devices (amongst the demuxers).
18
19A description of the currently available input devices follows.
20
21@section alsa
22
23ALSA (Advanced Linux Sound Architecture) input device.
24
25To enable this input device during configuration you need libasound
26installed on your system.
27
2f6bc4e7 28This device allows capturing from an ALSA device. The name of the
4419c8bf
SS
29device to capture has to be an ALSA card identifier.
30
31An ALSA identifier has the syntax:
32@example
33hw:@var{CARD}[,@var{DEV}[,@var{SUBDEV}]]
34@end example
35
36where the @var{DEV} and @var{SUBDEV} components are optional.
37
38The three arguments (in order: @var{CARD},@var{DEV},@var{SUBDEV})
39specify card number or identifier, device number and subdevice number
40(-1 means any).
41
42To see the list of cards currently recognized by your system check the
43files @file{/proc/asound/cards} and @file{/proc/asound/devices}.
44
2f6bc4e7 45For example to capture with @file{ffmpeg} from an ALSA device with
4419c8bf
SS
46card id 0, you may run the command:
47@example
48ffmpeg -f alsa -i hw:0 alsaout.wav
49@end example
50
51For more information see:
52@url{http://www.alsa-project.org/alsa-doc/alsa-lib/pcm.html}
53
4419c8bf
SS
54@section bktr
55
56BSD video input device.
57
58@section dv1394
59
60Linux DV 1394 input device.
61
62@section jack
63
2f6bc4e7 64JACK input device.
4419c8bf
SS
65
66To enable this input device during configuration you need libjack
67installed on your system.
68
2f6bc4e7 69A JACK input device creates one or more JACK writable clients, one for
4419c8bf
SS
70each audio channel, with name @var{client_name}:input_@var{N}, where
71@var{client_name} is the name provided by the application, and @var{N}
72is a number which identifies the channel.
f8a45fa1 73Each writable client will send the acquired data to the Libav input
4419c8bf
SS
74device.
75
2f6bc4e7
SS
76Once you have created one or more JACK readable clients, you need to
77connect them to one or more JACK writable clients.
4419c8bf 78
2f6bc4e7 79To connect or disconnect JACK clients you can use the
4419c8bf
SS
80@file{jack_connect} and @file{jack_disconnect} programs, or do it
81through a graphical interface, for example with @file{qjackctl}.
82
2f6bc4e7 83To list the JACK clients and their properties you can invoke the command
4419c8bf
SS
84@file{jack_lsp}.
85
2f6bc4e7 86Follows an example which shows how to capture a JACK readable client
4419c8bf
SS
87with @file{ffmpeg}.
88@example
2f6bc4e7 89# Create a JACK writable client with name "ffmpeg".
4419c8bf
SS
90$ ffmpeg -f jack -i ffmpeg -y out.wav
91
2f6bc4e7 92# Start the sample jack_metro readable client.
4419c8bf
SS
93$ jack_metro -b 120 -d 0.2 -f 4000
94
2f6bc4e7 95# List the current JACK clients.
4419c8bf
SS
96$ jack_lsp -c
97system:capture_1
98system:capture_2
99system:playback_1
100system:playback_2
101ffmpeg:input_1
102metro:120_bpm
103
2f6bc4e7 104# Connect metro to the ffmpeg writable client.
4419c8bf
SS
105$ jack_connect metro:120_bpm ffmpeg:input_1
106@end example
107
108For more information read:
109@url{http://jackaudio.org/}
110
111@section libdc1394
112
113IIDC1394 input device, based on libdc1394 and libraw1394.
114
115@section oss
116
117Open Sound System input device.
118
119The filename to provide to the input device is the device node
120representing the OSS input device, and is usually set to
2f6bc4e7 121@file{/dev/dsp}.
4419c8bf 122
2f6bc4e7 123For example to grab from @file{/dev/dsp} using @file{ffmpeg} use the
4419c8bf
SS
124command:
125@example
126ffmpeg -f oss -i /dev/dsp /tmp/oss.wav
127@end example
128
129For more information about OSS see:
130@url{http://manuals.opensound.com/usersguide/dsp.html}
131
15d59d2c
B
132@section sndio
133
134sndio input device.
135
136To enable this input device during configuration you need libsndio
137installed on your system.
138
139The filename to provide to the input device is the device node
140representing the sndio input device, and is usually set to
141@file{/dev/audio0}.
142
143For example to grab from @file{/dev/audio0} using @file{ffmpeg} use the
144command:
145@example
146ffmpeg -f sndio -i /dev/audio0 /tmp/oss.wav
147@end example
148
4419c8bf
SS
149@section video4linux and video4linux2
150
151Video4Linux and Video4Linux2 input video devices.
152
153The name of the device to grab is a file device node, usually Linux
154systems tend to automatically create such nodes when the device
2f6bc4e7 155(e.g. an USB webcam) is plugged into the system, and has a name of the
4419c8bf
SS
156kind @file{/dev/video@var{N}}, where @var{N} is a number associated to
157the device.
158
159Video4Linux and Video4Linux2 devices only support a limited set of
160@var{width}x@var{height} sizes and framerates. You can check which are
2f6bc4e7
SS
161supported for example with the command @file{dov4l} for Video4Linux
162devices and the command @file{v4l-info} for Video4Linux2 devices.
4419c8bf
SS
163
164If the size for the device is set to 0x0, the input device will
165try to autodetect the size to use.
8621a37d
SS
166Only for the video4linux2 device, if the frame rate is set to 0/0 the
167input device will use the frame rate value already set in the driver.
4419c8bf
SS
168
169Video4Linux support is deprecated since Linux 2.6.30, and will be
170dropped in later versions.
171
172Follow some usage examples of the video4linux devices with the ff*
173tools.
174@example
8621a37d
SS
175# Grab and show the input of a video4linux device, frame rate is set
176# to the default of 25/1.
4419c8bf
SS
177ffplay -s 320x240 -f video4linux /dev/video0
178
2f6bc4e7 179# Grab and show the input of a video4linux2 device, autoadjust size.
4419c8bf
SS
180ffplay -f video4linux2 /dev/video0
181
8621a37d
SS
182# Grab and record the input of a video4linux2 device, autoadjust size,
183# frame rate value defaults to 0/0 so it is read from the video4linux2
184# driver.
4419c8bf
SS
185ffmpeg -f video4linux2 -i /dev/video0 out.mpeg
186@end example
187
188@section vfwcap
189
52c55330 190VfW (Video for Windows) capture input device.
4419c8bf 191
fbd4a07d
RP
192The filename passed as input is the capture driver number, ranging from
1930 to 9. You may use "list" as filename to print a list of drivers. Any
194other filename will be interpreted as device number 0.
195
4419c8bf
SS
196@section x11grab
197
198X11 video input device.
199
200This device allows to capture a region of an X11 display.
201
2f6bc4e7 202The filename passed as input has the syntax:
4419c8bf
SS
203@example
204[@var{hostname}]:@var{display_number}.@var{screen_number}[+@var{x_offset},@var{y_offset}]
205@end example
206
207@var{hostname}:@var{display_number}.@var{screen_number} specifies the
2f6bc4e7
SS
208X11 display name of the screen to grab from. @var{hostname} can be
209ommitted, and defaults to "localhost". The environment variable
4419c8bf
SS
210@env{DISPLAY} contains the default display name.
211
212@var{x_offset} and @var{y_offset} specify the offsets of the grabbed
2f6bc4e7 213area with respect to the top-left border of the X11 screen. They
4419c8bf
SS
214default to 0.
215
216Check the X11 documentation (e.g. man X) for more detailed information.
217
218Use the @file{dpyinfo} program for getting basic information about the
2f6bc4e7 219properties of your X11 display (e.g. grep for "name" or "dimensions").
4419c8bf
SS
220
221For example to grab from @file{:0.0} using @file{ffmpeg}:
222@example
223ffmpeg -f x11grab -r 25 -s cif -i :0.0 out.mpg
224
2f6bc4e7 225# Grab at position 10,20.
4419c8bf
SS
226ffmpeg -f x11grab -25 -s cif -i :0.0+10,20 out.mpg
227@end example
228
229@c man end INPUT DEVICES