RasPi in the Sky – gstreamer first steps

See this for an explanation of the name 🙂

I did a bit of research around video streaming on the pi and there seem to be several methods used including using VLC or netcat or various other methods but they all seemed to be a little bit high latency and as we are going to be doing live video to a screen we want to keep that down so I went with Gstreamer.

The first page I came across seemed to be ideal :  http://pi.gbaman.info/?p=150  and this got me up and going but I ran into issues with the sending and listening commands.  http://blog.tkjelectronics.dk/2013/06/how-to-stream-video-and-audio-from-a-raspberry-pi-with-no-latency/ helped with sending but as the commands on both pages were for listening using a Mac I was out of luck.  After a quick poke around mailing lists and google fu I have now got it up and running.


So after setting up the environment as described in either of the above I have  been using the following commands.  I am not a gstreamer scientist and there are probably much better ways of doing it but this seems to be working here.

Sending Pi (pivate-eye) note you will have to change the IP address

raspivid -t 999999 -w 1080 -h 720 -fps 25 -hf -b 2000000 -o - | gst-launch-1.0 -v fdsrc ! h264parse ! rtph264pay config-interval=1 pt=96 ! gdppay ! tcpserversink host= port=5000 is the address of the sending pi.

On the listening pi (pi-tv) watch out for the ip address in it

gst-launch-1.0 -v tcpclientsrc host= port=5000 ! gdpdepay ! rtph264depay ! h264parse ! omxh264dec ! videoconvert ! autovideosink sync=false



I have done some quick tests as to the latency of the video link and how it changes with resolution.   These are only very quick tests so may not be that accurate.  The methodology was to put a stopwatch on screen, stream the screen via the webcam with both the onscreen clock and the video playback of the clock visible then to take a picture using a digital camera and then just subtract the differences between the clocks.

320 x  240 = 176 ms

640 x 480 = 137 ms

800 x 600 = 325 ms

As you can see this doesn’t quite look right but it was just a quick test just to get some ballpark figures.  I have also not run multiple tests over time to see if there is drift in the lag so there is a lot more work required here. Oh and also there is a good chance that my gstreamer commands could be optimised and improved.

Also can I just say a big thanks to Odie_ on #raspberrypi on Freenode who correctly spotted I hadn’t checked my camera when I couldn’t get it working and suggested the latency methodology and generally kept prodding me until I got it working and documented on the net 🙂

New Project : Pi in the Sky!

I was asked by the nice folk at Red Spider Hire if I fancied going up in one of their fantastic machines to take some pictures at the village show.  I was totally up for this until I realised it clashed with the date of a friends birthday party.   Something needed to be done.

So I decided to replace myself with a couple of Raspberry Pi machines 🙂

The plan:

Get the first Pi (pivite-eye) with the CSI Raspberry Pi camera to stream live video to the second Pi (pi-tv) where it will be displayed on a monitor or projector or something.   Pi-TV and Pivate-eye will communicate over wifi provided by a MiFi wireless 3G access point.   This will also allow Pi-TV to take screenshots and post them to twitter etc and any other sillyness.


  • Getting it to work!
  • Video resolution vs latency
  • Video resolution vs bandwidth
  • Automating the setup so it can be setup or reset without my intervention.
  • Automating video snapshotting
  • Automating twitter posting
  • Weatherproofing


ls : short and slightly odd (bit like me)… .

A collegue pings me this morning to say he is having a bit of an odd time with a script erroring out, no problem I think. This is the simplified version as in the setup we saw this we had long paths and remote filesystems to lure us down blind alleys of permissions etc. We look at the log and it says (rebuilt a dummy setup of a layout that will show the issue so ignore the 0 file sizes) :

FATAL: No such file or directory opening: < /home/tig/test/1043_states.txt
Bit obvious I thought, and then it gets odd, he then runs :

ls /home/tig/test/1043_states.txt
ls: cannot access /home/tig/test/1043_states.txt: No such file or directory

Makes sense

tig@ubuntu:~/test$ ls -la
total 0
drwxr-xr-x 6 tig tig 592 2011-01-27 10:08 .
drwxr-xr-x 6 tig tig 856 2011-01-27 10:07 ..
drwxr-xr-x 2 tig tig 160 2011-01-27 10:07 1031_001
drwxr-xr-x 2 tig tig 160 2011-01-27 10:07 1033_001
drwxr-xr-x 2 tig tig 232 2011-01-27 10:09 1043_001
-rw-r--r-- 1 tig tig 0 2011-01-27 10:08 1043.bar
-rw-r--r-- 1 tig tig 0 2011-01-27 10:08 1043.foo
drwxr-xr-x 2 tig tig 160 2011-01-27 10:08 2057_002

All looks fine, the file is just not there, but he then says, "if I do" :

tig@ubuntu:~/test$ ls -la /home/tig/test/1043_*
total 0
drwxr-xr-x 2 tig tig 232 2011-01-27 10:09 .
drwxr-xr-x 6 tig tig 592 2011-01-27 10:08 ..
-rw-r--r-- 1 tig tig 0 2011-01-27 10:09 1043_state.txt

Pardon? wtf did that come from? He then did :

tig@ubuntu:~/test$ ls /home/tig/test/*.txt
ls: cannot access /home/tig/test/*.txt: No such file or directory

ls, bless it's little cotton socks has been helpful... it was only when I did (note I removed the underscore) :
tig@ubuntu:~/test$ ls /home/tig/test/1043*
/home/tig/test/1043.bar /home/tig/test/1043.foo


Do we see what is going on, ls matched the 1043_ with the 1043_001 directory and then hides it and shows you the matching result from within it, if only seems to be if there is a match in the current directory (or more than one matching directory) does it actually tell you the directory it is in...

All this before I had chance to put the kettle on...

ADW.Launcher Crash!

ADW.Launcher is a wonderful application that replaces the home screen on Android and for us poor G1 owners, adds loads of features found in later versions of Android 🙂

This morning I turned my phone on and nothing, black blank screen, there is the status bar but nothing else 🙁 Could not load any apps or anything! HELP!

At this point I thought I was going to have to do a hard reset to get it back. Fortunately I decided to put it down and have a think before doing anything rash. What I needed to do was get into the Settings menu, but how?

The keyboard shortcuts was the key (if you forgive the pun) sadly there is no shortcut to the settings but it can be done.

Slide the keyboard out and press the Menu key and the B key. This brings up the browser, then press the search key (magnifying glass) button twice, this brings up the Search dialog box then type in Settings. Then a drop down search results box will appear and then you can select “Settings (Application)”. Then go into Applications -> ADW.Launcher and then in the Defaults part, click the Clear Defaults option. Then when you press the home button you can select Home instead of ADW.Launcher 🙂


I then re-installed ADW.Launcher and everything is back to normal, lost the ADW.Launcher settings but I would rather have that that a hard reset.

BackupExec RALUS Woes

This had me tearing my hair out…. Jobs on some OpenSuSE machines were failing with :

Job ended: 14 June 2010 at 14:31:02
Completed status: Failed
Final error: 0xe00084af – The directory or file was not found, or could not be accessed.
Final error category: Job Errors

For additional information regarding this error refer to link V-79-57344-33967

and on a diff server :

Job ended: 14 June 2010 at 00:51:39
Completed status: Failed
Final error: 0xe0008488 – Access is denied.
Final error category: Security Errors

For additional information regarding this error refer to link V-79-57344-33928

Click an error below to locate it in the job log
Backup- \\\[ROOT] V-79-57344-33928 – Access is denied.
Access denied to directory /.

Security errors? Access is denied? After a bit of digging I then went to the Backup Sources selection and tried to check credentials. This oddly connected to the machine but then on the next line failed to connect to the selection (v.odd especially as it uses the same connection for both). Anyhoo, after much hair pulling I discover that an NFS share, that is not part of any backup selection, was unmounted (it was non-production and I had taken it offline to do some work on it). This makes the RALUS agent fail. Interestingly it is not quite as clean cut as this as on one server it got about half way through before failing and on another it fails immediately with a “security error”!

So if you have any of the above messages, check for missing mounted disks or drives and make sure they are properly unmounted and also comment them out of /etc/fstab just incase.

I know I should have done that anyway before doing the maintainance but I in hindsight, if anything is going to bite you it will be RALUS/BackupExec 🙂

Grepping Hell

Well that was a tad embarrassing I thought I had lost the ability to grep. All I wanted to do was find any instances of jt1.name in files in the current directory, simple I thought :
grep jt1.name *

That returned loads of hits that didn’t match at all eg :

modules/UpgradeWizard/commit.php:$from_dir = clean_path(remove_file_extension($install_file) . "-restore");
modules/UpgradeWizard/SugarMerge/EditViewMerge.php: * this will store the meta data for the original file
modules/UpgradeWizard/SugarMerge/EditViewMerge.php: * this will store the meta data for the new file
modules/UpgradeWizard/SugarMerge/EditViewMerge.php: * this will store the meta data for the custom file
modules/UpgradeWizard/SugarMerge/EditViewMerge.php: * this will store an associative array contianing all the fields that are used in the original meta data file
modules/UpgradeWizard/SugarMerge/EditViewMerge.php: * this will store an associative array contianing all the fields that are used in the new meta data file
modules/UpgradeWizard/SugarMerge/EditViewMerge.php: * this will store an associative array contianing all the fields that are used in the custom meta data file
modules/UpgradeWizard/SugarMerge/EditViewMerge.php: * this will store an associative array contianing all the merged fields
modules/UpgradeWizard/SugarMerge/EditViewMerge.php: * Merges the fields together and stores them in $this->mergedFields
modules/UpgradeWizard/preflight.php: //Check the current and target versions and store them in session variables
modules/UpgradeWizard/silentUpgrade.php://look for session vars there and restore them
modules/UpgradeWizard/uw_ajax.php: $desc .= $persistence['uw_restore_dir']."\n\n";
modules/UpgradeWizard/uw_utils.php: * Backs-up files that are targeted for patch/upgrade to a restore directory
modules/UpgradeWizard/uw_utils.php: // create restore file directory
modules/UpgradeWizard/uw_utils.php: $_SESSION['uw_restore_dir'] = clean_path($rest_dir);
modules/UpgradeWizard/uw_utils.php: // get name of current file to place in restore directory
modules/UpgradeWizard/uw_utils.php: // only copy restore files for replacements - ignore new files from patch
modules/UpgradeWizard/uw_utils.php: $desc .= $_SESSION['uw_restore_dir'] . "\n\n";
modules/UpgradeWizard/uw_utils.php: if(isset($_SESSION['uw_restore_dir']))
modules/UpgradeWizard/uw_utils.php: unset($_SESSION['uw_restore_dir']);
modules/Meetings/Meeting.php:// Meeting is used to store customer information.

Pages of this came up. When I found the culprit I nearly fell off my chair, some fluffy-kittening person at SugarCRM decided that when doing an upgrade they would make a backup unfortunately they made an interesting choice of names…

drwxrws--- 3 www-data www-data 4096 Jan 12 10:42 -restore
drwxr-xr-x 19 www-data www-data 4096 Mar 9 16:43 .
drwxr-xr-x 3 root root 4096 Jan 23 2009 ..
-rw-r--r-- 1 www-data www-data 342 Mar 9 16:43 .htaccess
-rw-r--r-- 1 www-data www-data 2535 Mar 9 16:43 HandleAjaxCall.php
-rw-r--r-- 1 www-data www-data 155 Dec 17 2008 INSTALLATION.txt
-rw-r--r-- 1 www-data www-data 35147 Dec 17 2008 LICENSE.txt
drwxr-xr-x 3 www-data www-data 4096 Oct 22 14:52 ModuleInstall
-rw-r--r-- 1 www-data www-data 5075 Dec 17 2008 SugarSecurity.php
-rw-r--r-- 1 www-data www-data 5590 Dec 17 2008 TreeData.php
-rw-r--r-- 1 www-data www-data 2488 Mar 9 16:43 WebToLeadCapture.php
drwxr-xr-x 2 www-data www-data 4096 Dec 17 2008 XTemplate
-rw-r--r-- 1 www-data www-data 2490 Dec 17 2008 acceptDecline.php
drwxr-xr-x 17 www-data www-data 4096 Mar 9 16:44 cache

That explains why it recursed too…. I didn’t think you could add flags after the search string…

Openfire Increasing Java Memory Limits Debian/Ubuntu

Openfire ships with a 64Meg  JVM limit which is fine for testing purposes but you may find that you are using it all up.    I went round the forums a few times and found conflicting advice.

Anyhoo the instructions were close but seemed to give one massive red-herring which was they kept talking about OPENFIRE_OPTS in /etc/defaults/openfire which did not exist,   add it your self and Openfire will ignore it.    Where the data needs to go is in DEAMON_OPTS.

To cut a long story short you need to make /etc/defaults/openfire look like :

# Defaults for openfire initscript
# sourced by /etc/init.d/openfire
# installed at /etc/default/openfire by the maintainer scripts

# This is a POSIX shell fragment

# Additional options that are passed to the Daemon.
DAEMON_OPTS=”-Xms256m -Xmx512m”

This will tell the JRE to use a minimum of 256Meg RAM and limit it to 512Meg.

Hope this helps 🙂

A quick note on RedHat x64 from Mike (Hi Mike 🙂 )
(slightly edited from an Openfire conversation for clarity and so it makes sense without the other bits!)

you said that on Ubuntu the default OPENFIRE_OPTS didn’t work and you had to change it to DAEMON_OPTS, OPENFIRE_OPTS works fine on CentOS 6.0 x64


I had to add libldb.i686 for openfire to work on CentOS-64 bit. 32-bit was fine, just the 64-bit version required it

Cheers Mike,  so just leave it alone for CentOS but install libldb.i686 if you are running the 64 bit version.

OpenFire XMPP Server on Debian

I was asked today to set up an IM server for internal use,   originally they were specifying Windows messanger but I was able to suggest we try a proper standards based system instead 🙂

So I need a server,  a few clicks in the Proxmox interface ( a rather nice way of handling OpenVZ virtualisation) and I have a new blank Debian lenny box already to play with.

Added the non-free option to the apt repository (as we will need the Sun JRE) and off we go :)   Apt decided to moan about :

W: There is no public key available for the following key IDs:
W: GPG error: http://security.debian.org lenny/updates Release:
The following signatures couldn't be verified because the public
key is not available: NO_PUBKEY 9AA38DCD55BE302B

Which was solved by this post here 🙂

A quick :

apt-get install debian-archive-keyring

and off we go again 🙂

Next stop is the Java monster,  mercifully simple to install nowadays:

apt-get install sun-java6-jre

Next we grab the latest openfire deb,   then install:

dpkg -i openfire_3.6.4_all.deb

Which seemed to be too painless…

Fire up the Wizard on port 9090 from a browser and you are done 🙂


Yes ladies, gentlemen and chinny racoons,  LRL 2009 is scheduled for :

Lugradio Live 2009, 24th October 2009,  Newhampton Arts Centre Wolvehampton

To put this countdown on your site is simple,  just copy and paste the following code :

<a href="http://www.lugradio.org/live/2009/" target="_blank"><img style="border: 0pt none ;" 
alt="Lugradio Live 2009, 24th October 2009,  Newhampton Arts Centre Wolvehampton" width="237" height="251"></a>

There will be more styles and options and of course the code to run the counter yourself to follow 🙂

Ubuntu on the Eeee battery life

Well the battery monitor app either needs housetraining or something as it bounces up and down more than I do 🙂

10 mins ago it told me I had 6 mins remaining and now it has crept back up again 🙂

Currently :

tigger@eee:~$ uptime
12:13:00 up 2:39, 2 users, load average: 0.66, 0.50, 0.47

This is sitting in the pub (tea and orange juice sadly) waiting for my car to be fixed. So well over two and a half hours of wibbling and wifi on a low backlight and it has not run out yet. Battery monitor still says 10% remaining but now thinks that will only last 5 mins!

Something is amiss here 🙂

edit : right in the end it lasted about 3 hours or so but then died with no warning just a sudden power off.   It had warned me I was low on power earlier but not right at the end.  It might be that it has not had time to profile the power use yet but although it is a bit flakey it seems to be slightly more useful than the Xandros one which I never did trust.