After trying to use mjpg_streamer and failing (my webcam doesn’t have hardware support to output mjpg streams) I used “motion” instead.
You can use the “motion” program to stream/export a USB webcam to the web.
sudo apt-get install motion
Edit the configuration file located in /etc/default/motion
to the following:
Then edit the /etc/motion/motion.conf file file as follows:
Set width and height appropriately (640×480 in my case).
Adjust framerate if you want.
I set minimum_motion_frames to 2 because I have a higher framerate.
Start things up with
sudo service motion start
And then double check things by pointing your web browser to 127.0.0.1:8080.