dsputil: allow to skip drawing of top/bottom edges.
[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
132@section video4linux and video4linux2
133
134Video4Linux and Video4Linux2 input video devices.
135
136The name of the device to grab is a file device node, usually Linux
137systems tend to automatically create such nodes when the device
2f6bc4e7 138(e.g. an USB webcam) is plugged into the system, and has a name of the
4419c8bf
SS
139kind @file{/dev/video@var{N}}, where @var{N} is a number associated to
140the device.
141
142Video4Linux and Video4Linux2 devices only support a limited set of
143@var{width}x@var{height} sizes and framerates. You can check which are
2f6bc4e7
SS
144supported for example with the command @file{dov4l} for Video4Linux
145devices and the command @file{v4l-info} for Video4Linux2 devices.
4419c8bf
SS
146
147If the size for the device is set to 0x0, the input device will
148try to autodetect the size to use.
8621a37d
SS
149Only for the video4linux2 device, if the frame rate is set to 0/0 the
150input device will use the frame rate value already set in the driver.
4419c8bf
SS
151
152Video4Linux support is deprecated since Linux 2.6.30, and will be
153dropped in later versions.
154
155Follow some usage examples of the video4linux devices with the ff*
156tools.
157@example
8621a37d
SS
158# Grab and show the input of a video4linux device, frame rate is set
159# to the default of 25/1.
4419c8bf
SS
160ffplay -s 320x240 -f video4linux /dev/video0
161
2f6bc4e7 162# Grab and show the input of a video4linux2 device, autoadjust size.
4419c8bf
SS
163ffplay -f video4linux2 /dev/video0
164
8621a37d
SS
165# Grab and record the input of a video4linux2 device, autoadjust size,
166# frame rate value defaults to 0/0 so it is read from the video4linux2
167# driver.
4419c8bf
SS
168ffmpeg -f video4linux2 -i /dev/video0 out.mpeg
169@end example
170
171@section vfwcap
172
52c55330 173VfW (Video for Windows) capture input device.
4419c8bf 174
fbd4a07d
RP
175The filename passed as input is the capture driver number, ranging from
1760 to 9. You may use "list" as filename to print a list of drivers. Any
177other filename will be interpreted as device number 0.
178
4419c8bf
SS
179@section x11grab
180
181X11 video input device.
182
183This device allows to capture a region of an X11 display.
184
2f6bc4e7 185The filename passed as input has the syntax:
4419c8bf
SS
186@example
187[@var{hostname}]:@var{display_number}.@var{screen_number}[+@var{x_offset},@var{y_offset}]
188@end example
189
190@var{hostname}:@var{display_number}.@var{screen_number} specifies the
2f6bc4e7
SS
191X11 display name of the screen to grab from. @var{hostname} can be
192ommitted, and defaults to "localhost". The environment variable
4419c8bf
SS
193@env{DISPLAY} contains the default display name.
194
195@var{x_offset} and @var{y_offset} specify the offsets of the grabbed
2f6bc4e7 196area with respect to the top-left border of the X11 screen. They
4419c8bf
SS
197default to 0.
198
199Check the X11 documentation (e.g. man X) for more detailed information.
200
201Use the @file{dpyinfo} program for getting basic information about the
2f6bc4e7 202properties of your X11 display (e.g. grep for "name" or "dimensions").
4419c8bf
SS
203
204For example to grab from @file{:0.0} using @file{ffmpeg}:
205@example
206ffmpeg -f x11grab -r 25 -s cif -i :0.0 out.mpg
207
2f6bc4e7 208# Grab at position 10,20.
4419c8bf
SS
209ffmpeg -f x11grab -25 -s cif -i :0.0+10,20 out.mpg
210@end example
211
212@c man end INPUT DEVICES