Skip to content

UVC Cameras on Linux

Command Line Operations


Install V4L utility packages

sudo apt-get update
sudo apt-get install v4l-utils

UVC v4l utils sudo apt get update

UVC v4l utils sudo apt get install

List the UVC devices connected to the USB port

v4l2-ctl --list-devices

UVC v4l utils list device

Some devices will display 2 video nodes as follows:

UVC v4l utils video device listed

One of the devices is used for regular YUV/MJPEG compression outputs, and the other is used for H.264 coding output. The users can use different programs to open the two devices at the same time, H.264 for streaming and MJPEG for audio recording or computer vision processing.

List the detailed information of each video node

You can check the features of each video node, like compression format, resolutions and so on.

List video0:

v4l2-ctl --list-formats-ext -d 0

UVC v4l utils video device listed 0

List video1:

v4l2-ctl --list-formats-ext -d 1

UVC v4l utils video device listed 1

Software Operations

VLC media player

Install VLC media player

sudo apt install vlc

Open VLC

UVC open vlc

Right-click on the interface, go to Open Media -> Open Capture Device

UVC vlc open media

In the Capture Device tab, you can select the capture mode and video device, or toggle the advanced options.

UVC vlc capture device

Here are the parameters you can toggle in the advanced options.

UVC vlc advanced options

Once you click OK to save the advanced options and then Play in the Open Media window, you will be able to see the video feed.

UVC vlc video feed

Other Players

mplayer:

mplayer tv://-tv driver=v4l2:width=640:height=480:device=/dev/video0 -fps 30
mencoder tv:// -tv driver=v4l2:width=320:height=240:device=/dev/video0 -nosound -ovc lavc -o myvideo.avi

streamer

streamer -c /dev/video0 -f jpeg -F stereo -o myvideo.avi -t 0:05