Statistics
| Branch: | Revision:

ffmpeg / doc / indevs.texi @ fe174fc8

History | View | Annotate | Download (6.55 KB)

1 c32ccf7c Stefano Sabatini
@chapter Input Devices
2 4419c8bf Stefano Sabatini
@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 2f6bc4e7 Stefano Sabatini
are enabled by default. You can list all available ones using the
9
configure option "--list-indevs".
10 4419c8bf Stefano Sabatini
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 2f6bc4e7 Stefano Sabatini
This device allows capturing from an ALSA device. The name of the
29 4419c8bf Stefano Sabatini
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 2f6bc4e7 Stefano Sabatini
For example to capture with @file{ffmpeg} from an ALSA device with
46 4419c8bf Stefano Sabatini
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 jack
63
64 2f6bc4e7 Stefano Sabatini
JACK input device.
65 4419c8bf Stefano Sabatini
66
To enable this input device during configuration you need libjack
67
installed on your system.
68
69 2f6bc4e7 Stefano Sabatini
A JACK input device creates one or more JACK writable clients, one for
70 4419c8bf Stefano Sabatini
each 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}
72
is a number which identifies the channel.
73
Each writable client will send the acquired data to the FFmpeg input
74
device.
75
76 2f6bc4e7 Stefano Sabatini
Once you have created one or more JACK readable clients, you need to
77
connect them to one or more JACK writable clients.
78 4419c8bf Stefano Sabatini
79 2f6bc4e7 Stefano Sabatini
To connect or disconnect JACK clients you can use the
80 4419c8bf Stefano Sabatini
@file{jack_connect} and @file{jack_disconnect} programs, or do it
81
through a graphical interface, for example with @file{qjackctl}.
82
83 2f6bc4e7 Stefano Sabatini
To list the JACK clients and their properties you can invoke the command
84 4419c8bf Stefano Sabatini
@file{jack_lsp}.
85
86 2f6bc4e7 Stefano Sabatini
Follows an example which shows how to capture a JACK readable client
87 4419c8bf Stefano Sabatini
with @file{ffmpeg}.
88
@example
89 2f6bc4e7 Stefano Sabatini
# Create a JACK writable client with name "ffmpeg".
90 4419c8bf Stefano Sabatini
$ ffmpeg -f jack -i ffmpeg -y out.wav
91
92 2f6bc4e7 Stefano Sabatini
# Start the sample jack_metro readable client.
93 4419c8bf Stefano Sabatini
$ jack_metro -b 120 -d 0.2 -f 4000
94
95 2f6bc4e7 Stefano Sabatini
# List the current JACK clients.
96 4419c8bf Stefano Sabatini
$ jack_lsp -c
97
system:capture_1
98
system:capture_2
99
system:playback_1
100
system:playback_2
101
ffmpeg:input_1
102
metro:120_bpm
103
104 2f6bc4e7 Stefano Sabatini
# Connect metro to the ffmpeg writable client.
105 4419c8bf Stefano Sabatini
$ jack_connect metro:120_bpm ffmpeg:input_1
106
@end example
107
108
For more information read:
109
@url{http://jackaudio.org/}
110
111
@section libdc1394
112
113
IIDC1394 input device, based on libdc1394 and libraw1394.
114
115
@section oss
116
117
Open Sound System input device.
118
119
The filename to provide to the input device is the device node
120
representing the OSS input device, and is usually set to
121 2f6bc4e7 Stefano Sabatini
@file{/dev/dsp}.
122 4419c8bf Stefano Sabatini
123 2f6bc4e7 Stefano Sabatini
For example to grab from @file{/dev/dsp} using @file{ffmpeg} use the
124 4419c8bf Stefano Sabatini
command:
125
@example
126
ffmpeg -f oss -i /dev/dsp /tmp/oss.wav
127
@end example
128
129
For more information about OSS see:
130
@url{http://manuals.opensound.com/usersguide/dsp.html}
131
132
@section video4linux and video4linux2
133
134
Video4Linux and Video4Linux2 input video devices.
135
136
The name of the device to grab is a file device node, usually Linux
137
systems tend to automatically create such nodes when the device
138 2f6bc4e7 Stefano Sabatini
(e.g. an USB webcam) is plugged into the system, and has a name of the
139 4419c8bf Stefano Sabatini
kind @file{/dev/video@var{N}}, where @var{N} is a number associated to
140
the device.
141
142
Video4Linux and Video4Linux2 devices only support a limited set of
143
@var{width}x@var{height} sizes and framerates. You can check which are
144 2f6bc4e7 Stefano Sabatini
supported for example with the command @file{dov4l} for Video4Linux
145
devices and the command @file{v4l-info} for Video4Linux2 devices.
146 4419c8bf Stefano Sabatini
147
If the size for the device is set to 0x0, the input device will
148
try to autodetect the size to use.
149 8621a37d Stefano Sabatini
Only for the video4linux2 device, if the frame rate is set to 0/0 the
150
input device will use the frame rate value already set in the driver.
151 4419c8bf Stefano Sabatini
152
Video4Linux support is deprecated since Linux 2.6.30, and will be
153
dropped in later versions.
154
155
Follow some usage examples of the video4linux devices with the ff*
156
tools.
157
@example
158 8621a37d Stefano Sabatini
# Grab and show the input of a video4linux device, frame rate is set
159
# to the default of 25/1.
160 4419c8bf Stefano Sabatini
ffplay -s 320x240 -f video4linux /dev/video0
161
162 2f6bc4e7 Stefano Sabatini
# Grab and show the input of a video4linux2 device, autoadjust size.
163 4419c8bf Stefano Sabatini
ffplay -f video4linux2 /dev/video0
164
165 8621a37d Stefano Sabatini
# 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.
168 4419c8bf Stefano Sabatini
ffmpeg -f video4linux2 -i /dev/video0 out.mpeg
169
@end example
170
171
@section vfwcap
172
173 52c55330 Stefano Sabatini
VfW (Video for Windows) capture input device.
174 4419c8bf Stefano Sabatini
175 fbd4a07d Ramiro Polla
The filename passed as input is the capture driver number, ranging from
176
0 to 9. You may use "list" as filename to print a list of drivers. Any
177
other filename will be interpreted as device number 0.
178
179 4419c8bf Stefano Sabatini
@section x11grab
180
181
X11 video input device.
182
183
This device allows to capture a region of an X11 display.
184
185 2f6bc4e7 Stefano Sabatini
The filename passed as input has the syntax:
186 4419c8bf Stefano Sabatini
@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
191 2f6bc4e7 Stefano Sabatini
X11 display name of the screen to grab from. @var{hostname} can be
192
ommitted, and defaults to "localhost". The environment variable
193 4419c8bf Stefano Sabatini
@env{DISPLAY} contains the default display name.
194
195
@var{x_offset} and @var{y_offset} specify the offsets of the grabbed
196 2f6bc4e7 Stefano Sabatini
area with respect to the top-left border of the X11 screen. They
197 4419c8bf Stefano Sabatini
default to 0.
198
199
Check the X11 documentation (e.g. man X) for more detailed information.
200
201
Use the @file{dpyinfo} program for getting basic information about the
202 2f6bc4e7 Stefano Sabatini
properties of your X11 display (e.g. grep for "name" or "dimensions").
203 4419c8bf Stefano Sabatini
204
For example to grab from @file{:0.0} using @file{ffmpeg}:
205
@example
206
ffmpeg -f x11grab -r 25 -s cif -i :0.0 out.mpg
207
208 2f6bc4e7 Stefano Sabatini
# Grab at position 10,20.
209 4419c8bf Stefano Sabatini
ffmpeg -f x11grab -25 -s cif -i :0.0+10,20 out.mpg
210
@end example
211
212
@c man end INPUT DEVICES