How do I watch my webcams feed on Linux?
Since you want an answer "without installing any extra applications like Photobooth," I've tried to give a solution that doesn't depend on very much. Also I'm assuming that your webcam uses "Video4Linux2" and that it is /dev/video0
. If this is a modern webcam and if you only have one, these are pretty good assumptions.
From the command line:
$ gst-launch-0.10 v4l2src device=/dev/video0 ! xvimagesink
Note that "v4l2src" contains a lowercase L and not the number 1. On your system the command may be gst-launch
or something starting with gst-launch
but with a different version number. Tab completion should help you find the exact command name. This tool is in the gstreamer0.10-tools
package on my Ubuntu system, which is a dependency of libgstreamer, which is a dependency of a large number of the apps on my Ubuntu system and is likely present in the default installation.
Other Applications
If you don't mind installing other applications, here is how you can do this in a few other applications. All of them can easily be installed via apt-get
or another package manager of your choosing:
- VLC:
$ vlc v4l2:///dev/video0
Also, you can do this from the VLC GUI by going to File->Open Capture Device - mplayer:
mplayer tv://device=/dev/video01
(from Stefan in the comments) - Cheese: This is a photobooth-like app that is very simple to use.
guvcview
This program is ideal for screencasts, as it can show just the camera on a window and nothing else:
sudo apt-get install guvcview
guvcview
Then just use any screen recorder to make a feed. recordmydesktop
works fine.
Tested on Ubuntu 18.04.
Related questions:
- https://askubuntu.com/questions/536563/screen-recorder-webcam
- https://askubuntu.com/questions/48245/webcam-apps-and-ways-of-checking-if-webcam-is-working
- https://askubuntu.com/questions/348838/how-to-check-available-webcams-from-the-command-line/848390#848390
ffplay /dev/video0
is one of the simpler methods, and will work provided you have ffmpeg installed.
To install, use sudo apt install ffmpeg
.