Installing Serviio 1.5 on Linux Mint / Ubuntu

Serviio is a DLNA media server developed in Java. It has different profiles that match most CE devices from many vendors (Samsung, Sony, Panasonic, …). I use it to stream movies from my PC to my Samsung Smart TV (D Series).

Within the many features of Serviio, I would like to emphasise the ones I love most:

  • Allows to “stream” subtitles (working on Samsung Smart TV)
  • Streams movies with several audio channels (audio selection is done on TV)
  • Stream AVI, FLV, MP4V, MKV movies without the need to transcode them
  • Stream media from online sources (i.e.: video podcasts)
  • Categorizes the video files into movies / series, …

Download and Installation

Prerequisites

Java

On Linux, Java 8 is required. You can check your installed version running the following command

$ java -version
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)

As you can see, my system runs version “1.8.x” which corresponds in fact to “Java 8”. In case that you have a lower version, check my post on how to install Java on Linux Mint

ffmpeg

In order to stream and transcode media you’ll need to installffmpeg. Unfortunately, on Linux Mint 17.x or Ubuntu 14.04, the package is not available in the standard repositories. Serviio encourages you to build the package from sources, since most of precompiled versions of ffmpeg do not include librmtp support. In my case, I can (for the moment) live without that and installed ffmpeg from a ppa (ppa:mc3man/trusty-media). Check ffmpeg website for details.

Other packages

Additionally to ffmpeg and Java 8, be sure to have the following packages (available in the standard repositories) installed:

  • libavcodec-extra-54
  • libavformat-extra-54
  • librtmp
  • libx264
  • dcraw

Installation

You can download Serviio directly from the official website ( http://www.serviio.org ). The linux version comes in form of a tar.gz package that you can easily unpack. I placed my installation into the “/opt/” folder. Depending on your user rights you might need to sudo the command

/opt $ tar xvfzm <FILENAME>.tar.gz

You might need to change the user owner/permissions of the recently extracted folder and files.

Running Serviio

Serviio provides two binaries, a daemon (the server itself) and a console for configuration.

/opt/serviio/bin $ ./serviio.sh &
/opt/serviio/bin $ ./serviio-console.sh

The console application is displayed in your tray and can be started with a simple double-click. After a few seconds/minutes, the tool will show the DLNA enabled devices discovered on your local network and assign the best matching profile automatically. Do not worry if you get an “unrecognized device” (most Android mobile phones and tablets), the Generic DLNA profile shall be OK for most users.

Serviio Console

Additionally, if you have several network interfaces, you can bind the Serviio daemon to listen on a certain interface.

You can explore the multiple options and settings along the top taps. However, “Library” is the most interesting of them. Add the folders where your media is located and with the check boxes on the right side, select the type of media

serviio-library

Transcoding settings can be configured under the tab “Delivery”

Starting Serviio daemon automatically on boot

On Linux versions with Upstart like Mint or Ubuntu, you can install this script in /etc/init to let Upstart know about serviio and start/stop the daemon automatically when your network interface is setup. Optionally, if your media resides in a network mount, you can also build a dependency on a certain mountpoint

# Serviio - media server
#
# Serviio is a free media server. It allows you to stream your media files
# (music, video or images) to renderer devices (e.g. a TV set, Bluray player,
# games console or mobile phone) on your connected home network.

#start on mounted MOUNTPOINT=/media/foo
start on started networking

#stop on unmounted MOUNTPOINT=/media/foo
stop on stopped networking

# If you don't want to run Serviio as root
# uncomment the following lines and replace  with user and group
#setuid serviio 
#setgid serviio

script
 LANG=de_DE.utf8 exec /opt/serviio/bin/serviio.sh
end script

Be sure to adapt the path of the serviio daemon to point your Serviio installation folder (in my case /opt/serviio ) and to replace the locale “de_DE.utf8” with one matching your system. I strongly recommend using an utf8 version to avoid problems with charsets. To list the locales installed, type:

$ locale -a
C
C.UTF-8
de_DE.utf8
en_GB.utf8
en_US.utf8
en_ZM
en_ZM.utf8

and replace “LANG=de_DE.utf8” with your desired locale.

As soon as your Upstart script has been installed and customised, you can use the following command with the corresponding option:

$ sudo service serviio [ status | start | stop | restart ]

By default, Upstart, will run Serviio as root. If you want to run as a different user proceed with the following section.

Fine tuning (optional)

I am a kind of paranoid with user permissions and access rights. Therefore, I want Serviio to run as a restricted user called “serviio”, with restricted access to my system and files. This is not really needed and most installations will work perfectly without this. Proceed at your own risk!

First of all, you need to create a new user: i.e. serviio

$ sudo adduser --system --group --no-create-home serviio

Then, you have to change the rights (i.e owner) of your serviio binaries. Assuming you have installed serviio under “/opt/serviio”:

$ sudo chown serviio:serviio -R /opt/serviio

Now, you only need to assure that Serviio has read rights to your media files. In case that your media files are located in a filesystem which allows restrictions on Linux. You can do that easily with.

$ sudo chmod o+r -R

Be careful with the previous command, since it will allow all users in the system to read all the files contained in your media folder. An even safer approach would be (but I am not so paranoid!)

$ sudo chgrp serviio -R 
$ sudo chmod g+r -R

But that could mess up something else, since it is changing the group of the files contained in the folder and that might have some side effects (depending on your system)

serviio.log

If you followed this tutorial, you have created a new user without a home directory. In that case, you will always see some warnings in the log file. Do not worry it will not affect to the normal function, it only means that you are running Serviio under a user without a home directory. Therefore, the preferences directory cannot be created.

WARN [prefs] Couldn't create user preferences directory. User preferences are unusable.
WARN [prefs] java.io.IOException: No such file or directory
WARN [prefs] Could not lock User prefs. Unix error code 2.
WARN [prefs] Could not lock User prefs. Unix error code 2.

References

Some of the information summarized in this post was collected from the following websites:

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: