How to live stream video from webcam on Linux
Source: Xmodulo
Have you ever wanted to live stream a video feed from your webcam for someone else? You could use any existing video chat software such as Skype, Google+ Hangouts. However, if you do not want to rely on any third-party streaming infrastructure, you can set up your own webcam streaming server in house.
In this tutorial, I will describe how to live stream video from webcam by using VLC. VLC is an open-source, cross platform media player which can handle virtually all video and audio formats. VLC can also run as a streaming server supporting various streaming protocol such as RTP, HTTP, RTSP, etc.
Before attempting to set up webcam streaming on your own, you need to understand the huge potential security risk of streaming a webcam over the Internet. Anyone can tap into your streaming feed unless you properly access control the streaming server, and encrypt the streaming traffic. I’ll briefly mention several security protections against threats towards the end of the tutorial.
Install VLC on Linux
Before setting up a streaming server with VLC, install VLC first.
To install VLC on Debian, Ubuntu or Linux Mint:
To install VLC on Fedora, first enable RPM Fusion’s free repository, and then run:
To install VLC on CentOS or RHEL 6, first set up EPEL repository, and then use the following commands:
$ sudo wget http://pkgrepo.linuxtech.net/el6/release/linuxtech.repo
$ sudo yum install vlc
Verify Webcam Device on VLC
Next, verify whether a webcam device is successfully detected on your Linux system and VLC.
To do so, first find out the device name of your webcam with the following command. In this example, the device name of the webcam is /dev/video0.
/dev/video0
Now use the following command to test video from your webcam. Replace “video0” with your own device name.
If your webcam is successfully detected by VLC, you should see a video stream of yourself.
Configure Webcam Streaming on VLC
Assuming that your webcam is successfully recognized by VLC, I am going to show how to configure webcam streaming. In this setup, webcam is streamed over HTTP in WMV format.
To configure VLC for webcam streaming, first launch VLC.
Choose “Streaming” from VLC menu.
On the screen, choose webcam/audio device name (e.g., /dev/video0 for webcam, and hw:0,0 for audio). Click on the checkbox of “Show more options”. Make a note of value strings in “MRL” and “Edit Options” fields. We will use these strings later in the tutorial. Click on “Stream” button at the bottom.