Videolan Quickstart 0.3 (w/broadcast/multicast)

Bill Eldridge bill at rfa.org
Thu Jan 31 20:00:11 CET 2002


VideoLan VLC/VLS/VLMS Quickstart, version 0.3      2002/01/31

Bill Eldridge, bill at rfa.org, Radio Free Asia
Copyright GNU GPL, version 2 or later (your option)

0) Disclaimer stuff
1) Configure/compile
2) Getting/building mkpassword
3) Finding a video file you know works
4) Basic vls.cfg
5) Basic input.cfg
6) Test vlms and linux vlc
7) Basic vls/vlc Linux test
8) Basic vlc on Windows test
9) vlc player behavior on Linux & Windows
10) Server gotchas
11) Multiple channels
12) Virtual streaming with ffmpeg
13) Broadcasting
14) Multicasting
15) P.S.

0) Disclaimer stuff

This is the start of a longer videolan Quickstart,
which will be added to as I get more parts
working. I started this because I couldn't get
anything working in VideoLan even though I thought
I had everything configured right.

Currently I have vlms/vlc and vls/vlc working on
vob (MPEG) files, streaming locally on Linux and to
Windows net client, broadcasting to Linux and Windows,
and seeming to multicast to a local Linux client.

I've been unable to get any results out of using
the vlc GUI - all of my vlc data is given while
starting vlc from the command line.

I don't have DVD, so those functions require someone
else's input.

If someone who knows much more about this stuff is eager,
he/she is welcome to steal this and expand it - please
tell me to step aside. Also, I take no responsibility
for any problems whatsoever caused by following my
advice. And yes, this would be better as html with
anchors.

1) Configure/compile

Both the latest stable release and the last
CVS (2002/01/25) of vls/vlc/vlms worked in the end for me.
Run everything as root, at least until you figure it out
and maybe after.  I configured vls with:

./configure --disable-dvd

and vlc with:

./configure --enable-gnome

while vlms doesn't have configure, so I just did "make".

and ran "make", "make install" on them. (you can
do a "make uninstall" and "make clean"  or "make distclean"
as needed)

2) Getting/building mkpassword

You need mkpassword to access vls' administration
area on port 9999. I got mkpassword by downloading
serveez-0.1.2 from ftp://ftp.gnu.org/gnu/serveez/
Trying to compile this failed (didn't have guile),
but I didn't need anything but mkpassword, so
I did a ./configure, cd squeeze-0.1.2/src,
make mkpassword and copied mkpassword to
/usr/local/sbin.  (you can put it anywhere in
your path).  At that point, you just type
"mkpassword" and enter the password you want
to encode.  Cut-and-paste tat that to your vls.cfg

3) Finding a video file you know works

My start is simply to stream a file, "presentation_short.vob",
that I downloaded from ftp://ftp.videolan.org/pub/videolan/streams.

This is important, because I downloaded other mpegs from
the same site ("DTS_Organic.mpeg" and "exotic_animal_sex.mpeg")
that *DIDN'T* work, nor did my own .mpeg files.
Start with something that works.

For broadcasting, I had trouble using presenation_short.vob,
possibly because it wasn't long enough clip to latch onto,
possibly other reasons.

I've also had pretty good luck using ffmpeg,
*EXCEPT* the file seems to need to be 30 seconds or more
for vls to be able to latch onto it. This worked on
unicast, broadcast and multicast.

I started out with a pretty hefty stream:

   ffmpeg -ad /dev/dsp1 /var/www/html/test.vob

where /dev/dsp1 is my BT878 TV card audio input.

Note that this goes to a file, and is not *VIDEO*
input as far as VideoLan is concerned. VideoLan
supports the output of a Kfir chip MPEG-compression
based card, while the BT878 uses V4L raw video input.
[There's a Hauppauge PVR BT878 card with Kfir MPEG
compression that might work as well, but it is not
yet supported by VideoLan, and it still has to make
it out of my drawer into my computer to test :))


4) You can compare my vls.cfg with the distribution vls.cfg to get
a better idea of what the section names mean - I wasted a lot of time
by keeping the wrong (original) name in the Inputs section, instead
of what I'd changed it to.  Note that I always start with IP addresses
instead of names to remove one possible source of errors.
In my case, my Linux server/client is at 172.30.0.1, and my Windows
laptop client is 172.30.0.2 - substitute your correct addresses.

File without original comments:

[WARNING: I've spaced these lines for readability, and spacing
doesn't seem to matter, but I can' guarantee they don't need
to be at the beginning of the line]

#----------------------------------------------------------------------------
  BEGIN "Vls"
  LogFile       = "/tmp/vls.log"                # log file
  END

  BEGIN "Groups"
  monitor      = "help|browse|logout"
  master       = "help|browse|start|resume|suspend|stop|shutdown|logout"
  END

  BEGIN "Users"
  bill         = "biC4vi88iMezU:master"   # password 'bozo' using
mkpassword
  dummy        = "idthWSwmfr8vQ:master"   # password 'idiot' using
mkpassword
  END

  BEGIN "Telnet"
  LocalPort    = "9999"            # where you'll start programs &
shutdown
  END

  BEGIN "NativeAdmin"
  LocalPort     = "9998"           # Future functions
  END

  BEGIN "Inputs"
  myfiles = "local"                # One branch of file inputs (content)
  END

  BEGIN "myfiles"
  ConfigPath = "/var/www/html"     # Points to directory for input.cfg
  END

  BEGIN "Channels"
  mychannel     = "network"        # One IP path (transport)
  END

  BEGIN "mychannel"                # type == "network"
  SrcHost       = "172.30.0.1" # Or name, but not "localhost" nor
"127.0.0.1"
  SrcPort       = "4321"
  DstHost       = "172.30.0.1" # Or name, but not "localhost" nor
"127.0.0.1"
  DstPort       = "1234"
  END


5) My /var/www/html/input.cfg looks like:

#----------------------------------------------------------------
  BEGIN "Input"
    FilesPath             = "/var/www/html"    # Can be somewhere else
    PgrmCount             = "3"
  END

  BEGIN "1"
    Name                  = "test"
    FileName              = "test.vob"
    Type                  = "Mpeg1-PS"
  END

  BEGIN "2"
    Name                  = "myprogram"
    FileName              = "presentation_short.vob"
    Type                  = "Mpeg2-PS"
  END

  BEGIN "3"
    Name                  = "exotica"
    FileName              = "exotic_animal_sex.mpeg"
    Type                  = "Mpeg2-PS"
  END

but I already said that number 3 didn't work (tried Mpeg1-PS and
MPeg2-TS and still didn't work), so you can just change PgrmCount
to "2" and omit the 3rd example.

6) Basic vlms/vlc test (local Linux client)

First, test with vlms - start your Linux client with:

  vlc --noaudio udpstream:0 at 172.30.0.1:1234

and then your one-shot server:

  vlms -d 172.30.0.1:1234 -a off /mpegs/bill/presentation_short.vob

Your client should autmagically pop up a not-so-terribly
interesting video, but at least it's video.

7) When you go to start programs in vls, you'll be specifying 3 things:
  a) the actual file or media entry
  b) where the file/media lies in your content (directory/tree/filelist)
     structure, and
  c) what networking transport (UDP, multicast, carrier pigeon) it uses.

Make sure you're *NOT* in the vls source directory, or it
will use vls.cfg there instead of /usr/local/etc/videolan/vls/vls.cfg

Without further ado, the following should work:

    vlc --noaudio udpstream:0 at 172.30.0.1:1234
    vls &
    telnet localhost 9999
    login: bill
    password: bozo

    browse  [not really needed - do "help" for other commands]

    start myprogram mychannel myfiles --loop

8) Testing across net with Windows

Very similar, but in your vls.cfg, DstHost will
be the address of your Windows machine:

  BEGIN "mychannel"       # type == "network"
  SrcHost       = "172.30.0.1"
  SrcPort       = "4321"
  DstHost       = "172.30.0.2" # Or name of my Windows machine
  DstPort       = "1234"
  END


Start the server *FIRST*:

    vls &
    telnet localhost 9999
    login: bill
    password: bozo
    start myprogram mychannel myfiles --loop

    vlc --noaudio udpstream:0 at 172.30.0.2:1234

Note that your vlc client is pointing to the address
of the machine it's running on, not the server.
Also, see player and server notes below.


9) vlc Player behavior

When you start vlc on Linux as noted above, it will
give y ou a menu bar and a note saying "udpstream:0".
This means that the client is *ALREADY* listening.
When you start the server file with "start myprogram...",
a new client window should automatically pop up and
display the incoming program.

*HOWEVER*, on Windows, it seems that if the client
tries to connect before the server is running,
you get an "illegal operation" error that aborts
the program. Needless to say, start the server
first and make sure to start the client before
the program ends, or use the --loop option on the
server. (see Server Gotchas)

While my server was sending 160x128, the Windows
client defaulted to 720x576, and when I tried
to override this with either the preferences
or command-line options ("--width" & "--height")
the screen stayed black. At 720x576, a 160x128
movie looks pretty awful, but there's probably
a reasonable workaround I haven't figured out.

10) Server Gotchas

You can also use the --loop option on starting a program,
though vls sometimes can't return to the beginning of the
loop correctly and aborts the broadcast.

You can also use the up arrow and return to repeat
the last command, though it's hard to tell that because
vls shows an error message when you hit the up arrow.
Ignore it and hit return.

11) Multiple channels

Pretty similar, just add another channel in vls.cfg
Here I reuse the SrcPort, and only add a second
DstPort.

  BEGIN "Channels"
  mychannel     = "network"           # One IP path (transport)
  channel2     = "network"           # One IP path (transport)
  END

  BEGIN "mychannel"       # type == "network"
  SrcHost       = "172.30.0.1" # Or name - not "localhost" nor
"127.0.0.1"
  SrcPort       = "4321"
  DstHost       = "172.30.0.1" # Or name - not "localhost" nor
"127.0.0.1"
  DstPort       = "1234"
  END

  BEGIN "channel2"       # type == "network"
  SrcHost       = "172.30.0.1" # Or name - not "localhost" nor
"127.0.0.1"
  SrcPort       = "4321"
  DstHost       = "172.30.0.1" # Or name - not "localhost" nor
"127.0.0.1"
  DstPort       = "1235"
  END

These programs are easily started -

    start test mychannel myfiles
    start myprogram channel2 myfiles

and I can point my client at 172.30.0.1:1234 or 172.30.0.1:1235
(or start up 2 clients and watch both).

I can even play the same program on 2 channels:

    start test mychannel myfiles
    start test channel2 myfiles

Unfortunately, stopping a program uses only the
program name and the input name, so:

    stop myfiles test

would stop both channels. You can fix this with:

  BEGIN "Inputs"
  myfiles = "local"               # One branch of file inputs (content)
  files2 = "local"                # Another branch of file inputs
(content)
  END

  BEGIN "myfiles"
  ConfigPath = "/var/www/html"    # Points to directory for input.cfg
  END

  BEGIN "files2"
  ConfigPath = "/var/www/html"    # Same input.cfg as "myfiles",
  END                             # therefore same programs

and then do:

    start test mychannel myfiles
    start test channel2 myfiles
    stop myfiles test
    stop files2 test

There may be a better way of doing this, or it may
be waiting for the VideoLan folks to get the native
administrator on port 9998 working - stay tuned.

12) Virtual Streaming with ffmpeg

The test.vob file mentioned above does not have to be
finished. Using a generic BT878 video card, I can
write to my test.vob file with:

    ffmpeg -ad /dev/dsp1 /var/www/html/test.vob

and if I start the program 30 seconds later with:

    start test mychannel myfiles

vls will continue to stream out the file as it comes in.
(note the 30 seconds may change with different video
parameters - this has not been checked).

I also tested this using the newer V4L2 with kernel
2.4.18-pre7 and bttv-0.8.33 so I could get shared
access to the device, which allows me to use xawtv's
v4lctl to change channels & volume and such. On first
use, the videolan doesn't seem to track as well as with
V4L, but this might just require reconfiguring ffmpeg
or something similar. However, channel switching, et al.,
does work.

Two problems with this technique.  One, it's not really
"streaming" since you need both a 30 second buffer, and
you can't do strem backups. Two, if your vls crashes and
you restart, you're starting at the beginning of a program,
and not at the end.

It shouldn't take too much effort to modify vls to allow
starting from a point just before the end of a file and
proceeding from there (just requires an fseek(-X bytes, 2 for EOF))
but that's just a guess.

13) Broadcasting

Broadcasting *can* work with both Linux & Windows (0.2.92 precompiled
.exe), but it seems trickier than unicast.

My attempt with vlms failed, both for the local Linux client
and the networked Windows client:

  vlms -d 172.30.0.1:1235 -a off
/var/www/html/bill/presentation_short.vob
  vlc udpstream:172.30.0.1:0 at 172.30.0.255:1235

However, broadcast worked using the vls server:

  BEGIN "channel2"       # type == "network"
  SrcHost       = "172.30.0.1"
  SrcPort       = "4321"
  DstHost       = "172.30.0.255"
  DstPort       = "1235"
  END

and on the client end:

    vlc udpstream:172.30.0.1:0 at 172.30.0.255:1235

or more simply:

    vlc udpstream:@172.30.0.255:1235

This worked with my ffmpeg .vob file for both Linux
and Windows network client, but the presentation_short.vob
file only worked with the local Linux vlc.

Windows problems possibly has something to do with frame size and
network performance, as the ffmpeg .vob file would not
play on Windows at 720x576, but would at 320x256 and 160x128.
(though I always had to leave the Windows window set at
720x576, meaning the stretched image didn't look very
good). Efforts to change the Windows client window size,
both on command line and in the GUI preferences, failed.

14) Multicasting

Multicasting worked similarly to broadcasting
for the Linux client, but the Windows client
didn't seem to support it.  Oddly, vlms worked
fine with multicast, even though I couldn't
get it to work with broadcast.

First, you need a route to the multicast address
range:

    route add -net 224.0.0.0 netmask 240.0.0.0 dev eth0

I also have various multicast options in my kernel,
including multicasting, advanced router, ip tunneling
and multicast routing, though I think you only need
multicasting option at this point.

To test multicast from vlms, I did:

    vlms -d 224.1.0.1:1235 -a off
/var/www/html/bill/presentation_short.vob
    vlc udpstream:172.30.0.1:0 at 224.1.0.1:1235

or better, just:

    vlc udpstream:@224.1.0.1:1235

To make vls a multicast server, I edited vls.cfg
to contain:

  BEGIN "channel2"       # type == "network"
  SrcHost       = "172.30.0.1"
  SrcPort       = "4321"
  DstHost       = "224.1.0.1"
  DstPort       = "1235"
  END

[The routing and tunneling functions in the kernel
are needed to make this a Linux multicast router, not for
single machine multicast access.  Additionally, I will
need to issue the command:

    echo 1 > /proc/sys/net/ipv4/ip_forward

to route other machines' packets - multicast or otherwise.]


15) P.S.

Yep, that's it, so far. If you have good examples to extend this
functionality, please send it my way, bill at rfa.org.  Also tell me
if I screwed up somewhere - this is supposed to take the pain out
of getting something basic working.


-- 
Bill Eldridge
Radio Free Asia
bill at rfa.org

-- 
This is the vlc mailing-list, see http://www.videolan.org/vlc/
To unsubscribe, please read http://www.videolan.org/lists.html



More information about the vlc mailing list