It is quite easy interfacing USB webcam with Raspberry Pi with just few modifications.Live video can be streamed online to the server wirelessly.
Before beginning this process make sure you install the Raspbian OS and complete the bootup process of the Raspberry Pi using a micro SD card/Pendrive (min 8GB).
1. Power the raspberry pi.Open the raspbian desktop using HDMI cable to a TV or a monitor.Connect it to the Wifi from the icon in the top right corner.After it gets connected move the cursor on top of the icon, note the IP address displayed.
2. To enable remote desktop install the library by typing sudo apt-get install xrdp in the terminal and click Enter.Then access the desktop from any laptop by providing the IP address.The deafult id is "pi" and password "raspberry".Make sure the remote laptop is connected to the same Wifi as that of the raspberry pi.
3.Connect camera to pi.To make sure that it gets detected type lsusb and click Enter.The device details are displayed.
4. Install motion by typing sudo apt-get install motion.
5. Type sudo nano/etc/default/motion and make start_motion_daemon to yes.Press 'ctrl+o' to save and 'ctrl+x' to exit. 'nano' is the text editor.
6. To edit configurations type sudo nano /etc/motion/motion.conf and click Enter.A file will open. Make the following changes in it.Then Save and exit.
Change 'Stream_localhost' to OFF
Keep 'Stream_port' to 8081
Set 'width' & 'height' to 640 & 480
7. Reboot pi then start the server by typing sudo service motion start.Now it is ready to stream.
8. Open the browser in laptop or mobile and type the IP address along with the port as 18.104.22.168:8081 (first the IP address : the port) and watch the video live.The video can also be seen in VLC media player by opening VLC--media----->open network stream---and giving the network URL http://22.214.171.124:8081
9. Stop the server by typing sudoservicemotionstop.