Thunberg's

I have strugled with avserver/avconv, mjpeg-server and web-cam-server without success for some of my web cameras but
Motion
seems to work with most and it is the easiest software to set up for a webcam (or other type of video camera).
The main purpose of this software is to detect motion and record it or even do something more.
This document will help you to setup the streaming, in the future
you might use some of the additional features of this software.
e.g You can set it up for advanced motion detection,
I use Zoneminder for that purpose though I have several cameras to administrate.

For debian based systems like ubuntu and LinuxMint install as normally:

root@Garage:~# sudo apt-get install motion

For Red-Hat/Centos RPM for Fedora 12/13/rawhide on x86/x86-64 – Available on RPM Fusion, build without DB support.
Motion and all its dependencies (ffmpeg…) are available on the RPM Fusion repository. Configure the repository and Install motion with

root@GarageServer1:~# sudo yum install motion

For other linux distributionsdownload and install the tar package.ntar and uncompress the file to the place you want the program installed. Recommended is to place the motion source file directory in /usr/local.
Go here
for more intructions.

Enable Motion by editing /etc/default/motion file:

# set to 'yes' to enable the motion daemon
start_motion_daemon=yes

If you have only one webcam (or other type of cam) you only need one config file called
motion.conf.
Here are the parameters in this file I modified:

daemon on
#be sure to point to your video device
videodevice /dev/video0
#default size 352x288 seemed too small for me
width 640
height 480
#with night vision it looks better in high contrast
contrast 192
#save the first image when motion is detected, here you can also set a number
output_normal first
#write what you are watching or some copyright
text_left Garage Cam
#where to put your images (and videos)
target_dir /home/alf/snapshots
#let to connect from a remote computer
webcam_localhost off
webcam_port 8081

Start Motion:

root@Garage:~# /etc/init.d/motion start

Go to http://your_host:8081 from any computer on your intranet and hopefully you can see what the camera see...