Sunday, April 03, 2016

VLC Streaming

Here is my setup to use VLC running on a laptop with a webcam as a simple CCTV system that can stream to your mobile.

VLC was installed on a laptop running Ubuntu 14.4. The webcam input stream was found at
v4l2:///dev/video0

and the audio input was found at
alsa://hw:0,0

using the command line for VLC I started capturing these two devices, transcoding and streaming to http with the following script
For some reason .asf was the only encapsulation that worked, the filename you set pics the encapsulation. You can do all of this via the VLC gui, but you will need to change the string on the last page if you want a username and pass as VLC does not set that by default, instead sets the dst only.
Create the necessary port forward in the router if you wish to access via WAN, or leave locked down if using local only.

On the receiving device open VLC and open 'Network Stream' as http://[username]:[password]@[wanip or localhost]:[port]/[file]. E.g. http://jsmith:mypass@1.2.3.4:8080/go.asf

A bit more long winded but can also can be done via the VLC GUI :

  • Media > Open Capture Device 
  • Choose your Webcam and Microphone 
  • Use the drop-down next to 'Play' to instead choose 'Stream'
  • Source - it should fill the input source for you so just next
  • Destination Setup - use the dropdown, select http and click add. 
  • Set the port and file name, e.g. 8080, /go.asf (the file name must match the transcoding profile encapsulation type) 
  • Pick the transcoding profile, the only one I got to work was ASF with DIV3 and MP3 
  • You can then edit the final string before clicking stream, but should work with no edits.

Simply test by opening another VLC window and trying to open the 'Network Stream' you just created e.g. http://localhost:8080/go.asf