Apr 212014
 

First of all, remove xpra and cython if you had them installed:

aptitude purge xpra cython

Update your package lists, as we are going to install a lot of packages:

aptitude update

Prepare required prerequisites

Then follow the instructions on the xpra Wiki for building Ubuntu / Debian style:

apt-get install libx11-dev libxtst-dev libxcomposite-dev libxdamage-dev \ python-all-dev python-gobject-dev python-gtk2-dev

apt-get install xvfb xauth x11-xkb-utils
apt-get install libx264-dev libvpx-dev libswscale-dev libavcodec-dev

The file mentioned in the how-to, vpx.pc should exist:

cat /usr/lib/pkgconfig/vpx.pc

You will need to install and compile Cython from sources, as the version in the Raspbian repository is too old (0.15.1 vs. 0.16 minimum needed).

wget http://www.cython.org/release/Cython-0.20.1.tar.gz
tar -xzf Cython-0.20.1.tar.gz

change into the newly extracted directory. Install cython:

python setup.py install

This will take quite a while. Test that you have the correct cython version:

cython --version

should yield Cython version 0.20.1

Download and extract source

wget https://www.xpra.org/src/xpra-0.12.3.tar.bz2
tar -xjf xpra-0.12.3.tar.bz2

Note: there may be a newer package, check, please.

Change into the extracted directory. We need to apply a patch:

patch < patches/old-libav.patch

Enter xpra/codecs/dec_avcodec/decoder.pyx as the file to patch

Next patch (several files in one go):

patch < patches/old-libav-pixfmtconsts.patch

Simply copy and paste the “Index file” the patcher asks for, for example xpra/codecs/csc_swscale/colorspace_converter.pyx

Next patch (also several files):

patch < patches/old-libav-no0RGB.patch

Act like above (copy & paste file name, without leading / ).

It also contains a useful README, which tells you the next step is:

./setup.py install --home=install

After the compilation is done, you should either (always) set the Pythonpath to include the install subdirectory, like this:

export PYTHONPATH=$PWD/install/lib/python:$PYTHONPATH

or install the “finished” files to the appropriate targets. From the install directory do:

cp bin/* /usr/bin/.
cp -R lib/* /usr/lib/.
cp -R share/* /usr/share/.

xpra will now be the newest version:

xpra –version

xpra v0.12.3

You will still have to set the PYTHONPATH to the new files in /usr/lib/python, though:

The PYTHONPATH environment variable needs to be set:

export PYTHONPATH=/var/lib/python:$PYTHONPATH

 

Test & Test results

OK, here’s how to set up a test session:

Set up a test server, which has xpra installed (you can install it through the winswitch packages, will get you the newest xpra version on Ubuntu & Debian)

Start X Windows, open LXTerminal, run the following commands.

export PYTHONPATH=/var/lib/python:$PYTHONPATH

Start an xpra session via SSH (can be killed using Ctrl-C, and reconnected to using the same command):

xpra start ssh:maxcs@192.168.1.61:122 –start-child=xterm –encoding=h264

Read the manpage (man xpra) to have a look at some other options

Test results

xpra-raspberry-h264

rgb, png encodings are too high-latency.

jpeg is barely usable, even when resizing the application (for instance Abiword) to not full-screen usage.

webm encoding delivers worse quality, but seems a bit more usable

h264 decoding is NOT done in hardware in the default code (we’ll look into this). Surprisingly it is still the “most fluid to use” one.

I suspect that no decoding in H.264 is taking place, and server side xpra falls back to a different encoder (webm?) Anyways, one can even “watch” videos (a couple of frames each second with heavy artifacts) with this.

For very light administration / checking of remote contents, etc. xpra can be used as is. We will need to enable hardware decoding of h264, though, for it to yield real benefits.

Please note: our interests solely rest in streaming TO the Raspberry Pi, not FROM the Raspberry Pi – we will not test / patch in order to speed up administration of the Pi at this point.

 

Notes & Further reading

Dependencies of xpra package:

(you can show this using “apt-cache showpkg xpra” on a machine which has the package in the newer version, e.g. Ubuntu AMD64):

Dependencies:
0.12.3-1 – python2.7 (0 (null)) python (2 2.7.1-0ubuntu2) python (3 2.8) libavcodec53 (18 4:0.8-1~) libavcodec-extra-53 (2 4:0.8-1~) libavutil51 (18 4:0.8-1~) libavutil-extra-51 (2 4:0.8-1~) libc6 (2 2.14) libgtk2.0-0 (2 2.24.0) libswscale2 (18 4:0.8-1~) libswscale-extra-2 (2 4:0.8-1~) libvpx1 (2 1.0.0) libx11-6 (0 (null)) libx264-120 (0 (null)) libxcomposite1 (2 1:0.3-1) libxdamage1 (2 1:1.1) libxext6 (0 (null)) libxfixes3 (0 (null)) libxrandr2 (2 4.3) libxtst6 (0 (null)) python-gtk2 (0 (null)) x11-xserver-utils (0 (null)) xvfb (0 (null)) python-gtkglext1 (0 (null)) python-opengl (0 (null)) python-numpy (0 (null)) python-imaging (0 (null)) python-appindicator (0 (null)) openssh-server (0 (null)) python-pyopencl (0 (null)) pulseaudio (0 (null)) pulseaudio-utils (0 (null)) python-dbus (0 (null)) gstreamer0.10-plugins-base (0 (null)) gstreamer0.10-plugins-good (0 (null)) gstreamer0.10-plugins-ugly (0 (null)) python-gst0.10 (0 (null)) openssh-client (0 (null)) ssh-askpass (0 (null)) python-numeric (0 (null)) python-lz4 (0 (null)) keyboard-configuration (0 (null)) xpra:i386 (0 (null))

CheckInstall

Optional: install checkinstall, to create a package which you can easily remove or re-deploy to other computers:

aptitude install checkinstall

 

Troubleshooting

Patches

error: implicit declaration of function ‘avcodec_free_frame’

you need to apply the patch patches/old-libav.patch

error: ‘AV_PIX_FMT_YUV420P’ undeclared

you need to apply the patch patches/old-libav-pixfmtconsts.patch

error: ‘PIX_FMT_0RGB’ undeclared

you need to apply the patch patches/old-libav-no0RGB.patch

The other patches were NOT needed in my experimental compilation.

 

ImportError: No module named xpra.platform

Once you try to execute xpra (from LXTerminal preferably), you may get this message. The PYTHONPATH environment variable needs to be set:

export PYTHONPATH=/var/lib/python:$PYTHONPATH

Jan 142013
 

… which are not encoded. That (sadly) rules out commercial discs … at the moment – a solution should be available soon. But – the power to play BluRay is there. Read on for a how-to and for a test ISO you can test your Pi with.

Blu-ray_disc_(BD-RE)

How-To

  • We used our BluRay burner to burn a BluRay ISO with unencoded content (see below for more information about it)
  • To play the disc we used (the newest) BerryBoot with OpenELEC. Other distributions, like Raspbmc may also work – we’re interested in your feedback!
  • And an external powered USB Hub (important!) to provide sufficient power to the BluRay burner
  • Of course we use only 512 MB Raspberry Pi’s for our tests. The same ones you can buy from our shop.
  • BluRay decoding needs VC-1 and MPEG-2 codecs (both are in the standard). You can buy a codec package for the Raspberry Pi from our store. Please note, that the disc we have tested with could work without the codecs, as it is being encoded to MPEG-4 (which is available in hardware by default).
  • For good performance it is important to give the GPU more RAM. Else you may see buffer underruns and sluggish playback. We saw good results with a memory split of 256 MB / 256 MB:

Add to your config.txt:

gpu_mem=256

  • The title content may playback when you press the “Play Disc” menu entry
  • OpenELEC does not support the BluRay menus on the Raspberry Pi (yet). Thus, you will need to play the other titles on the disc manually.
    • Enter the Videos -> Files menu, select the BluRay (i.e. “x264 Demo Blu-Ray”),
    • Select the “BDMV” folder
    • Select “STREAM”
    • Here are the BluRay’s Video Streams. Open and play by doubleclicking.

Our test BluRay

A developer working on x264 (a free encoder to encode content into MPEG-4 AVC), has released a BluRay image containing open material (Big Buck Bunny, Elephants Dream, and live action footage by Microsoft). This image is a bit over 2 GB in size, and can also be burned to a blank DVD disc. If burned to DVD, most BluRay players should still recognize it as BluRay (because of the special format). We have used a blanc BluRay to burn to, and test with.

Click here for the full article.

Download ~ 2 GB (Torrent – you need a Torrent client to download this!)

Q&A

Is USB 2.0 fast enough for BluRay playback?

USB 2.0 has a data rate of 480 MBit/s. The content stream of a BluRay, including all camera perspectives and audio tracks is limited to a data rate of 54 Mbit/s, or “1,6 x speed” – which has to be supported by all BluRay video playback hardware.

“1 x speed” equals a data rate of 36 Mbit/s. 6 x speed (the max. speed our BluRay writer can read) equals 216 Mbit/s. Thus USB 2.0 has more than ample resources to handle BluRay playback and burning, even if you consider protocol overhead and other devices on the same bus (i.e. the LAN of the Raspberry Pi).

Will I be able to play my commercially bought BluRay movies on the Raspberry Pi?

Not directly. The movies are encoded, and the keys are available to certified software / hardware vendors only. Even if the keys were known (some of them are), the ARM processor of the Raspberry would need to decode the stream. I am currently not sure, whether it is “fast enough” to do it. (the video is decoded in hardware, but maybe the Broadcom SoC also has some BluRay decoding capabilities?)

There are reports of software which allows you to back up your BluRay Discs. These backed up files should play on the Pi, although we have not tested that yet. Have a look at this guide.

Does OpenELEC support the BluRay audio formats?

We have the following codecs working:

  • DTS  HD Master Audio
  • Dolby Digital

which is used on over 50 % of BluRays, according to Wikipedia. We still have to test the other codecs.

Optimization WordPress Plugins & Solutions by W3 EDGE