LDP/LDP/howto/linuxdoc/VideoLAN-HOWTO.sgml

1165 lines
40 KiB
Plaintext
Raw Blame History

<!DOCTYPE linuxdoc system>
<article>
<title>VideoLAN Howto</title>
<author>written and maintained by Marc Ariberti
<htmlurl url="mailto:marcari@videolan.org" name ="&lt;marcari@videolan.org&gt;">
and Alexis de Lattre
<htmlurl url="mailto:alexis@videolan.org" name ="&lt;alexis@videolan.org&gt;">
<date>
version 1.5 2002/05/25
</date>
<abstract>
This howto describes how to use the complete VideoLAN solution.
</abstract>
<toc>
<sect>Introduction
<p>
<sect1>What is the VideoLAN project ?
<p>
VideoLAN is a complete software solution for video streaming, developed
by students at the <htmlurl url="http://www.ecp.fr" name="Ecole Centrale
Paris"> and contributors from all over the world, under the <htmlurl
url="http://www.gnu.org/copyleft/gpl.html" name="General Public License
(GPL)">. It has been designed for streaming MPEG 1 and MPEG 2 videos on
local area networks (LAN), but it can be extended to metropolitan or
wide area networks (MAN, WAN), thanks to the multicast technology.
The VideoLAN solution includes a server, which can stream video from
various sources (file, DVD, satellite and MPEG 2 encoder), a client, which can
receive, decode and display MPEG 1 and MPEG 2 streams and, if necessary,
a channel server which tells automatically to the client the parameters
needed to receive the stream.
Here is an illustration of the complete VideoLAN solution :
<verb>
DVD --->- Unicast/Broadcast/Multicast
\ ---
File --->-- -------- / \ --------
|->-| Server |=====>====| LAN |---->-----| Client |
Satellite ->-- | (VLS) | \ / | (VLC) |
/ -------- --- --------
MPEG2 -->- ^
encoder |
v
----------------
| Channel Server |
| (VLCS) |
----------------
</verb>
More details about the project can be found on the
<htmlurl url="http://www.videolan.org" name="VideoLAN Web site">.
<sect1>About this Howto
<p>
This Howto is designed to explain how to use the complete VideoLAN
solution. It presents the different possibilities of VideoLAN and which
configuration you should adopt depending on the configuration of your
network.
<sect1>Legal notice
<p>
Copyright (<28>) 2002 by the VideoLAN project.
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version
1.1 or any later version published by the Free Software Foundation ;
with no Invariant Sections, with no Front-Cover Texts, and with no
Back-Cover Texts. The text of the license can be found on <htmlurl
url="http://www.gnu.org/copyleft/fdl.html">.
<sect1>The documentation of the project<label id="doc">
<p>
There are four main documents :
<itemize>
<item>the <htmlurl
url="http://www.videolan.org/doc/videolan-quickstart/videolan-quickstart.html"
name="VideoLAN Quickstart">,
<item>this VideoLAN HOWTO,
<item>the <htmlurl url="http://www.videolan.org/vls/doc/vls-guide.html"
name="VideoLAN Server user guide">,
<item>the <htmlurl url="http://www.videolan.org/vlc/doc/vlc-howto.html" name="VideoLAN
Client HOWTO">.
</itemize>
The up-to-date version of these documents can be found on the <htmlurl
url="http://www.videolan.org/doc" name="VideoLAN Web Site">.
<sect1>Requirements
<p>
<sect2>The skills
<p>
Basic skills on Linux and Network should be enough.
<sect2>The VideoLAN Client
<p>
The VideoLAN Client (<tt/vlc/) works on many platforms : Linux, Windows,
Mac OS X, BeOS, *BSD, Solaris, iPaq, QNX. It can read MPEG 1, MPEG 2 and
MPEG 4 / DivX files from a hard disk or a CD-ROM drive, read DVDs and
VCDs. But the most important function is that it can read MPEG 1, MPEG 2
and DVDs streamed on a network. vlc requires at least a Pentium 400Mhz
with 32MB of RAM.
<sect2>The VideoLAN Server and mini-Server
<p>
The VideoLAN Server (<tt/vls/) can read videos from :
<itemize>
<item>an MPEG 1 or MPEG 2 file stored on a hard drive or on a CD,
<item>a DVD located in a local DVD drive or copied on a hard drive,
<item>a satellite card,
<item>an MPEG encoding card ;
</itemize>
and stream it on the network.
A Pentium 100 MHz with 32 MB of memory should be enough to send one
stream on the network. When streaming a lot of videos stored on a
hard drive, the actual limitation is not the processor but the hard
drive and the network connection.
<tt/vls/ works under Linux, Solaris and Windows. Currently, the Windows
<tt/vls/ version of is only able to stream a video from a file.
The VideoLAN mini-Server (<tt/vlms/) is only capable of streaming an MPEG
file. <tt/vlms/ works on Linux only. It is easier to install and configure
than <tt/vls/ and should be used mainly for testing purposes.
<sect2>Get a streamable MPEG file
<p>
<tt/vls/ and <tt/vlms/ can stream MPEG 1 or MPEG 2 files that meet two
critera :
<enum>
<item>the file must be MPEG <bf>PS</bf> (Program Stream) or MPEG
<bf>TS</bf> (Transport Stream), that contain video and audio
multiplexed. <tt/vls/ and <tt/vlms/ can't stream MPEG ES (Elementary
Stream), i.e. a file with only audio or video.
In order to know if an MPEG file is MPEG <bf>PS</bf>, MPEG <bf>TS</bf>
or MPEG <bf>ES</bf>, read the file with <tt/vlc/ and look at the
messages (with the interface : Click on "View" and "Messages", or use
the command line "vlc -v") and look for a line :
<tscreen><verb>
module: locking demux module `mpeg_XX'
</verb></tscreen>
If XX = ps or XX = ts, then your file is MPEG <bf>PS</bf> and MPEG
<bf>TS</bf> respectively , and you may be able to stream it. If XX = es,
then your file is MPEG <bf>ES</bf> and is not streamable.
<item>the sequence header of the video must repeat itself regularly,
which is often the case with MPEG 2, but very rare with MPEG 1. There is
no easy way to know if the sequence header is repeated regularly.
Files with a <tt>.vob</tt> extension are normally MPEG
2 files and files with <tt>.mpg</tt> or <tt>.mpeg</tt> extension or usually
MPEG 1 files.
</enum>
You can download this streamable MPEG 2 PS file for your tests : <htmlurl
url="ftp://ftp.videolan.org/pub/videolan/streams/presentation/presentation_short.vob" >.
<sect2>The VideoLAN Channel Server
<p>
The VideoLAN Channel Server (<tt/vlcs/) is the central architecture that
manages the network. There are different versions of vlcs for different
kinds of networks. For example, if your network supports multicast,
you will use <tt>mini-vlcs</tt>. If your network doesn't support
multicast but supports VLANs, you should use <tt>mini VLAN Server</tt>.
vlcs works on Linux only.
<sect2>The Network<label id="bitrate">
<p>
You will need a network, which can be as small as one ethernet 10 / 100 Mbit/s
switch or hub, and as big as the whole Internet ! See if your network
supports "multicast". The bandwidth needed is :
<itemize>
<item>6 to 9 Mbit/s for a DVD,
<item>3 to 4 Mbit/s for an MPEG 1 stream, an MPEG 2 stream (from a satellite
or an MPEG 2 encoding card).
</itemize>
<sect1>The mailing-lists
<p>
If you have problems using VideoLAN, and if you don't find the answer
to your problem in the <ref id="doc" name="documentation">, please look
at the <htmlurl url="http://www.via.ecp.fr/ml/videolan" name="online
archive of the mailing-lists">. There are 3 english-speaking
mailing-lists for the users :
<itemize>
<item><tt>vlc@videolan.org</tt> for the questions on <tt/vlc/,
<item><tt>vls@videolan.org</tt> for the questions on <tt/vls/ and <tt/vlms/,
<item><tt>vlcs@videolan.org</tt> for the questions on <tt/vlcs/ and the network.
</itemize>
The mailing lists above also have their equivalent for the developers
(they also receive the commit mails) :
<itemize>
<item><tt>vlc-devel@videolan.org</tt> for the development of <tt/vlc/,
<item><tt>vls-devel@videolan.org</tt> for the development of <tt/vls/ and <tt/vlms/,
<item><tt>vlcs-devel@videolan.org</tt> for the development of <tt/vlcs/ and
the network tools.
</itemize>
If you want to subscribe or unsubscribe to the mailing-lists, please go
to the <htmlurl url="http://www.videolan.org/lists.html" name="VideoLAN
Web Site">
<sect>Overview of the existing streaming solutions
<p>
In this section, we assume that :
<itemize>
<item>a VideoLAN Client (<tt/vlc/) is installed on all
the client machines. Please, refer to the <htmlurl
url="http://www.videolan.org/doc/videolan-quickstart/videolan-quickstart.html"
name="VideoLAN Quickstart"> or the <htmlurl
url="http://www.videolan.org/vlc/doc/vlc-howto.html" name="VideoLAN
Client HOWTO"> for the installation instructions.
<item>a VideoLAN Server (<tt/vls/) or a VideoLAN mini-Server
(<tt/vlms/) is installed on a machine. Please, refer to the <htmlurl
url="http://www.videolan.org/doc/videolan-quickstart/videolan-quickstart.html"
name="VideoLAN Quickstart"> or the <htmlurl
url="http://www.videolan.org/vls/doc/vls-guide.html" name="VideoLAN
Server user guide">.
<item>you have the knowledge and the passwords to configure your network
hardware (such as switches and routers).
</itemize>
<sect1>Unicast
<p>
<sect2>What is unicast and why use it ?
<p>
Unicast is a simple protocol : the packets are sent directly
from one machine to another. With VideoLAN, this mean that the source
IP address is the one for the server machine, and the destination IP
address is the one for the client machine. With unicast, the stream can
go through routers without any problem.
Unicast should be used when you want to send the stream to one client
machine only. It is also used for <ref id="vod" name="Video on Demand">.
<sect2>Network hardware required
<p>
No special feature or configuration of your network hardware is required.
The only problem is the bandwidth. As explained in the <ref id="bitrate"
name="introduction"> , an MPEG 1 or 2 stream needs between 3 and 9
Mbit/s. So a 10 Mbit/s Ethernet network should be enough. 100 Mbit/s
would be needed if you want to stream several videos at the same time
or stream one big DVD stream (a DVD stream can go up to 11 Mbit/s if
there are many languages, subtitles and multiple angles).
<sect2>Server configuration
<p>
You can either use <tt/vlms/ or <tt/vls/ to do unicast.
<sect3><tt/vlms/<p>
<tt/vlms/ can only stream valid MPEG PS files stored on a hard drive.
You can download this streamable MPEG 2 PS file for your tests : <htmlurl
url="ftp://ftp.videolan.org/pub/videolan/streams/presentation/presentation_short.vob"
>.
In the example below, the IP address of the client machine is
<tt>10.0.0.2</tt>. The name of the MPEG file is called
<tt>MPEG_file_name</tt>.
Run <tt/vlms/ :
<tscreen><verb>
% vlms -d 10.0.0.2 MPEG_file_name
</verb></tscreen>
If you want the server to stream the file continuously, you can use the
<tt/-l/ option :
<tscreen><verb>
% vlms -d 10.0.0.2 -l MPEG_file_name
</verb></tscreen>
or if you want to send it 3 times use the option <tt/-n 3/ :
<tscreen><verb>
% vlms -d 10.0.0.2 -n 3 MPEG_file_name
</verb></tscreen>
<sect3><tt/vls/<p>
Modify the configuration file <tt>vls.cfg</tt> by adding the following :
<tscreen><verb>
BEGIN "Channels"
net1 = "network"
END
BEGIN "net1"
Domain = "Inet4"
Type = "unicast"
DstHost = "10.0.0.2"
DstPort = "1234"
END
</verb></tscreen>
Then, restart <tt/vls/ and start to stream a video to "net1".
<sect2>Client configuration
<p>
On the client, run <tt/vlc/ with this command line :
<tscreen><verb>
% vlc udp:
</verb></tscreen>
You can also use the interface :
<tscreen><verb>
% vlc
</verb></tscreen>
and then click on "Net" and select "UDP".
<sect1>Broadcast
<p>
<sect2>What is broadcast and why use it ?
<p>
Broadcast is a very dirty method to stream video : the stream is sent
to all the machines of a subnet at the same time. With VideoLAN, this
means that the source IP address is the IP address of the server, and
the destination IP address is the broadcast IP address of the subnet.
Broadcast is considered a dirty method because all the machines of the
subnet receive the stream, even the machine that don't want to watch the
stream. It creates a lot of pollution on the network and some devices
don't like to receive too much broadcast.
So broadcast should be used to stream video to multiple clients at
the same time <em>only</em> if your network hardware doesn't support
multicast (see <ref id="multicast" name="next subsection">).
<sect2>Network hardware requirements
<p>
No special feature or configuration of your network hardware is
required. It only needs to have the necessary bandwidth, as for unicast.
<sect2>Server configuration
<p>
You can either use <tt/vlms/ or <tt/vls/ to do broadcast.
<sect3><tt/vlms/<p>
In the example below, the broadcast IP address of the subnet is
<tt>10.0.0.255</tt>. The name of the MPEG file is called
<tt>MPEG_file_name</tt>.
Run <tt/vlms/ :
<tscreen><verb>
% vlms -d 10.0.0.255 MPEG_file_name
</verb></tscreen>
If you want the server to stream the file continuously, do :
<tscreen><verb>
% vlms -l -d 10.0.0.255 MPEG_file_name
</verb></tscreen>
<sect3><tt/vls/<p>
Modify the configuration file <tt>vls.cfg</tt> by adding the following :
<tscreen><verb>
BEGIN "Channels"
net1 = "network"
END
BEGIN "net1"
Domain = "Inet4"
Type = "broadcast"
DstHost = "10.0.0.255"
DstPort = "1234"
END
</verb></tscreen>
Then, restart <tt/vls/ and start to stream a video to "net1".
<sect2>Client configuration
<p>
On the client, run <tt/vlc/ with this command line :
<tscreen><verb>
% vlc udp:
</verb></tscreen>
You can also use the interface :
<tscreen><verb>
% vlc
</verb></tscreen>
and then click on "Net" and select "UDP".
<sect1>Multicast<label id="multicast">
<p>
<sect2>What is multicast and why use it ?
<p>
When you use unicast or broadcast, you can encounter the following
problems :
<itemize>
<item>with unicast, when a lot of clients want to receive the stream,
the network interface of the server becomes saturated. So the number
of clients is very limited, especially when the stream is big.
<item>with broadcast on a <tt>LAN</tt>, the number of clients are not
limited because all the machines of the subnet receive the stream, with
only one stream going out of the network interface of the server. But
the machines that do not want to receive the stream are polluted and
some devices do not like to receive huge broadcasts. If you want to send
several streams at the same time, the network becomes oversaturated.
</itemize>
The above problems are why the multicast protocol was invented. With
multicast, the packets are sent on the network to a multicast IP group
which is designated by its IP address. Multicast IP addresses belong
to the Class D : <tt>224.0.0.0 -> 239.255.255.255</tt>.
The machines can join or leave a multicast group by sending a request to
the network. The request is usually sent by the kernel of the operating
system. Linux (if the option "IP multicast" in the category "Networking
options" is activated in the configuration of the kernel), Windows (at
least 98, 2000 and XP) and MacOS X support multicast. The <tt/vlc/ takes
care of asking the kernel of the operating system to send the join
request.
The network devices do everything necessary to keep in memory which
machine belongs to which group and forwards the stream to the client. It
is possible for one client to belong to several groups.
Below is a scenario given as an example :
<enum>
<item><tt/vls/ sends a stream to the multicast IP address 239.255.12.42. Client
n<EFBFBD>1 and n<>2 already joined the multicast group and receive the stream.
<tscreen><verb>
Server (vls) Network Clients (vlc)
stream --------------> 239.255.12.42 ----------> client n<>1
|
--------> client n<>2
</verb></tscreen>
<item>Client n<>3 sends a "join" request to the multicast group in order
to receive the stream.
<tscreen><verb>
Server (vls) Network Clients (vlc)
<-------------- client n<>3
join 239.255.12.42
</verb></tscreen>
<item>Client n<>3 now receives the stream.
<tscreen><verb>
Server (vls) Network Clients (vlc)
--------> client n<>1
|
stream --------------> 239.255.12.42-----------> client n<>2
|
--------> client n<>3
</verb></tscreen>
<item>Client n<>1 sends a "leave" request to the multicast group.
<tscreen><verb>
Server (vls) Network Clients (vlc)
<-------------- client n<>1
leave 239.255.12.42
</verb></tscreen>
<item>Client n<>1 doesn't receive the stream any more.
<tscreen><verb>
Server (vls) Network Clients (vlc)
stream --------------> 239.255.12.42 ----------> client n<>2
|
--------> client n<>3
</verb></tscreen>
</enum>
<sect2>Network hardware required
<p>
<em>Be careful !</em> Make sure that your network devices support
multicast.
If they do not, you will have the same effect as broadcast. For example,
hubs do not support multicast : if a machine connected to a hub joins a
multicast group, all the machines connected to the hub will receive the
stream.
Please refer to the management guide of your switches and routers to
see if they support multicast. All the recent manageable switches and
routers of the big network hardware manufacturers support multicast.
This document does not explain how to configure your network because it
is specific to each manufacturer.
<sect2>Server configuration
<p>
You can either use <tt/vlms/ or <tt/vls/ to do multicast.
<sect3><tt/vlms/<p>
Put the multicast IP address as the destination address :
<tscreen><verb>
% vlms -d 239.255.12.42 MPEG_file_name
</verb></tscreen>
Increase the <tt>TTL</tt> (Time To Live) value if you want your
multicasted stream to go through several routers. Every router decreases
the TTL by 1, and a stream can't go through a router if its TTL is 1.
For this, use the <tt/-t/ option :
<tscreen><verb>
% vlms -d 239.255.12.42 -t 12 MPEG_file_name
</verb></tscreen>
<sect3><tt/vls/<p>
In the configuration file <tt>vls.cfg</tt>, put the multicast IP
address in the <tt>DstHost</tt> field and "<tt>multicast</tt>" in the
<tt>Type</tt> field.
Do not forget to increase the <tt>TTL</tt> (Time To Live) if you want
your multicasted stream to go through several routers.
<tscreen><verb>
BEGIN "Channels"
net1 = "network"
END
BEGIN "net1"
Domain = "Inet4"
Type = "multicast"
TTL = "1"
DstHost = "239.255.12.42"
DstPort = "1234"
END
</verb></tscreen>
Then, restart <tt/vls/ and start to stream a video to "net1".
<sect2>Client configuration
<p>
On the client, run <tt/vlc/ with this command line :
<tscreen><verb>
% vlc udp:@239.255.12.42
</verb></tscreen>
You can also use the interface :
<tscreen><verb>
% vlc
</verb></tscreen>
and then click on "Net" and select "UDP Multicast" and write the
multicast IP address "239.255.12.42".
<sect1>Unicast IPv6
<p>
<sect2>Basics
<p>
You should already have IPv6 configured on the client and server
machines and on your network. For more information see the <htmlurl
url="http://www.tldp.org/HOWTO/Linux+IPv6-HOWTO/" name="Linux IPv6
howto">.
Unicast IPv6 was only tested under Linux, so we cannot tell if it works
on other platforms. If you use another operating system with IPv6,
please send us your feedback.
<sect2>Server configuration
<p>
<tt>IPv6</tt> is <em>NOT</em> supported by <tt/vlms/. You must use
<tt>vls</tt>.
In the configuration file <tt>vls.cfg</tt>, you have to change the
destination IP address to an <tt>IPv6</tt> address, and tell the system
that you want to stream using <tt>IPv6</tt>. Here is sample partial
<tt>vls.cfg</tt> :
<tscreen>
<verb>
BEGIN "Channels"
net1 = "network"
END
BEGIN "net1"
Domain = "Inet6"
DstPort = "1234"
DstHost = "3ffe::12"
END
</verb>
</tscreen>
In this example :
<itemize>
<item><tt>3ffe::12</tt> is the IPv6 address of the client,
<item><tt>Inet6</tt> tells <tt/vls/ to use IPv6.
</itemize>
Then, restart <tt/vls/ and start to stream a video to "net1".
<sect2>Client configuration
<p>
On the client, run <tt/vlc/ with this command line :
<tscreen><verb>
% vlc udp6:
</verb></tscreen>
or
<tscreen><verb>
% vlc --ipv6 udp:
</verb></tscreen>
If you want to specify the port on the command line of <tt/vlc/, for
example port 4321 :
<tscreen><verb>
% vlc udp6:@:4321
</verb></tscreen>
<sect>Using channel tools
<p>
Channel service tools are useful when you want to stream multiple
videos at the same time and enable the clients to change channel
(i.e. switching from one stream to another) easily without typing IP
addresses, but just using the interface and selecting a channel number.
The channel service tool that you will use depends on your network :
<itemize>
<item>if your network supports multicast, you will use <tt>mini VideoLAN
Channel Server (miniVLCS)</tt> ;
<item>if your network doesn't support multicast but supports VLANs, you
will use a <tt>VLAN server</tt> (either the VLAN Server or the mini VLAN
Server), and if your router cannot filter between VLANs, you will use a
<tt>VLAN bridge</tt> in order for the clients to be able to communicate
with all the other machines when watching a stream.
<item>if your network doesn't support multicast nor VLANs, then you will
not be able to stream multiple videos at the same time to the clients.
You can broadcast all the streams on different ports and use
<tt/miniVLCS/, but this is so dirty that you shouldn't even think about it !
</itemize>
<em>Warning</em> : the network tools that will be presented in this section
have been tested only under Linux. We cannot guarantee they will work with
other operating systems.
<sect1>Multicast and miniVLCS
<p>
If your network supports multicast, you will use the <tt>mini VideoLAN
Channel Server (miniVLCS)</tt> as your channel tool. This program sends
the parameters the VideoLan Clients need in order to receive the
streams.
<sect2>Building miniVLCS<label id="mini-vlcs">
<p>
Download the file <tt>miniVLCS-0.1.2.tar.gz</tt> from the <htmlurl
url="http://www.videolan.org/network/download.html" name="Network
download page">.
Then uncompress the archive and build the program :
<tscreen><verb>
% tar xvzf miniVLCS-0.1.2.tar.gz
% cd miniVLCS-0.1.2
% make
</verb></tscreen>
It creates an executable program named <tt>vlcs</tt>.
<sect2>miniVLCS configuration
<p>
Edit the configuration file <tt>vlcs.conf</tt>.
The first line corresponds to channel 0, the second line corresponds to
channel 1, the third line to channel 2, and so on.
In each line, put what you would type on the command line of <tt/vlc/,
except for the first line <tt>I: nostream</tt>. It means that you don't
stream anything in channel 0.
For example, if you have two multicast stream :
<itemize>
<item>Channel 1 : 239.255.12.42
<item>Channel 2 : 239.255.12.43
</itemize>
your <tt>vlcs.conf</tt> file would be :
<tscreen><verb>
I: nostream
udp:@239.255.12.42
udp:@239.255.12.43
</verb></tscreen>
<sect2>Run mini-vlcs
<p>
As normal user, do :
<tscreen><verb>
% ./vlcs
</verb></tscreen>
You must restart vlcs every time you change the configuration file
<tt>vlcs.conf</tt>.
<sect2><tt/vlc/ configuration
<p>
The simplest solution is to use the interface of vlc : click on "Net",
select "Channel server", write its IP address or DNS name.
Then, you see a new section "Network Channel" on the interface.
Select the desired channel and click on <tt>Go!</tt>.
<sect1>Broadcasting and VLANserver + VLANbridge
<sect2>Overview
<p>
If your network doesn't support multicast but supports VLANs, you will
use a VLAN server. If your network supports multicast, you will certainly
<em>NOT</em> want to use this solution, because it is far more complex
to set up and far more dangerous for the stability of your network. The
VLAN solution has been tested on "our" previous network (the network
of the student residence of the <htmlurl url="http://www.ecp.fr"
name="Ecole Centrale Paris">) and worked well. But we now have a new
network which supports multicast, so the VLAN solution is not tested nor
developed any longer.
In order to explain the VLAN solution, I will take the example of our
previous network. This network had :
<itemize>
<item>an ATM 155 Mbit/s backbone,
<item>on the periphery, 10 Mbit/s Ethernet switches with VLAN support.
</itemize>
As an MPEG stream needs a bandwith between 4 to 9 Mbit/s, we could send
multiple streams on our 155 Mbit/s backbone, but each student had a 10
Mbit/s connection and therefore could only receive one stream at the
same time. It was out of the question to send the stream to machines
that didn't want to receive it.
So the idea was to broadcast each stream in a VLAN, different from the
regular VLAN. In order for a student to change channel, we needed to
change his machine of VLAN. This was the job of the VLAN Server. The
VLAN Server received the requests of the VideoLAN Clients and changed
the machines of VLAN by sending SNMP requests to the switches.
We had the following VLAN configuration :
<itemize>
<item>VLAN 1 : VLAN for the switches,
<item>VLAN 2 : regular VLAN with no stream broadcasted, called channel 0,
<item>VLAN 3 : one stream broadcasted, called channel 1,
<item>VLAN 4 : one stream broadcasted, called channel 2,
<item>VLAN 5 : one stream broadcasted, called channel 3,
</itemize>
The VLAN Server has a big database with the correspondence between
the MAC addresses of the clients Ethernet network cards and the
couple (switch, port) where the client machine is connected. The VLAN
Server can fill up his database and update-it automatically by sending
regularly SNMP requests to the switches.
Let's take the following scenario as an example :
<enum>
<item>The VLAN configuration is as described above. All the computers
are in VLAN 2, which is the regular VLAN. Three streams are broadcasted
repectively in VLAN 3, 4 and 5.
<item>A student wants to watch channel 1. He starts <tt/vlc/ on its
machine and select channel 1. When he clicks on "Go!", his computer
sends a request to the VLAN Server. This requests contains the MAC
address of his Ethernet card and the number of the channel that he wants
to watch.
<item>The VLAN Server receives this request. It looks into its database
to see on which switch and which port of the switch the computer of the
student is plugged. It also knows that channel 1 is broadcasted in VLAN
3. It sends an SNMP request to the switch telling it to put the port on
which the student's computer is plugged in VLAN 3.
<item>The student's machine receives the stream and his <tt/vlc/ displays it.
<item>The student can select channel 2 or 3. His computer will send a
new request to the VLAN Server. The VLAN Server will send another SNMP
request to the switch telling it to put the port of which the student's
computer is connected is VLAN 4 or 5.
<item>When the student quits <tt/vlc/, his machine sends another request to
the VLAN Server asking to be put back to the regular VLAN (i.e. VLAN 2).
The VLAN Server receives the request and put the port back to VLAN 2.
</enum>
There is another problem : we want the machines in VLAN 3, 4 and 5
to be able to communicate with all the other machines. If you have a
good router, you can configure it so as to let the different VLANs
communicate but without letting the streams broadcasted by <tt/vls/ in a VLAN
go to the other VLANs. But if you have a bad router like our old router,
you need to develop another solution, called VLANbridge. The idea of the
VLANbridge is to have a machine under Linux connected to all the VLANs.
This machine is configured so as to let the different VLANs communicate,
but it prevents the streams broadcasted by <tt/vls/ in a VLAN go to the other
VLANs.
<sect2>The two versions of the tools
<p>
First, the VideoLAN team developed a VLAN Server and a VLANbridge
in C language. When a computer asked to go to channel 1, it sent a
request to the VLANserver. The VLANserver received this request, put the
port of the switch on which the computer was connecter in VLAN 3, and
transmitted this information to the VLANbridge so that the computer was
"bridged" with the other VLANs. The advantage of this solution was that
the computer hosting the VLAN Server could be a pretty modest machine.
But the VLAN Server was quite complex (all his database was written from
scratch in C language !), it segfaulted too often, there was regularly
MAC addresses missinig in its database, and there was sometimes some
problem of communicaction with the VLANbridge.
Then, in year 2001, the VideoLAN team started to develop a new set of
tools for the VLAN solution.
Marc Ariberti and Boris Dor<6F>s developped a new VLANbridge, called
<tt>vlb-linux</tt>. The idea was that the VLANbridge sould learn the
changes by itself, and didn't need to communicate with the VLAN Server.
They developed a patch for the bridge module of the Linux kernel, so as
to serve the needs of VideoLAN. You just have to tell to the VLANbridge
the MAC addresses of the <tt/vls/, and it automatically learn which machine
is in which VLAN, and enable the VLANs to communicate but it firewalls
the packets that have the source MAC address of a <tt/vls/.
Marc Ariberti and Christophe Massiot developed a new VLAN Server, called
<tt>mini VLAN Server</tt>. The idea was to use a PostgreSQL database
instead of the "hand-made" database of the VLAN Server. The mini VLAN
Server is written in PHP (for the heart and all the requests to the SQL
database) and C (for the reception of the requests from the VideoLAN
Clients). It is more reliable, it never segfault, but it needs a decent
machine (we used a 300Mhz Pentium with 128Mo de RAM for a network
of 1000 machines). The mini VLAN Server cannot be used with the old
VLANbridge.
Eventually, if your network doesn't support multicast, we advise you
to use the <tt>mini VLAN Server</tt>. And if you router cannot make
the VLANs communicate with filtering functions (in order to stop the
streams broadcasted to go from a VLAN to another), we advise you to use
<tt>vlb-linux</tt>.
<sect2>Installation and configuration of the VLAN solution
<p>
<sect3>mini VLAN Server
<p>
The installation of the <tt>mini VLAN Server</tt> is not explained
here because it is quite complex and we think that most of you have a
network with multicast support. You can download it from the <htmlurl
url="http://www.videolan.org/network/download.html" name="Network
download page">. The "tarball" contains an "INSTALL" file with
instructions in French. If you want to use the mini VLAN Server and
don't understand French, you can ask for help in the mailing-list
<tt>vlcs@videolan.org</tt>.
<sect3>vlb-linux
<p>
You can download this version of the VLANbridge from the <htmlurl
url="http://www.videolan.org/network/download.html" name="Network
download page">. The "tarball" contains an file "vlanbridge-help" with
detailled explainations in English of the idea behind the VLANbridge
and, at the end, the instructions to install and configure this version
of the VLANbridge.
<sect2><tt/vlc/ configuration
<p>
The simplest solution is to use the interface of vlc : click on "Net",
select "Channel server", write its IP address or DNS name.
Then, you see a new section "Network Channel" on the interface.
Select the desired channel and click on <tt>Go!</tt>.
<sect>Video On Demand<label id="vod">
<p>
<sect1>Overview
<p>
<sect2>What is Video On Demand ?
<p>
With Video On Demand (VOD), the client can start the video when he
wants, make pauses, go forward and go back in the video. It's of course
the best of video streaming and the dream for every client.
<sect2>Hardware required
<p>
But VOD is a very big consumer of resources for the server and the
network. VOD is unicast, not multicast. This mean that if 50 clients are
doing VOD with the same server, watching a 5 Mbit/s MPEG 2 video, the
resources needed as a minimum are the following :
<itemize>
<item>for the VOD server : 5*50=250 Mbit/s disk access and a 250 Mbit/s
connection to the backbone,
<item>for the Backbone : 250 Mbit/s bandwidth,
<item>for the client : 5 Mbit/s connection to the backbone.
</itemize>
You can see that VOD needs huge resources for the server in term of disk
access and network connection, and for the backbone.
<sect2>Design of the VOD solution
<p>
The design is very simple. The idea is to do HTTP streaming, i.e. stream
an MPEG video encapsulated in HTTP. The regulation of the bitrate
between the client and the server is done automatically by TCP. With
HTTP version 1.1, there is the possibility to seek in a file downloaded,
that we use to seek in the video.
On the VOD server, you need to install a Web server. For example, we use
a Linux server running Apache as HTTP daemon. But other O.S. and other
Web server should work too, but we have never tested. Make your MPEG 1
or 2 files available to the clients on the Web server.
On the client, you only need <tt/vlc/ installed.
<sect1>VOD with VideoLAN
<p>
<sect2>On the server
<p>
For example, we have a Web server whose DNS name is
<tt>vod.videolan.org</tt>. On this server, there are two MPEG
files <tt/video1.mpg/ and <tt/video2.mpg/ available to the clients at
the adresses <tt>http://vod.videolan.org/test/video1.mpg</tt> and
<tt>http://vod.videolan.org/test/video2.mpg</tt>.
<sect2>On the client
<p>
On the client, run <tt/vlc/ with this command line to view the first video :
<tscreen><verb>
% vlc http://vod.videolan.org/test/video1.mpg
</verb></tscreen>
and this command line to view the second video :
<tscreen><verb>
% vlc http://vod.videolan.org/test/video2.mpg
</verb></tscreen>
You can also use the interface : click on "Net" and select
HTTP and enter the URL "vod.videolan.org/test/video1.mpg" or
"vod.videolan.org/test/video2.mpg".
<sect2>Client launched by a Web browser
<p>
The idea is to have a Web page with the list of the videos available,
and, when you clic on a video, <tt/vlc/ starts to display it.
You have to write the Web page with regular hypertext links to the
video files and configure you Web browser to launch <tt/vlc/ when a
file with ".mpg" (and ".mpeg" and ".vob") extension is selected. Tell
the client that <tt/vlc/ accepts the URL as a command line : with this
configuration, the file will not be stored on the client's hard drive
but will be directly read by <tt/vlc/.
<sect2>Using a channel tool for VOD
<p>
You can use <tt/miniVLCS/ and enable the clients to select channel
1 to view the first video, channel 2 to view the second video, and so on.
Install <tt/miniVLCS/ on a Linux machine (it can be the same machine as the
VOD server). Please, refer to the section describing <ref id="mini-vlcs"
name="the building of miniVLCS">.
In the following example, the configuration file <tt>vlcs.conf</tt> should look
like that :
<tscreen><verb>
I: nostream
http://vod.videolan.org/test/video1.mpg
http://vod.videolan.org/test/video2.mpg
</verb></tscreen>
Then run <tt/miniVLCS/ as a normal user :
<tscreen><verb>
% ./vlcs
</verb></tscreen>
The simplest solution is to use the interface of vlc : click on "Net",
select "Channel server", write its IP address or DNS name.
Then, you see a new section "Network Channel" on the interface.
Select "1" and click on "Go!" to view the first video. Select "2" and
click on "Go!" to view the second video.
This function is broken in release 0.4.0 of <tt/vlc/.
<sect>Designing a complete VideoLAN solution
<p>
This section talks about how to organise the servers needed for VideoLAN
in order to stream on a Local Area Network (LAN), or a Wide Area Network
(WAN). These are not precise technical procedures but suggestions taken
from our own experience.
<sect1>The VideoLAN Servers
<p>
You can have as many VideoLAN Servers (<tt/vls/) on your network as you
want. <tt/vlms/ should only be used for testing purposes. You may want to
specialise your VideoLAN Servers. For example, on our campus, we have
three VideoLAN servers located in three different places :
<itemize>
<item>one for MPEG encoding with an MPEG encoding card located in the
video studio of the campus in charge of streaming the live shows,
<item>one for Satellite streaming with a satellite card located in a
technical room near the satellite parabola,
<item>one for video streaming with a lot of disk space located in
another technical room where there is a fast network connection.
</itemize>
If you want to stream multiple DVDs (we suppose that you have the legal
right to do so) from the same machine, you may want to have big disk
drives instead of multiple DVD drives. You can copy the DVDs on the
hard drives and tell <tt/vls/ to read from the hard drive instead of the DVD
drive.
If you want to stream satellite channels (we again suppose that you
have the legal right to do so), you need a satellite card for every
transponder. On one transponder, you have up to around 10 channels. If
you want to stream 5 channels that are on 3 different transponders, you
will need 3 satellite cards inside the machine. We don't care if those
3 transponders are on 3 different satellites, that's your problem ! A
satellite stream is around 4 Mbit/s. You will then stream 5 x 4 = 20
Mbit/s : a 100 Mbit/s Ethernet connection will be needed. If you have
want to stream channels from more transponders that PCI slot available
in the machine... you will need to find a second computer !
If you want to do Video On Demand with a lot of potential clients, you
may want to set up a server specialized for VOD. This server would have
very fast disk access and be located in a technical room with a fast
network connection available. For example, you could set up a SAN with
disk drives connected in fibre channel and multiple 100 Mbit/s Ethernet
connections or a Gigabit connection to the network.
<sect1>The VideoLAN Channel Servers
<p>
<sect2>Multicast solution
<p>
If your network supports multicast, you will have to install a
<tt>miniVLCS</tt> in order to enable the clients to easily go from a
channel to another. This program doesn't need much resources in term of
computer power or network connection. Therefore, you can install it on a
old machine running Linux, or on one of your VideoLAN Servers.
Multicast allows you to stream a video to multiple machines on a Wide
Area Network (WAN). The network hardware of the WAN will need to have a
full multicast support. If it doesn't, you can link multicast islands
from one to another through IP tunnels. This is how the MBone (a
Multicast Backbone on the Internet) works.
<sect2>VLANs solution
<p>
With the VLANs solution, you will only be able to stream on a LAN where
all the switches support VLANs. You will not be able to stream on a WAN.
With this solution, we advise you to have a Linux machine dedicated to
hosting the <tt>mini VLAN server</tt>. This machine is critical in term
of security because it will have in it's configuration files the MIBs of
all the switches of you LAN.
If your router is a bad router (i.e. you can't configure it so as to
let the different VLANs communicate but without letting the streams
broadcasted by <tt/vls/ in a VLAN go to the other VLANs), you may want
to set up a VLANbridge or buy a new router. If you want to set up a
VLANbridge and you have an Ethernet network, you need to have a Linux
machine with as many network cards as VLANs used. This machine will be
located in a place where you have a switch with as many ports available
as VLANs used. You will plug each network card to a port in each VLAN
used, and your VLANbridge will enable the different VLANs to communicate
but without letting the video streams go from a VLAN to another. If you
want to set up a VLANbridge and you have an ATM backbone (like on our
old network), the VLANbridge machine only needs one ATM card connected
to the ATM backbone : this card will enable the VLANbridge to have an
interface in every VLAN.
<sect>Conclusion
<p>
The VideoLAN solution works well now, but the VideoLAN team is always
eager to add new features and adopt new standards. Here are the new
features that we plan to develop and the new standards that we plan to
adopt :
<itemize>
<item>MPEG 4. We have already started to develop the DivX (a variant of
MPEG 4) support of vlc... and we would like to be able to stream MPEG 4
as we do with MPEG 1 and 2.
<item>IPv6. <tt/vlc/ and <tt/vls/ already support IPv6, but we have only tested
unicast IPv6. We would like to test the multicast IPv6.
<item>SAP (Session Announcement Protocol). This protocol will allow the
clients to have the program of what is streamed on the network. We have
already started to study this standard.
<item>RTP and RTSP. Those protocol are certainly the futur of the
network solution of VideoLAN.
<item><tt/vlc/ as a plug-in for Web browsers. The development has already
started.
</itemize>
</article>