In this section, we assume that :
vlc
) is installed on all
the client machines. Please, refer to the
VideoLAN Quickstart or the
VideoLAN Client HOWTO for the installation instructions.
vls
) or a VideoLAN mini-Server
(vlms
) is installed on a machine. Please, refer to the
VideoLAN Quickstart or the
VideoLAN Server user guide.
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 Video on Demand.
No special feature or configuration of your network hardware is required.
The only problem is the bandwidth. As explained in the 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).
You can either use vlms
or vls
to do unicast.
vlms
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 : ftp://ftp.videolan.org/pub/videolan/streams/presentation/presentation_short.vob.
In the example below, the IP address of the client machine is
10.0.0.2
. The name of the MPEG file is called
MPEG_file_name
.
Run vlms
:
% vlms -d 10.0.0.2 MPEG_file_name
If you want the server to stream the file continuously, you can use the
-l
option :
% vlms -d 10.0.0.2 -l MPEG_file_name
or if you want to send it 3 times use the option -n 3
:
% vlms -d 10.0.0.2 -n 3 MPEG_file_name
vls
Modify the configuration file vls.cfg
by adding the following :
BEGIN "Channels"
net1 = "network"
END
BEGIN "net1"
Domain = "Inet4"
Type = "unicast"
DstHost = "10.0.0.2"
DstPort = "1234"
END
Then, restart vls
and start to stream a video to "net1".
On the client, run vlc
with this command line :
% vlc udp:
You can also use the interface :
% vlc
and then click on "Net" and select "UDP".
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 only if your network hardware doesn't support multicast (see next subsection).
No special feature or configuration of your network hardware is required. It only needs to have the necessary bandwidth, as for unicast.
You can either use vlms
or vls
to do broadcast.
vlms
In the example below, the broadcast IP address of the subnet is
10.0.0.255
. The name of the MPEG file is called
MPEG_file_name
.
Run vlms
:
% vlms -d 10.0.0.255 MPEG_file_name
If you want the server to stream the file continuously, do :
% vlms -l -d 10.0.0.255 MPEG_file_name
vls
Modify the configuration file vls.cfg
by adding the following :
BEGIN "Channels"
net1 = "network"
END
BEGIN "net1"
Domain = "Inet4"
Type = "broadcast"
DstHost = "10.0.0.255"
DstPort = "1234"
END
Then, restart vls
and start to stream a video to "net1".
On the client, run vlc
with this command line :
% vlc udp:
You can also use the interface :
% vlc
and then click on "Net" and select "UDP".
When you use unicast or broadcast, you can encounter the following problems :
LAN
, 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.
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 : 224.0.0.0 -> 239.255.255.255
.
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 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 :
vls
sends a stream to the multicast IP address 239.255.12.42. Client
n╟1 and n╟2 already joined the multicast group and receive the stream.
Server (vls) Network Clients (vlc)
stream --------------> 239.255.12.42 ----------> client n╟1
|
--------> client n╟2
Server (vls) Network Clients (vlc)
<-------------- client n╟3
join 239.255.12.42
Server (vls) Network Clients (vlc)
--------> client n╟1
|
stream --------------> 239.255.12.42-----------> client n╟2
|
--------> client n╟3
Server (vls) Network Clients (vlc)
<-------------- client n╟1
leave 239.255.12.42
Server (vls) Network Clients (vlc)
stream --------------> 239.255.12.42 ----------> client n╟2
|
--------> client n╟3
Be careful ! 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.
You can either use vlms
or vls
to do multicast.
vlms
Put the multicast IP address as the destination address :
% vlms -d 239.255.12.42 MPEG_file_name
Increase the TTL
(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 -t
option :
% vlms -d 239.255.12.42 -t 12 MPEG_file_name
vls
In the configuration file vls.cfg
, put the multicast IP
address in the DstHost
field and "multicast
" in the
Type
field.
Do not forget to increase the TTL
(Time To Live) if you want
your multicasted stream to go through several routers.
BEGIN "Channels"
net1 = "network"
END
BEGIN "net1"
Domain = "Inet4"
Type = "multicast"
TTL = "1"
DstHost = "239.255.12.42"
DstPort = "1234"
END
Then, restart vls
and start to stream a video to "net1".
On the client, run vlc
with this command line :
% vlc udp:@239.255.12.42
You can also use the interface :
% vlc
and then click on "Net" and select "UDP Multicast" and write the
multicast IP address "239.255.12.42".
You should already have IPv6 configured on the client and server machines and on your network. For more information see the 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.
IPv6
is NOT supported by vlms
. You must use
vls
.
In the configuration file vls.cfg
, you have to change the
destination IP address to an IPv6
address, and tell the system
that you want to stream using IPv6
. Here is sample partial
vls.cfg
:
BEGIN "Channels"
net1 = "network"
END
BEGIN "net1"
Domain = "Inet6"
DstPort = "1234"
DstHost = "3ffe::12"
END
In this example :
3ffe::12
is the IPv6 address of the client,Inet6
tells vls
to use IPv6.Then, restart vls
and start to stream a video to "net1".
On the client, run vlc
with this command line :
% vlc udp6:
or
% vlc --ipv6 udp:
If you want to specify the port on the command line of vlc
, for
example port 4321 :
% vlc udp6:@:4321
Закладки на сайте Проследить за страницей |
Created 1996-2024 by Maxim Chirkov Добавить, Поддержать, Вебмастеру |