Overview


From VLC Site - VLC (initially VideoLAN Client) is a highly portable multimedia player for various audio and video formats (MPEG-1, MPEG-2, MPEG-4, DivX, mp3, ogg, ...) as well as DVDs, VCDs, and various streaming protocols. It can also be used as a server to stream in unicast or multicast in IPv4 or IPv6 on a high-bandwidth network
Tangient LLC.
http://www.videolan.org/vlc/


Server configuration


VideoLan (which will be used as a streaming server), can be installed on Windows, Mac and Linux/Unix. Note that you'll need at least version 0.8.5 and ideally version 0.8.6 for full support. New releases (0.9.8 and higher) has a bug if you use NTCS video output option. It is not problem of VLC it self, but ffmpeg ( encoder and decoder and set of codecs used by vlc ) where parameter fps (frame per second) no longer support value of 29.967.
Development team TODO: Require review of the source code of mvpmc to fix this issue or communicate with ffmpeg team to find out root issue with fps parameter. Don't use version 0.9.8 as it uses newest ffmpeg which does not support fps=29.967. Alternatively if you familiar with compilation of source codes, modify vlc_control.c file at string 629 to use fps="25.0000" instead and compile source.

Linux/Unix


Fedora

There are a number of key repos that are best to use which include vlc.

Ubuntu

As of Ubuntu 6.10 Edgy (possibly earlier), the version of VLC included in the default repositories is suitable for streaming to mvpmc. Simply install using apt-get / Synaptic.
To use it with Ubuntu 9.10 you need recompile modified code see "Server Configuration"

Debian

Debian unstable tracks the latest VLC release.

FreeBSD

FreeBSD has the latest releases of VLC in the ports tree.

Windows

Download and install the latest stable release from the VideoLan website.

General


Mvpmc can only play MPEG-1 and MPEG-2 video natively (as it uses dedicated hardware for this, and it doesn't have the CPU power needed to play other formats). In order to allow mvpmc to play other formats (such as MPEG-4), VLC is used as a server to transcode the video to MPEG-2 and then stream it to the mvpmc over the network.

The server-side configuration of vlc requires enabling the telnet interface on the default
vlc listening port of 4212. This can be done via the vlc GUI or on the command line as follows

vlc.exe -I dummy --dummy-quiet --extraintf oldtelnet --control=oldtelnet
(Because of a bug in the windows implementation of the telnet interface in VLC you have to kick off VLC making telnet an extra interface and not the primary.)

VLC will now listen over a telnet interface for requests from the mvpmc, and will stream the requested video/audio back to the mvpmc over HTTP on port 5212. You can test that it is listening You can test that it is listening by trying to telnet in. If you get prompted for a password its good. If you don't a chance to enter a password you've got something wrong somewhere and it won't work.

The following additional commandline parameters can be added for debugging purposes (see the VLC help for more info):
- to turn on logging --file-logging
- to control log verbosity, --verbose (0,1,2)
- to log to a file as well as stdout --logfile filename

Managing VLC "Server" with init.d


On a Linux distro, it can be handy to manage the aforementioned vlc transcoding service through init.d. This is helpful so that the command line options for vlc can be encapsulated, and to automatically startup vlc "server" when the os boots. The following has been tested on an Ubuntu 6.10 Edgy install. It can likely be modified for other distros.

The two scripts shown inline below can be downloaded directly. The inline code is a nice reference, but do to issues with ( possibly user error ) the wiki, I had trouble keeping the start-stop-daemon commands accurate in the code block. Here are the scripts, followed by the description.

The first component is the shell script that encapsulates the vlc calls. Here is my initial effort.

note: Due to issues with ( possibly user error ) the wiki, I had trouble keeping the start-stop-daemon commands accurate in the code block. The line breaks of the commands are not correct. The wiki did not want to preserve the backslash. Also, if the commands are placed on one line ( without breaks ), they blow out the formatted width of this page. Below is a nice "reference". The vlc init.d script can be downloaded as well as the installer.

#! /bin/sh -e
### BEGIN INIT INFO
# Provides:          vlc
# Required-Start:
# Required-Stop:
# Should-Start:
# Default-Start:
# Default-Stop:
# Short-Description: Execute the vlc server.
# Description:
### END INIT INFO
 
PATH=/usr/sbin:/usr/bin:/sbin:/bin
 
. /lib/lsb/init-functions
 
do_start () {
    log_begin_msg "Starting VLC server..."
        start-stop-daemon --start --oknodo --make-pidfile /var/run/vlc.pid --background --chuid media
          --pidfile /var/run/vlc.pid --startas /usr/bin/vlc -- -I Oldtelnet --telnet-host=0.0.0.0
        log_end_msg $?
}
do_start_debug () {
    log_begin_msg "Starting VLC server (debug)..."
        start-stop-daemon --start --oknodo --make-pidfile /var/run/vlc.pid --background --chuid media
          --pidfile /var/run/vlc.pid --startas /usr/bin/vlc -- --file-logging --logfile=/var/log/vlc/vlc.log
          --logmode=text --verbose=2 -I Oldtelnet
        log_end_msg $?
}
do_stop () {
    log_begin_msg "Stopping VLC server..."
        start-stop-daemon --stop --oknodo --pidfile /var/run/vlc.pid
        rm -f /var/run/vlc.pid
        log_end_msg $?
}
 
case "$1" in
  start)
    do_start
    ;;
  start-debug)
    do_start_debug
    ;;
  restart|reload|force-reload)
        do_stop
        do_start
    ;;
  stop)
    do_stop
    ;;
  *)
    echo "Usage: $0 start|stop" >&2
    exit 3
    ;;
esac
 

This shell script is fully functional and can be used as-is, outside the scope of init.d. The services it provides are:
  • start - Start the vlc server. Create a pid file for later use by the stop command. To be run as root ( or sudo ). As a best practice, the vlc service will run under the user "media". This can be changed to any user on your system, or create a user "media" for vlc to run as.
  • stop - Stop the vlc server. Looks to the pid file created during start. To be run as root ( or sudo ).
  • restart - Stop then Start the vlc server. To be run as root ( or sudo ).
  • start-debug - Start the vlc server, creating a verbose/debug log file. Create a pid file for later use by the stop command. To be run as root ( or sudo ). As a best practice, the vlc service will run under the user "media". This can be changed to any user on your system, or create a user "media" for vlc to run as. This command expects a directory /var/log/vlc to exist and be owned by the user that vlc is running as, "media".

Save the code above in a file named "vlc". Set execute allow permissions. Starting the vlc server is then as simple as:

$ sudo ./vlc start

This script can then be installed in /etc/init.d. For auto-start and auto-stop by the host, symlinks are typically created in the various /etc/rc*.d directories. Following is a minimal installation for the vlc script. It creates the user, "media", specified above and a log directory on behalf of that user. This can be changed to a user on your system.

#!/bin/bash
 
PATH=/usr/sbin:/usr/bin:/sbin:/bin
 
## start vlc in daemon mode for transcoding video
sudo useradd media
sudo cp vlc /etc/init.d/vlc
sudo ln -s ../init.d/vlc /etc/rc0.d/K25vlc
sudo ln -s ../init.d/vlc /etc/rc1.d/K25vlc
sudo ln -s ../init.d/vlc /etc/rc2.d/S25vlc
sudo ln -s ../init.d/vlc /etc/rc3.d/S25vlc
sudo ln -s ../init.d/vlc /etc/rc4.d/S25vlc
sudo ln -s ../init.d/vlc /etc/rc5.d/S25vlc
sudo ln -s ../init.d/vlc /etc/rc6.d/K25vlc
sudo mkdir /var/log/vlc
sudo chown media:media /var/log/vlc


mvpmc configuration


Once the VLC (and optionally mplayer) server(s) is configured, mvpmc needs to be configured to point at the IP address of the VLC server (see this link for more information).

In the command used to launch mvpmc (i.e. in your dongle.config file), add the following parameter to the mvpmc line:
--vlc . You can also set the IP address under the VLC Streaming options in the mvpmc Settings menu.

There are then two methods for playing video files:

1. Create a playlist item with the filename of the video file as it would be accessed by
VLC. Typically the http: identifier is not needed when the file is being accessed locally.

or

2. If the mvpmc and VLC see exactly the file and pathname, video files can be
directly accessed. Note that VLC on Windows can use unix style path names and could play
/video/sample.divx. If drive letters are required only option 1 is available.

Quality Settings


MVPMC 0.3.2 will handle details of the transcode request for you, however there are some additional options you can use to tune performance.

Under the "VLC Streaming" section of mvpmc's settings menu:

Video Transcoding:


This option allows you to set the quality of the transcoded image that is streamed to your MVP. It will always be displayed full screen, but this setting (along with video bit rate) will determine the picture clarity.

The presets are (along with rough CPU usage for the transcode on a 2Ghz Athlon XP+):

DVD Quality (720x480): This uses a default video bitrate of 4192. Approx: 80% of CPU during transcode.
SVCD Quality (480x480): This uses a default video bitrate of 2788. Approx: 40% of CPU during transcode.
VCD Quality (352x288): This uses a default video bitrate of 1152. Approx: 20% of CPU during transcode.
None: Sets up a basic transcode with no options, expecting you to have set them at the VLC end (for experienced VLC users only)

This option can also be set on the mvpmc command line by passing --vlc-vopts dvd | svcd | vcd | none

Video Bitrate:


This option allows you to override the default video bitrate selected by the preset. Setting this value to 0 tells mvpmc to use the default. For example, if you have a fast transcoding machine and wired network, feel free to use DVD quality and up the video bitrate to 8192 for maximum quality.

Command line: --vlc-vb [bitrate]

Audio Transcoding:


Here, you can choose the encoding format for transcoded audio (MP3 or FLAC). Note that this ONLY applies to audio streams and sound files - video files will always use MP3 audio for the transcode.

This option was added for future expansion as libFLAC is planned to be included with mvpmc, however only MP3 currently works.

Command line: --vlc-aopts mp3 | flac

Audio Bitrate:


You can override the audio bitrate used for transcoding here (if you don't, the default is 192). Until libFLAC is fully supported, you can at least transcode to 320 for the least loss possible.

Command line: --vlc-ab [bitrate]

Additional Audio Formats Using Mplayer:


NOTE: MPlayer is not required for video streams.

Playing Real Audio and aacPlus streams require access to mplayer (as these formats are not supported by VLC). Access to mplayer is via a small daemon program, mpslave, which runs on the vlc host computer. This program loads mplayer, accepts commands from the mvpmc on port 4213 and passes these in slave mode to mplayer. mplayer then creates a temporary file /tmp/mvpmcdump.wav which vlc will then
stream back to the mvpmc. Although this sounds complicated it all completely automated in mvpmc.

To enable this function download the file "mpslave" and place it in the folder with the mplayer
executable. After this you can run it.

Assumptions

1. vlc and mplayer are running on the same computer.
2. vlc and mplayer are either running from the same drive in windows and on this drive or in other environments vlc and mplayer can both access
folder /tmp
3. Only one mvpmc is controlling access to mvpmc.
4. mplayer and mpslave are in the same folder or mplayer is in the path.
5. aacPlus streams support is currently only available in nightly builds of mplayer.


Common VLC/Video problems


These items only affect mvpmc 0.3.1 and below, OR people using the manual VLC setup mode of 0.3.2):

Bad Sound Synchronisation


If you experience the sound slowly wandering out of sync when viewing streamed films with VLC, use the --sout-transcode-audio-sync and --sout-transcode-deinterlace parameters when starting VLC.

Transcoding Artifacts Visible During Playback


If you experience odd encoding artifacts while watching VLC streamed movies, up the rate of keyframes during transcode with --sout-ffmpeg-keyint=3 (I find this is about perfect on my system)

Movie plays in upper part of screen


MVPMC doesn't make any attempt to center streamed media from VLC. You can get around this by applying a transcoding canvas. I use --sout-transcode-canvas-width=480 and --sout-transcode-canvas-height=576 for my TV (SVCD resolution, 480p appears to be about the limit of mvp output)

Skip/Replay Does Not Work and the Time/Length values are Wrong


Proper support for these was only introduced in mvpmc 0.3.2, make sure you are running it. VLC 0.8.5 has a bug where time/length values overflow so mvpmc cannot use them. Upgrade to VLC 0.8.6.

If you are using a platform where 0.8.6 is not available (eg: I use a FreeBSD amd/64 machine as my VLC box and currently only 0.8.5 builds on that platform), and you don't mind getting your hands dirty, apply this patch to the vlc-0.8.5/src/misc/vlm.c file and rebuild VLC to fix it.

Configuring VLC Manually


If you are using mvpmc 0.3.2 with VLC manual mode (or mvpmc 0.3.1 or below) a few additional parameters need to be passed to vlc. Note that this only applies to 0.3.2 in manual mode - by default mvpmc 0.3.2 will automatically setup the transcode request correctly for you. Manual mode can be useful if your VLC machine does not have a lot of CPU power, or want to use other VLC features - for example, by using sout-transcode-canvas-width/height and not specifying --sout-transcode-width/height, you can reduce the load on your machine (but you'll have to alter VLC settings according to individual movie files, which is a pain):

For PAL:
vlc -I oldtelnet --sout-transcode-fps 25.0000 --sout-transcode-width=720 --sout-transcode-height=576 --sout-transcode-audio-sync --telnet-host=0.0.0.0

For NTSC:
vlc -I oldtelnet --sout-transcode-fps 29.9700 --sout-transcode-width=720 --sout-transcode-height=480 --sout-transcode-audio-sync --telnet-host=0.0.0.0

NOTE !!!!
Those parameters are ignored when MVPMC-0.3.4 sends vlm config via telnet, so for a newer VLC-0.9.8.x and higher it will not work if used with mvpmc-0.3.4. I was tried to use it as a fix of the 'fps' issue.

Notes from mailing list

  • Can anybody give me a working example on how to mount a directory on
a server (which
  • contains .avi divx movies) so they can be played through mvpmc?

1 If your question is on mounting a windows share check out the
windows how-to. NFS share is standard so google should be able to
help.

2. For using vlc until someone, maybe me, updates the wiki check out
my pages part 3.4 and 3.5

mvpmc-HOWTO-stream

I'll give a windows example with cifs. The key to using the
filebrowser with vlc is to have the mount name in the mvpmc file
structure look like the same vlc as will see it on the host. With nfs
and linux the steps are similar and you won't have the drive letter
limitation.

a Store or copy your movies into C:\AVIMOVIES on your windows host
(hostip)

b Setup a Windows share with name of avimovies to C:\MOVIES

c in your mvpmc dongle.config

mkdir /avimovies
mount.cifs hostip/avimovies /avimovies -o username=guest

d.Configure mvpmc to use the hostip of your windows box for vlc
from the command line --vlc hostip
or via the browser interface.

e. on your Windows box from the C: drive, ensure vlc is running in
telnet server mode

vlc -I Telnet

(version 0.8.5 gives the most support, however there is a bug in it
which prevents the time showing correctly and commercial skipping
- version 0.8.6 is better if you can get it)

f. In mvpmc filebrowser mode browse the /avimovies folder

g.select files with the remote.

Martin


Note: Interestingly, even if I don't have VLC running on my windows system, browsing the MPEG2 files and selecting them just works.