All of this is only possible if your device supports Video4Linux (be it
version 1 or 2).

You can either use VLC to open your webcam's stream, or record it if you
really need to.

Or you can use Libav's Avplay to just open it, this assuming that your
webcam is compatible with Video4Linux2 and is the very first video
device, both of which I don't know how to find out unless you test it by
yourself, although someone else might have more information.

Note: Video4Linux (be it version 1 or 2) devices support a limited
configuration regarding frames per second and video resolution, so don't
expect to get a 1366x768 resolution with 60 FPS input from the webcam if
it only supports 640x480 with 30 FPS.

Here is the Avplay example (which allows you to just open the webcam):

avplay -f "video4linux2" "/dev/video0"

And here is the Avconv example (which saves the input to a WebM file,
using VP8 and Vorbis encoders):

avconv -y -f "pulse" -i "2" -c:a "libvorbis" -f "video4linux2" -i
"dev/video0" -c:v "libvpx" -deadline "realtime" -cpu-used "2" "$(date
"+%FT%H-%M-%S%z").webm"

In my case, the command above makes a video with delayed audio. And the
PulseAudio input device used is the one with index 2 from the command
"pactl list sources". Due to the delayed audio, I wouldn't use the
example above, I would instead use a combination of the example with
avplay that is simpler to use, and then record the entire screen during
a screencast, if you really need it for screencasting, like so:

avplay -f "video4linux2" -video_size "320x240" "/dev/video0"

And finally:

avconv -y -f "pulse" -sample_rate "44100" -i "default" -c:a "libvorbis"
-s:v "1366x768" -f "x11grab" -i ":0.0" -c:v "libvpx" -deadline "best"
-cpu-used "2" "$(date "+%FT%H-%M-%S%z").webm"

Reply via email to