VLC-Shares installation guide with NginX

VLC-Shares is a nice way to stream your media from a centralized server to your mobile and desktop devices. But the setup might turn out to be quite tricky. Here is a guide how you can setup your VLC-Shares with the already very famous Webserver NginX.

 

Why VLC-Shares and related work

My idea to consume media on my mobile devices is the following; I’d like to have a central point where all the media is stored. This point should be accessible from everywhere, so it needs to be on the internet. This point of media access should provide some kind of graphical user interface to browse the collection and to start the media player from it. The media should be live re-encoded so it could adapt to different connection speeds.

Graphical representation of an ideal setup of a media server

Ideal setup of a media server

There exist some application which let you exactly do that. But my quality requirements are pretty high. The software titles I investigated were

  • Air Video
  • Air PlayIt
  • Emit
  • VLC-Shares

My personal favorite of this list is Air Video. Thats because of it’s performance, perfect configurability (not too much and not too less) and robustness. The only thing missing in this masterpiece is a linux server. So if you guys from Air Video are reading this, please consider making us happy!

I used it for a long time until i bought myself an Archos 80 g9 Turbo which comes with Android and Air Video has only a client application for iOS devices and an unofficial application for Mac OSX. I have to state at this point, that there is an Android application called Mirage Player which can communicate with Air Video Servers, but it can not (yet) request a live conversion of the video.

So i had to search for an alternative. If Air Video builds an Android version it’s very certain i might switch back to it. But in the meantime I stick to VLC-Shares. It has a very high configurability, more than one might wish. But it exactly gives me what I want, except a nice integration of a player, maybe directly in the VLC-Shares website.

On my Archos I had to install a special streaming media Player. A drawback of the VLC-Shares is that it’s not possible to jump forward, backwards or pause the video from within the player, this needs to be done in the Webinterface.

The installation of VLC-Shares can be tricky. That’s why i want to show you guys how to install it on a Linux Debian Squeeze box with NginX.

Install required packages

First we need to get some packages installed on our machine:

sudo apt-get install apache2 libapache2-mod-php5 php5 zendframework zendframework-bin vlc php5-sqlite php5-cli vlc ffmpeg

You should have NginX already installed and configured with PHP-FastCGI. If not do that now and come back later.

Download VLC-Shares

Grab a current version of VLC-Shares from their Website at VLC-Shares at Google Code. Extract it to a subdirectory of your www directory. In this tutorial I assume that the directory for all the websites resides at /www/ and you run virtual name based websites.
Extract the directory so that the path to the public/ subdirectory looks like that: /www/shares/vlc-shares/public. /www/shares/ will be the root of your VLC-Shares site. Now set the correct owner and permissions:

sudo chown -R www-data.www-data /www/shares/
sudo chmod -R 770 /www/shares/
sudo chmod -R 777 /www/shares/vlc-shares/data

Setup NginX

Now that everything is in place we can tell NginX to serve VLC-Shares. For that make a new entry in your /etc/nginx/sites-available/ directory of NginX and put the following contents to it:
(Don’t forget to adapt it for your liking and change the server name).

server {
	listen 		80;
	server_name 	shares.example.com;
	access_log 	/www/shares/access.log;
	error_log 	/www/shares/error.log;
	root /www/shares/;

	location / {
		index index.php;
	}

	if (!-e $request_filename) {
		rewrite ^(.*)$ /vlc-shares/public/index.php last;
	}

	location ~ \.php$ {
		include /etc/nginx/fastcgi_params;
		fastcgi_pass 127.0.0.1:9000;
		fastcgi_index index.php;
		fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
	}
}

Now enable the configuration with

cd /etc/nginx/sites-enabled
sudo ln -s ../sites-available/shares

restart your NginX

service nginx restart

and navigate to your VLC-Shares installation at

http://shares.your_hostname.tld/vlc-shares/public

and complete the installtion by filling out the settings on that webpage.

Setup Android Device

There are several streaming players for Android devices. On my Archos 80 G9 comes a very neat player. But of all the players i tried i found that Daroon Player gets the job done with VLC the best.
So download this nifty player and add your host with the adress

http://example.com:8081

to the favorites. When you start a stream in VLC Shares be sure to select HQ preset of video quality and the “Http Stream on 8081″ option, see image below.

vlc streaming options

VLC Streaming options

So get started with your first stream and enjoy. Note that you need to start the stream first in the web interface and then access it with your media player.

Hopefully I could help you guys getting your VLC-Shares to run. If you have any questions or remarks leave them in the comments below and i will give my best to help you out.

Hints

  • If you have a firewall installed be sure to open the port 8081.
  • I spent a long time messing around with the VLC-Shares application to get it to run. The main issue was that the public folder needs to be a subfolder of the “vlc-shares” directory on your public webfolder, that means the root of your website points into the directory where the “vlc-shares” directory lies, see here.
  • After i managed to get to the installtion interface of VLC-Shares, i wasn’t able to submit the form. Everytime on submission an error occured which stated “Invalid value”. I had to work around this by setting up the application with the Apache 2 webserver, completing the Setup on the installation page, and then removing the Apache 2 webserver and enabling NginX again.
  • Sometimes the VLC player crashes and no new instance can be created, a simple “sudo killall vlc” in the console fixes this.

 

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>