Tag Archives: Twonky

Twonky DLNA with video thumbnails

Update: download thumbnails and movie posters from the internet automatically using tw-video-scraper for Twonky.

For streaming videos to a DLNA compatible television, you can use TwonkyServer software. This is not the only DLNA software around, but I like it because you can run it on a lot of platforms, it is fast, and it runs on low-powered machines. The installation instructions for Twonky on Linux are not very complete. For thumbnails the instructions are completely missing. You will need some Linux knowledge to set everything up. Luckily, it is not that difficult.

First, download Twonky. If you visit the main web site, it is very easy to miss that Twonky is available for a lot of platforms. On the main web site, only Windows, OS X and Linux i386 are advertised. On the forum, you can find the NAS versions. If you want to run it on an ARM architecture machine, try the Kirkwood build. This is an ARM build, but unlike the other ARM bundles, it will run on newer Debian versions (due to library issues, the ARM bundles do not run on Debian).

Extract the zip file to the directory /usr/local/twonkymedia Next, set the correct permissions on files by running
[code]chmod 700 twonkym* cgi-bin/* plugins/*[/code]
Now let’s make sure that Twonky starts when the system boots. A boot script is supplied, but it is not optimised for Debian. Open the file twonkymedia.sh in a text editor and change the lines
[code]
# Default-Start:  3 5
# Default-Stop:   0 1 2 6
[/code]
to
[code]
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
[/code]
Then, make a symbolic link to this script in the /etc/init.d directory, and make sure that the script executed at boot time. This can be done with the following two commands
[code]
ln -s /usr/local/twonkymedia/twonkymedia.sh /etc/init.d/twonkymedia
update-rc.d twonkymedia defaults
[/code]
That is it for the standard set-up of Twonky. Next, let’s enable thumbnail support. For this, some extra software is needed. This can be installed with
[code]apt-get install dtach ffmpeg[/code]
Edit the file /usr/local/twonkymedia/cgi-bin/ffmpeg.location at replace its content with
[code]/usr/bin[/code]
Next, edit the file /usr/local/twonkymedia/cgi-bin/ffmpeg-video-thumb.desc at replace its content with
[code]
# generate video thumbs
#(c) 2010 by PacketVideo
exec: ffmpeg -itsoffset -30 -i $infile -vcodec mjpeg -vframes 1 -an -f rawvideo -s 284×160 $outfile
# capabilities
from=video/*
to=image/jpeg
videothumb
synchronous
[/code]
Finally, make some edits (again) to the file /usr/local/twonkymedia/twonkymedia.sh Find the line that says [code]”$TWONKYSRV” -D[/code] and replace this with [code]dtach -n /tmp/twonkymedia “$TWONKYSRV”[/code] Now you should be able to start Twonky with the command [code]/etc/init.d/twonkymedia start[/code]

Open a web browser, and go the the URL http://nas-ip-address:9000/config Click on the Transcoding link, select JPEG, and click Save Changes.
Now you can add the folder you wish to make available via Twonky. Click on the Sharing link and add the folder that hold your media. Click Save Changes again, and Twonky will scan your folders for media. With the link Server Status, it is possible to see how far the scan has progressed. Notice that this is only the scanning of the files. The process of generating thumbnails is not covered on the status page. The only way to see this, is on the server itself, with the command [code]dtach -a /tmp/twonkymedia[/code] Use the key Ctrl+\ to go back to the terminal. Thumbnail generating will continue in the background.