| Version 7 (modified by burek, 9 months ago) (diff) |
|---|
Windows
dshow
For windows you should probably use the "dshow" input source, like this:
ffmpeg -f dshow -r 25 -s 640x480 -i video="USB2.0_Camera":audio="Microphone (USB Audio Device)" output.avi
To list all available devices, you can type:
ffmpeg -f dshow -list_devices true -i dummy
To list all the options that one device supports, you can type:
ffmpeg -f dshow -list_options true -i video=<video device>
ffmpeg can also take dshow (DirectShow) as input by creating an avisynth file (.avs file) that itself gets input from a graphedit file, which graphedit file exposes a pin of your capture source or any filter really, ex ("yo.avs"):
DirectShowSource?("push2.GRF", fps=35, audio=False, framecount=1000000)
Also this note that "The input string is in the format video=<video device name>:audio=<audio device name>. It is possible to have two separate inputs (like -f dshow -i audio=foo -f dshow -i video=bar) but my limited tests had shown a better synchronism when both were used in the same input."
vfwcap
Or you can also possibly use the (now out dated) vfwcap input device, like this:
To list the supported capture devices, connected to the machine:
ffmpeg -y -f vfwcap -i list
That will give us the list like this:
... libavutil 50.36. 0 / 50.36. 0 libavcore 0.16. 1 / 0.16. 1 libavcodec 52.108. 0 / 52.108. 0 libavformat 52.93. 0 / 52.93. 0 libavdevice 52. 2. 3 / 52. 2. 3 libavfilter 1.74. 0 / 1.74. 0 libswscale 0.12. 0 / 0.12. 0 [vfwcap @ 01c6d150] Driver 0 [vfwcap @ 01c6d150] Microsoft WDM Image Capture (Win32) [vfwcap @ 01c6d150] Version: 5.1.2600.5512 list: Input/output error
So, we can try to grab something from our camera:
ffmpeg -y -f vfwcap -r 25 -i 0 out.mp4
Where "-i 0" is the index (zero based) in the list of present capture devices ("Driver 0").
Linux
On Linux, we can use video4linux2 input device to capture live input (such as web camera), like this:
ffmpeg -f video4linux2 -r 25 -s 640x480 -i /dev/video0 out.avi
If you need to set some specific parameters of your camera, you can do that using v4l2-ctl tool.
You can find it in ubuntu/debian package named v4l-utils.
Most probably you'll want to know what frame sizes / frame rates your camera supports and you can do that using: v4l2-ctl --list-formats-ext
Also, you might want to correct brightness, zoom, focus, etc. with:
v4l2-ctl -L
and
v4l2-ctl -c <option>=<value>


