XBMC Ubuntu Minimal Maverick Install Script

1 01 2011

As a little New Year’s present, I have updated a script that has been knocking around to allow you to install XBMC on a minimal version of Ubuntu Maverick.

If you simply install Ubuntu from the mini.iso containing the basic Ubuntu Maverick install, then on reboot, download my script using:

wget http://www.prupert.co.uk/scripts/xbmcmaverickrevo.sh

make it executable, using:

chmod a+x xbmcmaverickrevo.sh

then finally run it using:

sudo ./xbmcmaverickrevo.sh

I find it is best to run it again, once the script reboots the machine, as this fixes a few issues.

It is still a work in progress, as you can’t yet shutdown / restart etc via XBMC since it seems the method to add permissions in Ubuntu 10.10 have changed and they conflict with the setup here, so I am still looking into that. To shutdown / reboot at the moment, I log in via SSH and issue:

sudo shutdown -hP now

Also, it is designed to work just with the Acer Aspire Revo 3610, but there is no reason why it wont work with any other device (apart from maybe the audio configurations).


Download It Here

Install the Latest Version of LCD4LINUX on Ubuntu

12 08 2010

Update: It seems that I need to add some additional steps when installing on a completely vanilla version of Ubuntu. So I have added all the steps that should now be required.

Despite the most recent version (0.11.0) of lcd4linux being released in November 2009, Ubuntu Lucid comes with an older version and thus misses out on some new features and drivers, in particular drivers for the cool and cheap Pertelian X2040.

It is however, possible to build the latest version of lcd4linux from source, but you need to do a few things in order to get it to work.

This little guide assumes you have built stuff before on Ubuntu, so have all the necessary build tools.

First, navigate to the folder you want to download and build the source in.

Then, download the latest version via svn:

svn co https://ssl.bulix.org/svn/lcd4linux/trunk lcd4linux

Next, navigate into the newly created source folder using cd lcd4linux and install some dependencies:

sudo apt-get install automake autoconf m4 perl libtool gettext

Then, run ./configure, if you want to include a specific driver, for instance for Pertelian, include it here, like this:
./configure --with-drivers=Pertelian
Now, if you try to make, it wont work, I am not sure why, but there are some issues. To fix these, issue the two following commands:
mkdir m4
sudo ln -sf /usr/share/libtool/config/ltmain.sh .
Now, you can run:
sudo make install
And you now have a working and up-to-date lcd4linux. I’d recommend using checkinstall rather than make install, because you can uninstall the package at a later date if you want.

Doing all this allows me to run my Pertelan display on my little thin client that I use as a baby monitor. It now tells me the PIDs of FFmpeg and motion (so that I know that they are working and running), that the Internet connection is UP and the system load, alongside the date and time!

Backup All your Files Using Google Docs

10 08 2010

Google Docs recently upgraded to allow you to upload any file to Google Docs. This very handy feature means, if you purchase a little extra storage from Google, you can use Google Docs as your personal online backup service. Google offer a variety of storage plans:

20 GB ($5.00 USD per year)
80 GB ($20.00 USD per year)
200 GB ($50.00 USD per year)
400 GB ($100.00 USD per year)
1 TB ($256.00 USD per year)
2 TB ($512.00 USD per year)
4 TB ($1,024.00 USD per year)
8 TB ($2,048.00 USD per year)
16 TB ($4,096.00 USD per year)

From what I remember when I looked in to it, these prices are pretty good compared to dedicated online backup services (though anyone who needs and can afford the 16TB option needs their head examined!). The only issue is how to get all your files into Google Docs. Well, if your Command Line-Fu is strong, you could use Google CL, but it doesn’t work with a batch of files, unless you write some cunning script. A much easier alternative is to use software from Gladinet, in particular their Gladinet Cloud Desktop tool. This allows you to define various backup tasks, allowing you to sync folders and their subfolders to a folder in Google Docs (or Picasa or a number of other online sources). All your folders and subfolders are backed up to Google Docs, with the folder structure being replicated in Google Docs. You can set these tasks to run every day and it should only update new and changed files. I have been using it for the past month or so and it seems to work fairly well. The only real issue is due to slow upload speeds, but I am not sure whether this is an issue with my broadband provider or a limitation of the Google Docs servers. Either way, the results are that all my files are backed up to Google Docs automatically.

Use Dropbox as Your Own Personal Source Repository

10 08 2010

Dropbox is an awesome little service, allowing you to sync various files between devices (PCs, Andriod and iPhones for example). Whilst there are lots of uses of the Dropbox service, I tend to use it for two main things.

The first is as my own personal SVN-esque server. I set up a folder in my main Dropbox “root” directory, by default in Windows this is under “My Documents/My Dropbox”. Any code I write, I save in this folder. The code is then synced to all my PCs automatically by Dropbox, allowing me to work on the code from anywhere. As I use Eclipse to write my code, I have set this folder as the default source folder for my workspace in both my Windows and Ubuntu version of Eclipse. Thus, all I need to is open up Eclipse and hit F5 to refresh and get all my updated sources, thanks to Dropbox!

I do the same for the music tracks I am working on under Renoise. By saving all my songs in a folder under the main Dropbox folder, the tracks are synced across all my accounts. As Renoise is cross-platform (to a degree) I can simply open up Renoise on both my Windows and Ubuntu machines and work on the same track. Sweet. This trick works for any cross platform program. You can do it for your Firefox or Google Chrome profiles, or even your Music Library!

The Best, Most Useful and Most Awesome Android Apps

9 08 2010

I’m a big fan of Google’s Android OS and have been using my Android phone for about ten months now. It seems one of the most common questions on the interwebosphere related to Android is “What are the best Android apps?”. Well, I aim to give my small contribution to that question by listing the apps I use most often on my HTC Hero running Android 2.1.

First off, there is the choice over the biggest app of all, which version of Android to use. Although I use a HTC Hero, I am not a big fan of the Sense interface, so instead I have chosen to install a vanilla (plain) rooted version of Android. As I am using a custom ROM (the name given to the OS that the phone runs) I can choose to use a more modern version of Android than is currently available on the HTC Hero. Thus, whilst other UK Orange HTC Hero users are still waiting for Orange to get their update out there, I have been rocking Android 2.1 for over two months now. I use RaduG’s VanillaEclair ROM which is pretty damn perfect. For those that don’t know, the advantage of running a rooted version of a ROM means you can install certain apps that have added functionality and you have greater control over your phone, more about this later.

The second most important app (and from now on I am only talking about real apps here) is what Home app to use. The Home app is the one that you see and use almost all the time. It is the first screen you see after you unlock your phone and it is what displays the menu of all your apps . The default Android Home app isn’t bad, but there is certainly room for improvement. There are a number of Home apps out there, both free and paid for with various functions. I have settled on the rather awesome LauncherPro. LauncherPro is based on the stock Android Home app, but it has a myriad of improvements. First off, it has a dock at the bottom, that is fully customisable, allowing you to put shortcuts to apps, contacts and folders right on the bottom of your Home screen. Even better, you can have up to three docks, which you can swype between, so you can have 12 shortcuts. Furthermore, a newly released feature allows you to add a gesture shortcut to each of those shortcuts, so swiping up on a shortcut opens up another shortcut, so you can have in effect 24 shortcuts in all. As you can see on my screenshot, I have a shortcut for the browser, the phone, messaging and gmail. The middle “blocks” button takes me to my menu of apps. You can also see another excellent feature of LauncherPro, the ability to give message indications for certain shortcuts, in this screenshot it is showing I have 2 unread gmails, ooh, how popular I am. LauncherPro also features some of the more popular features from alternative Home apps, like ADW Launcher and HTC’s Sense – a “helicopter” overview of all your home screens and scrollable widgets, more about them in second. There are two versions of LauncherPro, the free version, called LauncherPro and a paid for improved version called LauncherPro Plus. LauncherPro Plus includes additional features (and more are being added all the time), the main ones are three built-in widgets: bookmarks, calendar and people. You can see the calendar widget in the screenshot to the right, it basically shows you your upcoming appointments. The great thing is that it is scrollable, so you can scroll through about a month ahead to see what is coming up. The people widget shows a pre-selected group from your contacts and is also scrollable, clicking on a contact pops up a context sensitive menu with various options to interact with that person. The bookmark widget shows thumbnails of all your bookmarks, though I have not used that widget yet, so can’t say more than that. I’d highly recommend the Plus version, if only to support the excellent developer of LauncherPro, as it is a one-man show.

My next awesome app is Tasker, but I have already mentioned this app in a previous post so I wont go on about it here. Basically, Tasker allows you to set up various profiles that enable or disable various settings. It essentially allows you take full control of your phone. Lifehacker wrote some cool guides on how to take full advantage of Tasker. You can see some examples of the profiles I use in the screenshot to the right. So, for example during the day, I turn on my data connection and auto-sync, but at night these are off, to save battery power. Another profile simply notifies me when the phone is charged, so I don’t leave it plugged in the charger for an age. It is an incredibly powerful tool and helps you take total control over your phone.

Up next is Titanium Backup. This app only works on a phone with a rooted ROM, as I mentioned earlier. It’s one of those awesome apps that you keep installed and only use occasionally, but is very useful when you use it. It allows you to backup all your apps and their associated data. Then, when you come to install a new ROM, you can simply restore that backup and all your apps, with all their settings as you left them. Nice. You can also use it to backup pretty much anything else as well, such as your contacts, text messages, browser bookmarks etc etc.

Next on the list is the rather awesome CoPilot Live v8. Whilst Google’s Navigation app is certainly useful, it only works online and gets into trouble if you veer off course without an internet connection – which in the UK can happen from time to time, especially if you are on Orange. CoPilot is in a whole different league when it comes to SatNav apps. It is just beautiful, works really well and is very easy to use. It has a few additional features, like nearby Points Of Interest indicators, the ability to route missing out toll roads and bridges and live tracking. You can buy maps for most of the major countries in Europe and the United States for a reasonable amount (way cheaper than the cost of maps for v7). I used it on an 8 hour round-trip and it didn’t flake out on me once. Because all the maps are stored on your SD card, it works offline, so you never loose where you are or where you are going. I wouldn’t be surprised if they come out with a new version next year supporting 3D models of buildings in major cities, ala Google Earth, but that will no doubt require the purchase of a new licence and no doubt a new phone to power it all!

Next on the list is the rather cool SystemPanel. This is a great app for keeping an eye on your phone to make sure it is running OK. It shows you which apps are running, how much memory is being used and which apps are thrashing your CPU (and hence killing your battery). It also allows you to monitor CPU and battery usage as well as data usage. Furthermore, it has an app archive facility allowing you to backup non-protected apps. It does have the ability to kill tasks and apps to “free memory”, but this is advised against, as Android is designed to use up as much memory as possible, just like Linux, so you are always going to be “low on memory”. Android kills apps itself if another app needs more memory, so task killers really aren’t useful. I use it if an app is misbehaving and to track down what app is maxing out my CPU and generally to keep tabs on my phone. It has a lovely GUI and is very reliable.

My final app that I would recommend is the BBC News widget by Jim Blackler. It might only be useful to users in the UK, although it does show World news if you want. It is by far the best news widget I have found. I did use AnyRSS Reader for a long time, but I never liked not having an image to view and it took up too much screen space. The BBC News widget takes up only one “slot” on your home screen, yet manages to squeeze a picture and an informative headline into that space. You can set it to regularly update throughout the day, so whenever you turn your phone on, you are always aware of the latest news around the world. You can see it in action in the screen shot a few images above, showing the news headlines (quite why the BBC thinks an article on being single is a news headline is any one’s guess, but that’s modern media for you) and David Cameron’s latest foreign policy gaff.

There is one more app that I use everyday, but it is quite specific to me. IP Cam Viewer is a great app if you need easy and quick access to images from an IP Webcam. I have a baby daughter and have set up a night-vision webcam to monitor her during the night and day when she sleeps. IP Cam Viewer allows me to keep tabs on her late at night and when it gets dark when we are putting her to bed. The developer of the app is very active, updating it constantly and it even supports audio from some webcams.

It worked perfectly with my cheap Fosscam ripoff from eBay (until I punched a hole through the microphone by accident and the plug literally fell apart in my hand!). If you need a way to view webcam images on your phone, I would highly recommend it.

That then is about it for my favourite apps on Android. Here are some other apps that I use occasionally that deserve an honorable mention: Astrid (for managing your daily tasks), Andromote (an awesome UPnP client), APNdroid (for turning off your data connection), Barcode Scanner (you know, for scanning barcodes), ConnectBot (for logging in to PCs via SSH), Dropbox (for sharing files), DroidWiki (for making awesome TiddlyWiki style notes), ES File Explorer (for browsing my files on the phone and on the LAN), Power Strip and Quick Settings (for quick access to various settings no matter what app you have open) and WaveSecure (for tracking my phone if it is lost or stolen and for backing up contacts online).

I hope you like the apps listed here. It is interesting to note that all the apps I have mentioned are paid-for. Whilst the majority of the apps mentioned here come in a “free” version, I find I like to thank the dev for all their hard work so am happy to upgrade to the fully featured versions.

Make Your Own Baby Night Vision Video Monitor…Again

2 08 2010

So, a while back, I posted about how to hack your own baby monitor. However, it was all fairly easy and didn’t require that much geekery. This time, however, I have gone all out and have produced what I think is a neat little set-up.

I am using a small thin-client PC, an HP T5700 with only a 750Mhz Transmeta Crusoe CPU and 512MB Ram. My PC is low-power and silent (perfect as it is running in our bedroom). I am also using a cheapo Nightvision Webcam from eBay (make sure it is true nightvision and not just some LEDs that you can turn on and off – the description needs to  say that the webcam uses IR LEDs and that they are “invisible to the human eye”) with a combined microphone.

To stream the video from the webcam, I use the rather excellent motion via sudo apt-get install motion. You’ll need to mess with the settings in motion.conf to activate the webcam server and to allow access from users other than localhost, for reference, here is mine. Then, all you need do is set motion running at boot, there is startup script included with motion when you install it, but I am pretty sure that is borked, so I just added “motion” to my /etc/rc.local file. Thus, to view the video, I simply browse to the http://IPADDRESSOFPC:8081, which is easily opened in VLC.

To stream the audio from the microphone on the webcam turned out to be a much more difficult process, as I detailed in the post prior to this one. Suffice to say, FFmpeg came to my rescue, so I simply run the command:

ffmpeg -f oss -i /dev/dsp -acodec libmp3lame -ab 32k -ac 1 -re -f rtp rtp://

at boot and my microphone is miraculously streamed to rtp://, which I can open in VLC (if you are using Linux, you have to use the most recent version of VLC, i.e. 1.1.1, previous versions don’t play well with rtp streams on Linux).

I use the following simple script on my laptop to view both streams, so I can see and hear our lovely daughter, even when she is sound asleep in a dark room:

echo "starting vlc"
VPID=( $(ps -e | grep vlc | awk '{print $1;}'))
if [ $? = 1 ];then
echo "error getting vlc PID, exiting"
while [ -n "$VPID" ];do
kill $VPID
VPID=( $(ps -e | grep vlc | awk '{print $1;}'))
cvlc &

echo video status $PID1
if [ "$PID1" == "1" ];then
echo "error starting vlc video"
vlc rtp:// --equalizer-bands="0,0,15,15,15,-20,0,0,0,0" &

echo audio status $PID2
if [ "$PID2" == "1" ];then
echo "error starting vlc audio"

This set-up has worked perfectly for the last week and even my wife appreciates my geeky skills on this one! Plus, I have a very small WiFi router (a La Fonera2) which makes the system completely portable, as the video feed can be viewed on pretty much any device. This now frees my IP webcams for the job they are much better suited for, home security. The end result are videos of this quality (to be clear, this is a freezeframe from the video feed, taken in a pitch black room):

So, why do all this? Well, for one, it can only up your geekery skills ;) But also, motion has some cool features, that, for example, let you take regular photos, allowing you to make cool time-lapse videos of your baby as she grows and develops (or sleeps through one night – man they move a lot). motion also has built-in motion detection (that is its main job) so I am sure you can configure it in such a way to act as an early warning system if the baby stops moving (I am thinking the horror that is cot-death here, but I have yet to fully look in to getting this to work yet). Also, if have a spare PC lying around that you can put aside for this, it means that in the future you can use that PC for other jobs as your baby gets older. I am planning to, for example, get a cheap touch screen monitor off eBay, to allow me to turn it into an interactive activity centre for our daughter, to help her learn numbers and the alphabet (there are already some great tools in Ubuntu for just this purpose, but I am learning Python and hope to program my own bespoke software for the job). You could add some speakers and use the PC to play soothing music to your baby to help her sleep or even go all out and hook up some kinda remote-controlled mobile. The options are endless and hopefully it’ll mean that once your baby is all grown up, she wont think of you as her embarrassing geeky mum / dad, but her “makes-really cool stuff for me to play with” mum / dad…. ;)

Stream Live Audio from a Microphone in Near Real Time in Ubuntu

2 08 2010

I have been endeavouring over the past few months to hack my own baby monitor. I initially kinda cheated, by using an IP-webcam.  However, that isn’t nearly as geeky as using a PC and USB webcam (plus, I also wanted night-vision, and IP-webcams with nightvision are not cheap). I got myself a cheap USB webcam from eBay that has six IR lights for nightvision and a built in mic. I’ll post later about sorting out the video feed, which turned out to be relatively easy. Sorting out the live audio feed turned out to be much harder.

My basic set-up is: a PC (I am using a small thin-client, so low-power and silent) running Ubuntu Lucid, a USB webcam with built in mic (with an audio output jack for the mic) and a wired connection to my LAN. I aim to listen to the audio on at least two separate PCs using VLC, so the format of the audio stream wasn’t much of an issue. It turned out to be much more difficult than I expected to get a real-time stream, as the latency with many options turned out to be terrible.

First, I needed to determine what the audio input was. As I had only installed a minimal install of Ubuntu, I needed to install ALSA, the linux sound architecture, via sudo apt-get install alsa-base alsa-utils. Next, I had to set up the mixer levels, since my PC is headless and I was doing this all via SSH, I used the ncurses alsamixer which allows you to set mixer levels via the command line. Don’t forget to run alsactl store afterwards to save your settings. As a result of doing all this, /dev/dsp now pointed to my microphone input.

Next, I needed a way of streaming the audio over my network. As I am a big fan of FFmpeg, that was my first choice, as it comes with a rather neat little streaming server called FFserver. FFserver works in the following way, you set up various streams using an ffserver.conf file, run the server and then run FFmpeg and direct FFmpeg’s output to FFserver. Here is the ffserver.conf file that I used.

After lots of trial and error, I eventually got this going using the FFmpeg command: ffmpeg -f oss -i /dev/dsp http://localhost:8090/feed1.ffm, but the latency was terrible, hitting almost 30 seconds. From what I can gather, FFserver doesn’t get nearly as much love as FFmpeg, the FAQ for FFserver freely admits that audio and video will drift out of sync alongside other issues, so I realised that FFserver was not for me.

Next, I tried using icecast2. Icecast is a streaming music solution, primarily designed to allow you stream music over a network, based on WinAmp’s Shoutcast technology, essentially making your own radio station. I used icecast2 in combination with darkice (since you need a program to send the audio to the icecast server, so it has something to stream). Darkice was perfect as it is designed to stream live audio from the audio input. Both programs are configured via xml files. Here is my icecast.xml and my darkice.xml. You’ll have to edit both these files somewhat, to make sure the log file location is correct for example. Due to the bizzare way that alsa sometimes works, /dev/dsp doesn’t always work. So in the case of darkice, I used hw:0,0 instead. This refers to the same thing, but in a different way it seems (the reasons for it go beyond me, I think it refers to the first card and the first input (the first being 0, the second being 1 etc)).

I would then run the icecast2 server using: icecast2 -b -c ~/icecast.xml and then darkice using: darkice -c ~/darkice.cfg. I had to run the darkice command using sudo, as there were some permission problems with accessing the mic input. This worked much better than FFserver, the delay was now down to about five seconds, but I got constant buffering issues, meaning the audio constantly cut off for ages. Also, over time, the delay would gradually get worse and worse, till it was as bad as the thirty second delay I got with FFserver. Once again, this wasn’t good enough.

My next effort was a complete hack, from the client PC that I wanted to listen to the audio on, I would run the following: ssh server 'cat /dev/dsp > /dev/dsp'. This would literally copy the input from the microphone on the server (my thin client) to the output of my local PC using SSH. Remarkebly, it worked as well as using icecast, but once again there were buffering issues, as I was trasnferring raw uncompressed audio.

So, my next option was using VLC. From doing lots of googling, I had read many people recommending it. My issue with VLC is that it is not a lightweight option and seemed somewhat overkill to me.

The huge advantage with VLC is that it acts as both client and server, taking the audio input and streaming it (although it actually does this using the Live555 streaming media module).

VLC also allows you to stream audio using various protocols; http, rtp, rtsp among others. Once again this wasn’t easy to get working, but after lots and lots and lots of trial and error, I finally came to the following command that worked for me: cvlc -vvv alsa://hw:0,0 --sout '#transcode{acodec=mp2,ab=32}/

:rtp{dst=,port=1234,sdp=rtsp://}' .

This basically takes the microphone input, transcodes it into an MP2 file (despite having FFmpeg installed, VLC would refuse to transcode to MP3) and then streams it via rtp to the address rtsp://

I then simply entered rtsp:// into the network stream input in VLC on the client PC and I got live audio, in near real time!! FINALLY!! The delay was about 1.5 seconds, it required very little bandwidth and seemed to work well…..for a while. Sadly, there were three problems with this. First; only one client could connect at a time, secondly; the stream would fail after a while, sometimes after five minutes, sometime after two hours, but it would always fail and third it would totally slaughter the CPU. Once again, this was no good for listening out for a crying baby.

Finally, I came to the perfect solution, funnily enough going full circle and using FFmpeg. From my googling of VLC and fixing stream dropouts with rtp, I found out that FFmpeg can stream via rtp nativley, with no need to use FFserver. I thought this couldn’t possibly work, but I tried it out using the following command: ffmpeg -f oss -i /dev/dsp -acodec libmp3lame -ab 32k -ac 1 -re -f rtp rtp:// This is similiar to the VLC command, except that this time I am converting into MP3 and streaming to the address: rtp:// Once again, all I need to do is enter rtp:// as the streaming source in VLC. There are a few huge advantages with this method, first, the CPU usage is only about 25% on my naff little 750Mhz Transmeta Crusoe. Second, it seems multiple clients can connect at once and third, it seems rock solid. I have had this command running for three days straight with no problems. Memory usage seems to creep up over time, but that’s about all. I still get the roughly 1.5 seconds latency, and that is rock solid, it never gets any worse than that over time. Finally, a solution that works. So now, I use the following script, that is run at boot, to stream live audio in real time over my LAN:

echo killing old ffmpegs

PID=( $(ps -e | grep ffmpeg | awk '{print $1;}'))
if [ $? = 1 ];then
echo "error getting vlc PID, exiting"
if [ ! -n "$PID" ];then
echo killing ffmpeg with PID $PID
kill $PID

echo starting ffmpeg
ffmpeg -f oss -i /dev/dsp -acodec libmp3lame -ab 32k -ac 1 -re -f rtp rtp:// 2> ~/ffmpeg.log &

echo ffmpeg started with PID $FF

This simply kills any other FFmpeg processes running and then starts a new FFmpeg process to stream the audio input (I kill old processes, so I can run this script if for some reason the stream fails and always be sure that only one instance of FFmpeg is running at any one time).

So, it took me about a month to get this far, but I am finally happy. There are other options that I also tried but could never get to work, such as the ability to share audio inputs using Pulse Audio (I got them to share, but it seemed to constantly crash my network) or using the Live555MediaServer directly (the one that powers VLC) or MPEG4IP but they both were poorly documented and were too complicated. I’ll write up about the video portion of this next, to show how I hacked my own baby monitor.


Get every new post delivered to your Inbox.