Streaming Ogg Theora with VLC
Software name : VLC
Software version : 0.8.6b
Hardware Requirements : internet connection, 300 MHz computer
Software Requirements : for Linux you need automake version 1.9 or greater, libtool, libtheora, libshout, g++, gettext, libgcrypt and wxwidgets or qt4 installed, access to an Icecast server
vlc can now stream theora to icecast2. Doing this with Windows isn't that tricky. However, if you wish to do this with Linux you will need to have some experience installing software from the command line.
Streaming Server Requirements
We will look at streaming to an Icecast Server. To do this you need access to an Icecast Server or someone needs to create you an account and give you the access details. You need to know the following details about the Icecast Server :
- Hostname or IP Number of the Icecast Server
- Port (default is 8000)
- Password
- Username (this may not be necessary depending on how Icecast is configured)
- Mountpoint (this may not be necessary depending on how Icecast is configured)
Preperation (Linux)
I installed the source code version of vlc using a clean (new) Debian 4.0 (r0). Please note : this process can take a while and its not straight forward. Compiling vlc can be tricky and it very well may not follow exactly what see here (depending on what you have installed on your computer). Additionally the compiling itself (running make) can take a while even on fast machines. Beware!
You will need automake version 1.9 or greater. To find out if this exists type 'automake --version' in your terminal. If you get an error, then its not installed, if it reports that the version number is less that 1.9 then you need to upgrade.
To test for libtool try typing 'libtool --version' in the terminal, if you see an error then its not installed and you will first need to install it.
To test for gettext type 'gettext --version' in the terminal, if you get an error then its not installed and you need to install it.
To test for g++ type 'g++ --version' in the terminal, if you get an error then its not installed and you need to install it.
Additionally libgcrypt needs to be present. To test if you have it installed already try the command 'whereis libgcrypt' in the terminal. if you don't get some files listed it isn't installed. (Debian users install libgcrypt11).
Additionally libtheora needs to be present. To test if you have it installed already try the command 'whereis libtheora' in the terminal. if you don't get some files listed it isn't installed. (Debian users install libtheora).
Check for libshout by typing 'whereis libshout' if you get no feedback then find it and install it. You also need the header files for libshout (Debian users install libshout3-dev).
To check if wxwidgets is installed type 'wx-config' in the terminal, if you get an error that the command does not exist then install it (Debian users install libwxgtk2.6-dev). Alternatively you can use qt4 (these libraries are for the graphic user interface) but if you do this you are on your own as we will follow the wxwidgets route here .
Now download the latest sources from http://www.videolan.org/vlc/download-sources.html
Now you will need to untar the source file, at the time of writing the sources are 0.8.6b, so type the following
tar zxvf vlc-0.8.6b.tar.gz
Next you will need to cd to the newly created directory.
cd vlc-0.8.6b
Installation (Linux)
Next you need to run the configure script with the right parameters.
If you have decided to compile wxwidgets then you need to include --enable-wxwidgets. If you are using the qt4 interface then VLC now detects this by default so no parameters are needed. Additionally you require the --enable-shout parameter, otherwise the shoutcast module won't be installed and you won't be able to stream.
You could then just run the configure script with these parameters but you will probably come up with some errors. I did this several times and when an error appeared in the configure process I looked at the error message and then tried to work out what software was missing and disbaled it with another parameter. I had to disable libmad (--disable-mad) as it wasn't installed. Additionally I had to use --disable-a52 and --disable-ffmpeg and --disable--libmpeg2 and --disable-glx. All my libraries are located under '/usr' not '/usr/local' so I had to also include the --Prefix=/usr parameter. So my complete command line configure script execution looked like this
./configure --enable-shout --disable-mad --disable-a52 --disable-ffmpeg
--disable-libmpeg2 --disable-glx --enable-wxwidgets --enable-theora --prefix=/usr
The above command would have to all appear on one line in your terminal. Next, if your configure process goes smoothly with no more errors, try the make command.
make
The build will take a while even on a fast machine so go and get a coffee. If it is successful then type:
make install
The only trick here that I know of (and there maybe others) is that if you don't have g++ installed you won't get any errors compiling vlc but the interface won't compile and you will end up with a command line only version. If this happens and you want vlc with a graphic interface, then check you have g++.
Check Shout Module is Installed (Linux)
If you are using Linux you will need to double check the shout module is installed before you progress. To do this type the following into a terminal:
vlc -l | grep shout
If all is well you will see something like the following in the terminal window:
VLC media player 0.8.5 Janus
access_output_shout IceCAST output
playlist New winamp 5.2 shoutcast import
shout Shoutcast radio listings
The important part of the above output is the access_output_shout IceCAST output. This means you have the right module available for streaming to an Icecast Server. If you don't have this module you are going to have to read up on how to install it. Note : It might be that the Shout libraries store the shout.h file in the wrong place, this is a bug in the latest versions of Shout. To work around this, you may need to re-compile VLC but before doing so edit the file shout.c file in the VLC sources. This file is located here:
modules/access_output
you will need to edit this line:
#include <shout/shout.h>
to this:
#include <shout.h>
Check Shout Module is Installed (Windows)
To check if the Shout Module is installed on Microsoft Windows you will need to open the Preferences window from the Settings menu:
The preferences interface will open:
Now click on the tiny "+" next to Stream Output :
You will get a drop down menu:
Click on the "+" next to Access output and with luck you will see something like this:
Notably, there will be an item labeled Shoutcast. If you don't see this then the Shoutcast module is not installed. If it is not installed then try downloading the latest installer and install VLC again. If you do see it then you should be able to stream to Icecast. Clicking on the Shoutcast icon should show you something like this:
Choosing Video File to Stream
You can stream audio or video with VLC to Icecast. However this has variable results depending on what operating system you are using. For now we will look at streaming an ogg theora video file. The first thing you need to do of course is open VLC. Now from the File menu choose Open File
This will open a file browser so you can browse (click the Browse button) through your harddisk and choose a video file to stream.
Press the Open button at the bottom right. When you have done this there should be the title and location of your chosen file displayed in the interface:
Stream Settings
Now click on the Stream/Save check box:
This should then make the Settings... button clickable:
Now click the Settings... button and you should see something like this:
This is the configuration window for your stream. It might look complicated, and truth be told, it is! However we can go through this process quickly to configure and outgoing audio stream to an Icecast Server. The way that VLC works with outgoing streams is by creating what the good people at Videolan call an output chain. An output chain is a rather complicated way of referring to the the process of configuring VLC so that it streams.
Unfortunately VLC doesn't (yet) incorporate a handy GUI (Graphical User Interface) for doing this. GUIs are much easier if you aren't used to configuring software using command line interfaces (CLI). We can get some of the way to configuring our stream settings through the interface but the rest will have to be typed into the Stream Output MRL at the top of the above dialog.
First of all, click on the HTTP check box in the Outputs section of the window:
When checked you will see two things happen, firstly the information to the right of the check box will allow you to input data:
The other thing you will see is that the Stream output MRL box will display some information:
The above information is what we need to tweak to make VLC stream and to do this you will need to alter the information in this text box using the Icecast Server details you should have.
Entering Server Information
In the above example the following information is shown in the Stream output MRL:
:sout=#duplicate{dst=std{access=http,mux=ts,dst=:1234}}
We need to alter this information to reflect the details you have of your streaming server (Icecast). You should have the following details:
- Hostname or IP Number of the Icecast Server
- Port (default is 8000)
- Password
- Username (this may not be necessary depending on how Icecast is configured)
- Mountpoint (this may not be necessary depending on how Icecast is configured)
These need to be incorporated in the Stream output MRL box as follows:
:sout=#duplicate{dst=std{access=shout,mux=ogg,dst=username:pass@hostname:port/mountpoint}}
Notice that the two following settings are also important to check if they are correct:
access=shout
mux=ogg
For example, lets say I had the following details:
- Hostname : icey.me.net
- Port : 8000
- Password : floss
- Username : streamer
- Mountpoint : live
Then the Stream output MRL would read as follows:
:sout=#duplicate{dst=std{access=shout,mux=ogg,dst=streamer:floss@icy.me.net:8000/live}}
There are a couple of things to note here. First, with Icecast you don't always need a username to stream. If you are in this situation then use "source" in the text above where the password should be. For example, the text in the Stream output MRL would be something like:
:sout=#duplicate{dst=std{access=shout,mux=ogg,dst=source:floss@icy.me.net:8000/live}}
Also, if you haven't been given a mountpoint you can usually make one up but don't use any special characters in the text, and if you haven't been given a port then try the default 8000.
Start Streaming
All that is left to do is to press the OK button at the bottom of the window, you will be returned to the previous window:
Now you are almost ready to stream. Press OK again, and you should start streaming. VLC provides minimal feedback to let you know how things are going, but if all is ok, you should check your streaming server status page, or try and connect to your stream.
Streaming Live Video (Linux)
The same process will work for streaming live video from a camera
. Follow the same steps as above, except that you will use the following output chain :
v4l:/dev/video:input=2:norm=palize=192x144 –sout \
‘#transcode{vcodec=theora,vb=300,acodec=vorb,ab=96}td{access=shout,mux=ogg,url=iceyserver.com:8000}
you can replace localhost:8005 with your details