Installing TwonkyServer on Ubuntu Lucid Lunx 10.04.1

Update – Monday 26th December 2011.
Being a long term Logitech  Squeezebox owner, I’m pleased to see that they have now incorperated a DNLA Server into their software and renamed it  “Logitech Media Server“. I now no longer use  Twonkyserver as the above software now serves my needs.

However, I’m keeping the instructions below so that other people can configure Twonkyserver on Linux.

Before we begin.

This is a commercial product, you will have to buy a license, however IMHO, it’s well worth the asking price, as it vastly outperforms the opensource products like Fuppes and MediaTomb with much better stability, and much lower runtime resources. There is a free trial, so you can evaluate it’s performance before you buy.

First thing you need to do is download twonkyserver to your machine.

Next we have to install it as root

Set up the appropopriate multicast address to broadcast your files on your network.

Of course, the above will only be in your routing table until the next time you reboot your server. So a better solution is to append the following file.

Add the following to the bottom of the file (append to the bottom of your network settings, usually eth0 if you only have one network card.

Starting Twonkyserver at boot using upstart or Debian runlevels

We need to start twonkyserver on the default runlevels. I’m including two ways of doing this. One specifically for Ubuntu 10.04 onwards using upstart and another for a default Debian install.

Ubuntu 10.04 runlevels using Upstart

Stop tonkyserver running.

Delete the installed twonkyserver startup script.

Create an upstart startup file called twonkyserver.conf in directory /etc/init/

Copy and paste the following code snippet.

Create a symbolic link in the init.d directory to start the upstart job on reboot.

Now to Test

Start twonkyserver from the command line.

You should get a message similar to the following.

If you need to stop twonkyserver, you type the following.

At this point, it may be worth rebooting your linux server to ensure that twonkyserver comes up correctly. After you’ve done so, you can check to make sure that twonkyserver is running by typing the following.

If all is well, it should come back with the message

All done, you of course will most likely have a different process id 🙂

Debian default runlevels

Setting up Transcoding

Info: If you are running Ubuntu 10.04 or later, and have created an upstart script using the instructions above. In the instructions below, you will ask to restart twonkyserver a couple of time. To do this using the upstart script type.

sudo restart twonkyserver

This isn’t really needed if you only have mp3’s and a media player that supports mpeg4 (the new PS3 slim for example), if however, you have flac music files and mvk video files for instance, then you will need to transcode (change there format) on the fly.

The default install of twonkymedia only supports transcoding of the jpeg photo format by default (see screen shot below).

Enabling Video Transcoding

Install ffmpeg:

Note: Installing the unstripped libraries as in the above step insures that MKVs will transcode, otherwise the transcode will fail because mpeg2video will be missing. If while running that last command the install fails because of a missing package, do an apt-cache search libavcodec (replace libavcodec with whatever package it says is missing – this way you can see if perhaps you need *-unstripped-52 rather that 51, etc).

Open /usr/local/twonkymedia/cgi-bin/ffmpeg.location in your editor and replace c:/ffmpeg with /usr/bin

It is necessary to run the mediaserver in the foreground for transcoding to work properly. If you are using the supplied Twonky startup script, you need to remove the -D from the line around line 91 that reads “$TWONKYSRV -D”

Edit the startup script:

Restart twonkyserver.

Now when you go to the transcoding page of your twonkyserver, you should see the following.

More on MKV Files

For MKVs to transcode, you need to place a .desc file in twonkymedia’s cgi-bin folder.

Create the file /usr/local/twonkymedia/cgi-bin/ffmpeg-mkv-mpeg.desc

Set the new file’s permissions to 644.

Inside the file, paste the following:


Sheevaplug Wiki
Sheevaplug/GuruPlug at Twonkyforum
Transcoding Twonky
Getting started – Using upstart

30 thoughts on “Installing TwonkyServer on Ubuntu Lucid Lunx 10.04.1

  1. THX, works almost perfect (64Bit issue), if anyone will use this Tutorial, on a 64bit Server you also have to install 32Bit Librarys (“sudo apt-get install ia32-libs”) – if you don’T you’ll get a start error “-bash: **** twonkymedia: No such file or directory”

  2. hi, i followed your instructions on my ubuntu server 10.04 – 64bit, but the boxes are still grey. (32bit libs are installed)
    what can i do ? any ideas?


  3. If I have time tomorrow, I’ll go through my instructions on a VM (Virtual Machine) and see if there is anything missing. Unfortunately I don’t have a 64bit PC to test the instructions on. If I think of anything, I’ll get back to you.

  4. Followed the instructions on a VirtualBox VM this morning and everything seems to work fine for a 32bit processor. Sorry Adi, I don’t have the hardware to diagnose your problem. But if you managed to find a solution then please let me know and I’ll update the instuctions for the next person.

  5. hi,
    sorry – during installation of the ffmpeg, it get the wrong permissions. after adaptation it works.


  6. Thx for this documentation, very easy to follow.
    In the ‘More on MKV files’ part, there seems to be a typo in the command for creating the file, it should read ‘mkv’ instead of ‘mvk’, i.e.
    sudo touch /usr/local/twonkymedia/cgi-bin/ffmpeg-mkv-mpeg.desc

  7. I’ve running a TwonkyServer on Ubuntu 10.10 for a while.
    But I’ve got a problem with transcoding.
    The TwonkyServer is so stupid that he transcodes all mkv files in a directory although I just want to view one file.
    That’s really kind of pissing me off.
    But the worst thing is that I can’t view my MKV files because everytime I try to view a MKV file my XBOX says Connection problems.
    All the other files are working fine.
    A few weeks ago I got it working even though I don’t really know how but then I reinstalled Ubuntu and now I don’t know how to get it working.
    Thats my desc file for MKV to WMV Transcoding:

    # transcode video (mkv to wmv)
    exec: ffmpeg -i $infile -vcodec wmv2 -acodec wmav2 -ab 192k -ac 2 -sameq -y $outfile
    # capabilities

  8. Hi Stefan,

    I don’t have an XBox so although my config works with my PS3, it may not work with your XBox. Saying that, if I think of something I’ll let you know.


  9. yeah but i know that its possible and it worked a while ago.
    But another question do you have the same problem that twonky converts all mkv files in a directory.

  10. In the same boat. I just want TwonkyMedia to transcode files on the fly for me. 🙂 Not transcode all files in a folder, since that would take up an sick amount of space. 🙁

    Is the DESC config file structure documented anywhere?

    Btw, great writeup!

  11. Stefan & Wing Wong
    If I have a bit of time this week, I’ll look into the mkv issue and post any extra information I can find. All dependent on work and family life of course 😀

  12. Awesome write-up! This is the first one that was comprehensive enough to actually get twonky to transcode successfully. Of course once it started I quickly realized two things to my horror.
    1) Twonky transcodes everything ahead of time instead of on the fly
    2) It doesn’t give you any quality options or the ability to tell it where to dump the massive files once they’re done!

    I was able to hunt down the directory it was using in my var partition and create a symlink to a folder that was actually within my storage array which took care of the space issue but since it doesn’t give me any quality options it looks like it’s going to try to transcode my entire 2TB movie/TV show collection at same quality, taking up another 2TB. I guess it’s back to Google to try to find a solution that actually transcodes on the fly in Linux, but so far the offerings have been pretty sparse 🙁

  13. Here is what you need to auto start Twonky Server on Ubuntu.

    # TwonkyMediaServer
    # TwonkyMedia UPnP server

    description “TwonkyMedia UPnP server”

    start on runlevel [2345]
    stop on runlevel [!2345]

    exec /usr/local/twonkymedia/twonkymediaserver

  14. That last post I did is were he says “Edit the startup script:

    sudo nano /etc/init.d/twonkyserver”

    Just put what I put in the last post beside what I typed in the startup script.

  15. Thanks Raymond,

    I’ll add the above to the instructions next week time permitting. Thanks for that, much appreciated, if you think of anything else please comment again.



  16. Not sure yet but I think that start up will not let it restart. But it does boot up with it started.

  17. Stop the running process.
    1) sudo stop twonkyserver
    2) Remove the startup script and the symbolic link.
    sudo rm /etc/init/twonkyserver.conf /etc/init.d/twonkyserver
    3) Delete the executable
    sudo rm -r /usr/local/twonkymedia

  18. Hej.

    I have a server with one Wan and two Lan interface, One for Parent and One for the Childrin, the Childrien Lan is closing in the Night hour, I whant my Media server to run on both Lan interface, is it enof to do like this:

    sudo route add -net netmask dev eth1
    sudo route add -net netmask dev eth2

    up route add -net netmask dev eth1
    up route add -net netmask dev eth2
    down route del -net netmask dev eth1
    down route del -net netmask dev eth2

    or is ´ther more to do.

  19. Svenn,

    I don’t see any reason that shouldn’t work, I’ve not got a VM set up, so I can’t test at the moment. If it doesn’t work, then let me know and I’ll have a look into it. Time permitting.

  20. Thanks for the write-up. I found it really easy to follow but I’m stuck at the point of trying to display the twonkyserver transcoding page options. What do I have to up into the address bar?

  21. Hi Martin

    Its usually the IP address of your twonkyserver followed by the port number (usually 9000), for example, my twonkyserver has an IP of, so to get access to the twonky setup page, I would put the following into the browsers address bar.

    Hope that helps,


  22. Just a quick comment. You only need to check the MPEG2 box if you want twonky to transcode everything in the background. This is only needed if you have limited processing capability and you don’t mind giving up the space! If you don’t check this box then twonky will transcode everything on-the-fly or real time. It will also cache it in a smaller cache so if you play it again it will not need to transcode it. In 7.x releases, the background transcoding had been removed completely!

  23. Thanks for the Upstart script! 🙂
    However, to make it work with TwonkyServer 7.2.3, I had to make a couple of changes:
    description "TonkyMedia UPnP Server"

    expect fork

    start on (local-filesystems and net-device-up IFACE!=lo)
    stop on runlevel [!2345]

    exec /usr/local/twonkymedia/twonkystarter

Leave a Reply