Lukas

Feb 082014
 

Last month we posted a gstreamer pipeline for avi playback and simply presumed a working gstreamer installation. Now we have added a couple of packages to our growing repository, that make it very easy to install.

The packages include the gst-omx module, which allows h264 de- and encoding with full use of the Raspberry Pi’s graphics hardware. But even with hardware support, the current stable series (1.2) doesn’t perform very well, because it does unnecessary copying of the video data. This is why these packages are based on the current development series (1.3), which means that they are not as mature and well tested as the slightly older 1.2 versions. But so far we haven’t run into any problems of that nature.

As a side note: The gstreamer versioning can be a little confusing. The packages you can find in software repositories are usually marked with “-0.10” or “-1.0”. The 1.x series is API and ABI stable and supersedes the previous stable 0.10 series and packages marked 1.0 can contain any version from the 1.x series.

The rest of the article will be about installing the packages, how to see if they work and a couple of things you can try if they don’t.

Installation

Add our repository and install gst-omx-1.0.

The omx plugins need GST_OMX_CONFIG_DIR to be set. You can do that temporarily like this:

export GST_OMX_CONFIG_DIR=/usr/etc/xdg/

or add the same line to your .profile as a permanent solution.

Test

You can use gst-inspect-1.0 to list all installed gstreamer plugins. Combine with grep and it’s easy to find out if gstreamer knows about the omx plugins:

gst-inspect-1.0 | grep omx

should give you something like this:

omx:  omxmpeg2videodec: OpenMAX MPEG2 Video Decoder
omx:  omxmpeg4videodec: OpenMAX MPEG4 Video Decoder
omx:  omxh263dec: OpenMAX H.263 Video Decoder
omx:  omxh264dec: OpenMAX H.264 Video Decoder
omx:  omxmjpegdec: OpenMAX MJPEG Video Decoder
omx:  omxvc1dec: OpenMAX WMV Video Decoder
omx:  omxh264enc: OpenMAX H.264 Video Encoder

To play a file you can use the previously mentioned pipeline:

gst-launch-1.0 filesrc location=test.avi ! avidemux ! h264parse ! omxh264dec ! autovideoconvert ! eglglessink

(Note that gstreamer is not a media player, but a framework that can be used by one. These commands are meant to support developers.)

Troubleshooting

Errors during playback

Make sure the memory split is generous with the video hardware, otherwise you may get seemingly random and unrelated errors during playback.

The omx plugins don’t show up

If gst-inspect-1.0 doesn’t show the plugins, try deleting gstreamers registry:

rm .cache/gstreamer-1.0/registry.armv6l.bin

Pipeline debugging

A very useful feature for debugging pipelines is the possibility to create a visual graph of the pipeline. Set GST_DEBUG_DUMP_DOT_DIR to a temporary directory before running the pipeline:

mkdir tmp
GST_DEBUG_DUMP_DOT_DIR=./tmp/

Gstreamer will dump a lot of debugging information in *.dot files in that directory. You can use dot from the graphviz package to create image files from those:

dot -Tpng x.xx.xx.xxxxxxxxx-gst-launch.FOO.dot > graph.png

Links

  1. gstreamer pipeline for avi playback
  2. list of packages in our repository
  3. gstreamer project website
  4. streaming H.264 via RTP
  5. slightly outdated but useful StackExchange
  6. Raspberry Pi forums
Oct 082013
 

There have been a couple of posts here about the TP-Link TL-WN725 wireless adapter and its problems (see here for details). This post will give instructions on how to use the pi3g package repository to install the driver. This means that if you’re running Raspbian, you don’t have to compile anything and will receive updates to this and other packages automatically.

My Pi crashes when I plug in the adapter, even on a clean Raspbian install. So don’t plug it in when you have important stuff running. Plugging it into a powered usb hub seems to be safe though.

The quick version

Add our repository (repository.pi3g.com) and install rtl8188eu.

The long version

Add the pi3g repository

Adding the repository is pretty easy and, in principle, works the same as for every other software repository. Create the file /etc/apt/sources.list.d/repository.pi3g.com.list with the following line:

deb http://repository.pi3g.com/debian/ wheezy main

A quick way to do that is this command:

sudo wget -O /etc/apt/sources.list.d/repository.pi3g.com.list http://repository.pi3g.com/sources.list

Then add our public key, which will ensure the packages are not intercepted and altered during download. The command apt-key add <keyfile> will let you do just that. Or in one command:

wget -O - http://repository.pi3g.com/pubkey | sudo apt-key add -

Install the driver package

First make sure your system is up to date:

sudo apt-get update
sudo apt-get upgrade

(It’s a good idea to run these two commands every now and then so your system doesn’t fall too far behind.)

Then simply install the package rtl8188eu like any other package. For example with this command:

apt-get install rtl8188eu

Load the module

The module should load automatically on reboot or whenever the device is plugged in. To load it manually run:

sudo modprobe 8188eu
Optimization WordPress Plugins & Solutions by W3 EDGE