The VideoLAN Server reads its configuration from vls.cfg
, which is
supposed to be located in the current directory or in
SYSCONF_DIR/videolan/vls
(where SYSCONF_DIR is /usr/local/etc
if you built and installed vls by hand, or is /etc
if you installed
the debian binary package).
Be careful: the syntax of the configuration files changed between version 0.3.1 and 0.3.2 !
To write a vls.cfg
, just copy/paste the example vls.cfg
supplied
with vls ;-)
If it is not enough for you, here are the full details:
The VideoLAN Server configuration file vls.cfg
is divided into sections,
and each section may contain several variables:
BEGIN "FirstSection"
Variable1 = "value1"
Variable2 = "value2"
[...]
END
BEGIN "SecondSection"
Variable1 = "value1"
Variable3 = "value3"
[...]
END
[...]
All section names, variable names and values are not case-sensitive.
There can be empty sections and subsections. Comments must follow a #
character. Some variables have a default value; it means that you can ommit
to declare these variables, and then they will be given their default value.
vls.cfg
Here is an explanation of all the sections you can find in a vls.cfg
:
This section contains application wide settings.
LogFile = "name"
Name of vls log file. If left empty "", then no loggin to files is done. Default is "vls.log"
SystemLog = "[disable|enable]"
Logging to the SystemLog. Today, only the SystemLog using syslogd is
implemented : compile with ./configure --enable-syslog. If VideoLAN Server is started as vlsd,
then the following configuration is mandatory:
BEGIN "Vls"
LogFile = ""
SystemLog = "enabled" # only logging to syslogd when running in daemon mode!
ScreenLog = "disabled"
END
ScreenLog = "[disable|enable]"
Logging to the console.
Example:
BEGIN "Vls"
LogFile = "vls.log"
SystemLog = "disable"
ScreenLog = "enable"
END
In this section, you can define some groups of users, and which commands these users are allowed to execute. For each group you want to define, you must add a line in the following format:
groupname = "command1|command2|..."
This adds a group "groupname", the users of which are allowed to execute
command1, command2, and so on. At the moment, the available commands are:
help, browse, start, suspend, resume, stop, shutdown, logout.
Example:
BEGIN "Groups"
monitor = "help|browse|logout"
master = "help|browse|start|resume|suspend|stop|shutdown|logout"
END
This section contains a list of users allowed to control vls through an administration interface. For each user, add a line in the following format:
username = "password:groupname"
This adds a user "username", who belongs to the group "groupname" (defined
in the "Groups" section) and can log in with the password "password".
BE CAREFUL: the password must be encrypted, with a tool such as
mkpasswd
, or with the UNIX function "crypt".
Example:
BEGIN "Users"
monitor = "3BcKWoiQn0vi6:monitor" # password is 'monitor'
admin = "42BKiCguFAL/c:master" # password is 'Vir4Gv5S'
END
In this section, you can configure the telnet administration interface.
LocalPort = "port"
Defines which port will be used for the telnet server. Default port is
"9999".
Domain = "domain"
Either "inet4" or "inet6" (default is "inet4"). If you want to use IPv4
addresses, put "inet4", and if you want to use IPv6, put "inet6".
LocalAddress = "IP address"
Defines on which IP address the telnet server will listen for requests.
Default address is "0.0.0.0" (or "0::0" with IPv6)
Example:
BEGIN "Telnet"
LocalPort = "9999"
END
Same syntax as "Telnet". Not used yet.
In this section, you can define which inputs you want to use. For each input you need, add a line in the following format:
InputName = "Type"
This adds a input named "InputName", the type of which is "Type". As
explained before, there are currently two types of input: "local",
"video" and "dvb". You must use the "local" input to play a stream
from a file or a DVD, the "video" input to play a stream from a
Video4Linux device, and the "dvb" input to play a stream from a DVB
receiver like Win-TV Nova. Each input must be configured in its
own section (see next paragraph).
Example:
BEGIN "Inputs"
local1 = "local"
kfir = "video"
END
For each input declared in the "Inputs" section, excepted "local" inputs", you must add a section with the same name as the corresponding input. For instance, if you declared an input "kfir", there should be one section named "kfir" too. The syntax of such sections depends on the type of the corresponding input.
To configure a local input, you don't have to do anything:
To configure a video input, add a section in the following format:
BEGIN "VideoInputName"
Device = "device"
Type = "type"
END
"VideoInputName" is the name of the video input you want to configure.
"device" is the path of the Video4Linux you want to read from (default
is "/dev/video"). "type" is either "Mpeg2-PS" or "Mpeg2-TS", depending
on your device configuration (default is "Mpeg2-PS").
To configure a dvb input, add a section in the following format:
BEGIN "DvbInputName"
DeviceNumber = "devicenumber"
SendMethod = 0
END
"DvbInputName" is the name of the dvb input you want to configure.
Set "SendMethod" to 0 if you to stream the complete DVB stream and set
it to 1 if you only want to stream the MPEG audio and video streams
(default is 0).
"devicenumber" is the number of the DVB device you want to read from
(read from /dev/ost/dvr<devicenumber>, default is "").
The dvb configuration file is defined by the driver. You can find it in
$HOME/.dvbrc for /dev/dvb/adapter0 or in $HOME/.dvbrc.x for
/dev/dvb/adapterx.
Example:
BEGIN "kfir"
Device = "/dev/video"
Type = "Mpeg2-PS"
END
BEGIN "dvb"
DeviceNumber = "0"
END
In this section, you can define the channels (outputs) you want to use. For each channel you need, add a line in the following format:
ChannelName = "Type"
This adds a channel named "ChannelName", the type of which is "Type".
"Type" must be either "network" or "file". Like inputs, channels must be
configured in their own section.
Example:
BEGIN "Channels"
localhost = "network"
client1 = "network"
client2 = "network"
multicast = "network"
localfile = "file"
END
For each channel declared in the "Channels" section, you must add a section with the same name as the corresponding channel. The syntax of such a section depends on the type of the corresponding channel.
To configure a network channel, add a section in the following format:
BEGIN "NetChannelName"
SrcHost = "SourceHost"
SrcPort = "SourcePort"
DstHost = "DestHost"
DstPort = "DestPort"
Type = "Type"
TTL = "ttl"
Domain = "Domain"
Interface = "Interface"
END
"NetChannelName" is the name of the network channel you want to configure.
"SourceHost" is the IP address (or DNS name) from which vls will send
the stream. "SourcePort" is the UDP port from which the stream will be sent.
"SrcHost" and "SrcPort" are optional (if you don't set them, vls will not
'bind' the socket).
"DestHost" is the IP address (or DNS name) to which the stream will be sent.
"DestPort" is the UDP port to which the stream will be sent (default is
"1234").
"Type" is either "unicast", "broadcast" or "multicast" (default is
"unicast"), depending on what you want to do (and on your "DstHost" address).
"TTL" is an option useful only if "Type" is "multicast" (default value is
"0"). You can use it to increase the TTL of your multicast packets if they
have to cross several routers.
"Domain" is either "inet4" if you use IPv4 addresses, or "inet6" if you use
IPv6 (default is "inet4").
"Interface" is an option only supported under linux, to force the stream to
be broadcasted through a given network interface, "eth1" for instance" (to
use this option, you must have super-user permissions).
To configure a file channel, add a section in the following format:
BEGIN "FileChannelName"
FileName = "file"
Append = "append"
END
"FileChannelName" is the name of the file channel you want to configure.
"file" is the name of the file where the stream will be stored (default
is "fileout.ts"). "append" is either "yes" or "no", and indicates whether
vls will append the stream at the end of the file, or rewrite it.
Example:
BEGIN "localhost" # The client is on the same host as the server
DstHost = "localhost"
DstPort = "1234"
END
BEGIN "client1" # unicast towards client1
DstHost = "192.168.1.2"
DstPort = "1234"
END
BEGIN "client2" # unicast towards client2 with IPv6
Domain = "inet6"
DstHost = "3ffe:ffff::2:12:42"
DstPort = "1234"
END
BEGIN "multicast" # multicast streaming
DstHost = "239.2.12.42"
DstPort = "1234"
Type = "multicast"
END
BEGIN "localfile" # file output
FileName = "stream.ts"
Append = "no"
END
As explained before, you must define the programs. Each one is a MPEG stream ( a file, for example). To do this, you must add an "Input" section in your vls.cfg
file
Each "Input" section must have the following synta
BEGIN "Input"
FilesPath = "path"
ProgramCount = "count"
END
"path" is the path where your MPEG files are located (by default it is the
current directory). "count" is the number of programs defined in input.cfg
(0 by default).
For each program you want to define, you must add a section with the following format:
BEGIN "number"
Name = "name"
Type = "type"
FileName = "file"
Device = "device"
END
"number" is the program number: the first program has number 1, the second
number 2, and so on. "name" is the program name, by which you will tell vls
to start this program (see next chapter "Running vls"). "type" can be
"Mpeg1-PS", "Mpeg2-PS", "Mpeg2-TS", or "Dvd". If your stream
is stored in a MPEG file (*.mpeg, *.mpg, *.vob, and so on...), it is
probably in Mpeg1-PS or Mpeg2-PS format. If Type is set to "Mpeg1-PS",
"Mpeg1-TS", "Mpeg2-PS", or "Mpeg2-TS", vls will assume your stream is
stored in the file "file", in the directory "path" ("path" being the
variable defined in the "Input" section). If "type" is "Dvd", the variable
Device will be used instead of FileName (the variable "FilesPath" is not
prepended to the device name !). Note that you cannot play "Dvd"
programs unless you compiled vls with dvd support, which uses libdvdread.
With libdvdread, you can play a "real" Dvd (then "device" is the device
of your DVD drive, "/dev/hdc" or "/dev/cdrom", for instance; note that
libdvdread needs read AND write access rights to the device), but you can
also play a Dvd stored on a hard disk (then "device" is the directory
where the .vob files are stored: "/mnt/data/VIDEO_TS", for instance).
The libdvdread now supports encrypted Dvds, even stored on a hard disk.
Full example:
BEGIN "Input"
FilesPath = "/home/videolan/streams"
ProgramCount = "4"
END
BEGIN "1" # MPEG2 stream stored in /home/videolan/streams/Dolby.vob
Name = "dolby"
FileName = "Dolby.vob"
Type = "Mpeg2-PS"
END
BEGIN "2" # another file
Name = "canyon"
FileName = "Dolby_Canyon.vob"
Type = "Mpeg2-PS"
END
BEGIN "3" # Dvd
Name = "dvd"
Device = "/dev/cdrom"
Type = "Dvd"
END
BEGIN "4" # Dvd stored on a hard disk
Name = "matrix"
Device = "/mnt/data/matrix/VIDEO_TS"
Type = "Dvd"
END