video player on Raspberry Pi

RPi sunning OpenELEC plugged in an old Sony Trinitron monitor
RPi running OpenELEC plugged in an old SONY Trinitron monitor

I made few tests with chnry on how to play movies with Raspberry Pi

we did the tests with a fresh Raspbian install and up-to-date
Raspbian comes with an integrated player dedicated to RPi : omxplayer
This uses hardware video decoding so it can play full HD h264 encoded film without lag.
The same is not possible with VLC (which only uses CPU decoding) we can’t find any codec which VLC can play smoothly but maybe it’s possible with a non CPU-expensive and small bandwidth codec.

Also we can heard some clicks on the analog output of the RPi when openning and closing omxplayer.
We guess this is due to the powering of the hardware but I think it could be handle on the software side.
For example, when Pd is sending some sound, and if we start playing a film with omxplayer we do hear clicks unless the sound card is powered.
Omxplayer seems to reset the sound card without regarding its state, so i think this is a bug.

So VLC is out on RPi, let’s try to control omxplayer over a network.
The simple way we find is using the udpreceive utility (which comes with puredata) and forwarding its output to bash.
On the RPi :
pdreceive 3434 udp | bash
and on the client :
echo omxplayer video.mp4 \& | pdsend 3434 192.168.11.11 udp

3434 is the port number
192.168.11.11 is the RPi’s IP
video.mp4 is the video we want to play (located in the RPi’s home)
\& go back to prompt just after starting omxplayer thus we can send other commands like killall omxplayer.bin to stop the player.

When no video is playing you will see either the command line or the LXDE interface.
With LXDE, you can set a black desktop, hide the menu bar and make the mouse disappear (with unclutter tool).

Next I will test how longer severals RPi can stay in sync and also I’ll take a look at XBMC with OpenELEC.

pix_freenect on Ubuntu 12.04

pix_freenect is one of the pd/Gem objects by Matthias Kronlachner to use Kinect sensor.
It’s not so simple to make it run on Ubuntu 12.04 64bit.
Here is a sum up of what I should do to make it work.
get the last libfreenect from git and make it (as the libfreenect package seems to not work with Matthias external) :
git clone https://github.com/OpenKinect/libfreenect.git
cd libfreenect
mkdir build
cd build
cmake ..
make
sudo make install

On my 64bit system, cmake puts the libs strangly in /usr/local/lib64 instead of /usr/local/lib. I moved all the files to /usr/local/lib, you can also make symbolic links.

I have to blacklist gspca modules to use the Kinect with freenect. I had a file named blacklist-gspca-kinect.conf in /etc/modprobe.d with that :
blacklist gspca_kinect
To prevent gspca module from loading on next reboot and to remove the module without rebooting :
sudo modprobe -r gspca_kinect

Now, get the latest pix_freenect code and make it :
git clone git://github.com/kronihias/pix_freenect.git
cd pix_freenect
mv Makefile Makefile_osx
mv Makefile_linux Makefile
make PD_DIR=/path/to/pd GEM_DIR=/path/to/Gem

You can also edit the Makefile and set the variables there. For me, the build failed because of unrecognized gcc arg : –export_dynamic. I edited the Linux LDLAGS variable on line 23 and replace by :
LDFLAGS = -shared -rdynamic
Make again and it should be ok. For now, pix_freenect can’t initialize when no Kinect is connected or if a wrong ID is set with arguments.