How do you stream something in VLC?

About encoding, codec settings, muxers and filter usage
Agent24
New Cone
New Cone
Posts: 9
Joined: 24 Mar 2007 19:06

How do you stream something in VLC?

Postby Agent24 » 23 Sep 2011 01:01

I wish to stream a webcam over my LAN.

I do not really know how to do this. The VLC tutorial is for an older version (I have 1.1.9 in Ubuntu, the streaming wizard looks completely different)

I can open and view my webcam /dev/video0/ in VLC but I have no idea how to stream it.


What do I need to do in regards to selecting a "Destination" ??

I have tried different things but none of them seem to work. They want me to enter an address. what address? The host? The destination? My damn router? There is no indication of what the address is actually of\for! :x

I also have no idea if I should enable transcoding or not. I assume I don't need to enable it if I just want to stream the data straight from the webcam, but I am not sure.


Can someone please help me figure out how to do this?

bobc02
Blank Cone
Blank Cone
Posts: 11
Joined: 26 Aug 2011 06:45

Re: How do you stream something in VLC?

Postby bobc02 » 25 Sep 2011 08:15

I am a VLC/Streaming noobi too, but I will share with you what I have learned because there's not much help, lately, from this forum. Though some past posts and some of the tutorials have good information.

My environment is also Ubuntu, so much of what I present below will apply to your needs. You need to use the V4L2 (Video for Linux version 2) driver to interface between your capture card and VLC. I use the Hauppauge WinTV-HVR-1150 capture card, which my analog camera is attached to and it works well with V4L2 and VLC. Use the command v4l-info to see what is known about your card. If instead of a capture card you are using a USB camera, then most of what I show here probably won't work for you.

What you need to do is grab the properties from two different sections of the VLC GUI when you are streaming your camera output, then use those properties to understand how a Command Line is configured, so that you can write your own. Then you present your stream coming from the VLC through a web browser.

So, get your camera displaying the output in the VLC GUI window, then open the Media + Streaming menu item and go to the Capture Tab. Then do the following:

Code: Select all

1) In the "Capture mode" dropdown, choose the appropriate value - mine is "Video for Linux 2" 2) Enter /dev/video0 in the "Video device name" field. 3) Click "Advanced options..." then select the Input value that corresponds to the channel on the video card that your camera is attached to. On my Hauppauge 1150 card, my camera is connected to the "Composite" jack, which is channel 1. I learned this by using"v4l-info". 4) OK out of the Advanced options (for me all default values work except Input channel). 5) Click the checkbox "Show more options" and you will see a field "Edit Options", copy the string to a text pad to be used when you write the command line. 6) Click the "Stream" button. 7) Click Next button. 8) For "New Destination" choose "HTTP" then click Add button. 9) Add 1234 (the VLC default streaming port) to the Port field. 10) In the Profile dropdown choose a Video format - I chose WMV + WMA(ASF). It doesn't matter which format, this is just a placeholder and will probably be replaced by a different format when you create your command line(s). 11) Click Next button. 12) Copy the "Generated stream output string" to your textpad - it will also be used for the command line.
Here's what I have on my textpad:

Code: Select all

:input-slave=alsa:// :v4l2-standard=0 :file-caching=300 :sout=#transcode{vcodec=WMV2,vb=800,scale=1,acodec=wma2,ab=128,channels=2,samplerate=44100}:http{mux=asf,dst=:1234/} :no-sout-rtp-sap :no-sout-standard-sap :sout-keep
Notice how the vcodec is WMV2 and the mux is asf, and the destination (dst) is 1234.

Now write the command line using some of the properties, substituting the values that make sense for what you want to stream. I wanted to stream Flash. Google around for different command line techniques and borrow from those that make sense for your stream. For example, I googled for "VLC command line for flash streaming" and found several pages that had stuff I could use.

Here's what my VLC + V4L2 + FFMPEG + Flash command line looks like:

Code: Select all

cvlc v4l2:///dev/video0 :input-slave=alsa:// :v4l2-input=1 :v4l2-caching=300 --sout '#transcode{vcodec=FLV1,acodec=mp3,vb=200,deinterlace,fps=25,samplerate=44100,ab=32}:duplicate{dst=std{access=http,mux=ffmpeg{mux=flv},dst=:1234/camera.flv},dst=display}' --no-sout-rtp-sap --no-sout-standard-sap --sout-keep
Every command line I write have the following elements:

cvlc v4l2:///dev/video0 :input-slave=alsa:// :v4l2-input=1 :v4l2-caching=300 (To hook up my V4L2 and my card)

--no-sout-rtp-sap --no-sout-standard-sap --sout-keep (To control VLC)

Everything between these two elements is customized for the type of video I want to stream. This example is for Flash, but I am also working on MP4 and WEBM command lines that are very similar.

VLC commands include a chaining of what they call modules. #transcode is one module; duplicate another, std, ffmpeg are others. Modules involve a name (i.e. transcode) and braces {} for the module definition. Modules can be chained together and embedded within other modules. The VLC manual explains the concepts.

Here are some pages I found useful:
http://wiki.videolan.org/Simple_Stream_VLC_to_Website
http://wiki.videolan.org/Stream_VLC_to_ ... _and_Flash
http://www.willus.com/author/streaming2.shtml

This is about all I know at this point. I hope it helps.

--Bob


Return to “VLC stream-output (sout)”

Who is online

Users browsing this forum: No registered users and 13 guests