Archive for 2010-10-10

Air Video Server on Linux (Ubuntu 10.04)

Posted in Hacks with tags , , , on 2010-10-10 by mingaz

I have had an iPad for a few months now, but I use it mainly for reading, browsing, checking my e-mail and more recently for watching TV (through Veetle).

I haven’t used it so much for watching videos because my library is in HD (mostly 720p in Matroska) and the iPad usually doesn’t support the profile and level of the encondings. Converting them in advance takes time and for that reason is not convenient.

The Air Video player, with the Air Video Server, allows for the streaming of video transcoded for the iPad, but there are only server versions for Windows and for Mac OS X and my library is available on a headless linux server running Ubuntu 10.04.

After some googling I found out that there is a linux version of the Air Video Server. However, the installation process is not straight forward, or at least not as the Windows and Mac versions.

In this article is a compilation of the steps that took me to get it to work, based on the information found mainly on the following locations:

Setting up the server

  1. Since the server is based on a customized version of FFmpeg, download it from http://www.inmethod.com/air-video/licenses.html (use the 2.2.5 version!) and unpack it to some directory;
  2. Install the following packages: libmp3lame-devlibfaad-devlibx264-dev (0.svn20100115-0.0~kkstemp1 from Stéphane Marguet’s PPA!), mpeg4ip-server;
    just run:

    sudo apt-get install libmp3lame-dev libfaad-dev libx264-dev mpeg4ip-server faac

  3. Change to the directory to where you have unpacked FFmpeg
  4. Run:

    ./configure –enable-pthreads –disable-shared –enable-static –enable-gpl –enable-libx264 –enable-libmp3lame –enable-libfaad –disable-decoder=aac

    and then

    make

    If you get an error like “undefined reference to ‘x264_encoder_encode'” you can try and build the dependencies for ffmpeg by running:

    sudo apt-get build-dep ffmpeg

    It worked for me!

  5. After the build is complete, download the AirVideoServerLinux.jar (you can increment the alpha number in the URL to check if there is a newer version) and test.properties.
  6. Modify the test.properties and fix the paths to the 3 tools and your video directory:
    • path.ffmpeg should point to your just compiled ffmpeg-binary
    • path.mp4creator is /usr/bin/mp4creator
    • path.faac is /usr/bin/faac
    • folders format is: <label1>:<path1>,<label2>:<path2>,…,<labelN>:<pathN>
    • leave the other options as they are
  7. Finally you can run the server by executing:

    java -jar AirVideoServerLinux.jar test.properties

Auto-starting the server

To autostart AirVideoServer upon bootup, you can use UpStart which is the default way in Karmic Koala.

Just create a file /etc/init/airvideo.conf with this content:

start on runlevel [2345]
stop on shutdown
respawn

exec sudo -H -n -u root /usr/bin/java -jar /opt/AirVideoServer/AirVideoServerLinux.jar /opt/AirVideoServer/test.properties

This will tell UpStart to run the server process as user root upon reaching one of the runlevels 2-5 and stop the server when the system shuts down. respawn tells it to restart the server if it crashed.

You can also control it manually by doing

sudo start airvideo

or

sudo stop airvideo

Setting up with Bonjour

In order to set up Air Vide Server with Bonjour announcement you need avahi-daemon. To install it, run:

sudo apt-get install avahi-daemon

Then create a file named airvideo.service (the name is really not important) in /etc/avahi/services/ with the following content:

<?xml version=”1.0″ standalone=’no’?>
<!DOCTYPE service-group SYSTEM “avahi-service.dtd”>
<service-group>
<name replace-wildcards=”yes”>AirVideoServer on %h</name>
<service>
<type>_airvideoserver._tcp</type>
<port>45631</port>
</service>
</service-group>

The file should be picked up immediately by the avahi-daemon, but you can restart the service just to make sure:

sudo restart avahi-daemon

Adding the server to Air Video player

When you run the Air Video player, the server you just set up should show up in the “Computers on Local Network” list. If not, either you didn’t set up Bonjour announcement properly, or you just didn’t set up Bonjour.

In either case you can manually add the server (by its IP address or by its name).

Enjoy!