First of all, we need a machine to run the VLC server on. Here, it will be 192.168.0.2, an Ubuntu 8.04 machine with VLC 0.9.8a, ffmpeg SVN-r16245 (built from source) and x264 0.65.1057 (built from source).
Then, we need to copy some media files on the server. I'll use an MP3 file (music.mp3) and an MPEG2 video (video.mpg), both located in /home/julien/media.
Now, let's write the VLC configuration file and save it as vlc_vod_config:
# VLC media player VLM command batch
#
http://www.videolan.org/vlc/
new MyMusic vod enabled
setup MyMusic input "file:///home/julien/media/music.mp3"
new MyVideo vod enabled
setup MyVideo input "file:///home/julien/media/video.mpg"
new MyVideoMobile vod enabled
setup MyVideoMobile input "file:///home/julien/media/video.mpg" output "#transcode{venc=ffmpeg,vcodec=h264,vb=384,height=120,width=160,fps=20,aenc=ffmpeg,acodec=mp3,ab=64,channels=1}"
It's fairly self explanatory
As you can see, we need to create an entry for each media we want to stream:
the media identifier (MyMusic, MyVideo) following the new keyword is important because it's going to be part of the URL used by the client to access the media.
vod stands for Video on Demand (VLC can also do broadcast streams)
enabled, well... you get the idea
setup...input links the identifier to the actual media file we want to stream
The last stream, MyVideoMobile, is based on the same MPEG input file as the MyVideo stream. However, this file will be resized and transcoded on the fly into H264 video and MP3 audio. For example, this could be useful for mobile clients, which require a smaller resolution and a much lower bitrate than PC clients.
Now let's open a terminal on the server and start VLC. We want it to run as an RTSP server on port 5554. We also want to use the telnet interface to configure it and the telnet password will be 'videolan':
ubuntu% vlc -I telnet --telnet-password videolan --rtsp-host 0.0.0.0:5554
output removed
[00000405] telnet interface: telnet interface started on interface 4212
That's it for the server. Now, let's configure it from a client using telnet:
client% telnet 192.168.0.2 4212
Trying 192.168.0.2...
Connected to 192.168.0.2.
Escape character is '^]'.
Password:
Welcome, Master
> load /home/julien/media/vlc_vod_config