The guys working on the Raspberry Pi (mainly dom) have added preliminary support for VP6, VP8, MJPEG, and Ogg Theora free video codecs, as well as Ogg Vorbis audio codec. Unlike H.264, MPEG-2 and VC1, those are not handled by the hardware video decoder in Broadcom BCM2835 processor, but are accelerated by the Videocore GPU. This means that only SD (and possibly 720p) videos are supported for those codecs.
The best way to get support is probably to patiently wait for the Raspberry Pi foundation to release a new Raspbian image, but in case you couldn’t possibly wait, here are the steps to follow:
- Download and run Hexxeh’s rpi-update script in the Raspberry Pi in order to get the very latest build:Shell123wget https://github.com/Hexxeh/rpi-update/raw/master/rpi-updatechmod 755 rpi-updatesudo ./rpi-update
- Add the following two lines to /boot/config.txt:Shell12start_file=start_x.elffixup_file=fixup_x.elf
- Reboot the Raspberry Pi
- The GPU firmware is now updated, but you still need the latest version of omxplayer. You have two choices:
- Wait for the next build to be available on http://omxplayer.sconde.net/ (should be there in a few days).
- Build it yourself.
- I chose number 2 :). We’ll cross-compile omxplayer since we don’t have all day (and maybe more). First get the Rpi toolchain in a Linux build machine (Ubuntu 12.04 64-bit in my case):
mkdir -p /usr/local/bcm-gcc
sudo git clone git://github.com/raspberrypi/tools.git
- We need a root file system for the build. Since we may need to install missing packages, I’ll run an NFS server in the Raspberry Pi and access the rootfs via NFS. So let’s configure the Raspberry Pi as a NFS server first:Shell123sudo apt-get install nfs-kernel-server nfs-common rpcbindsudo dpkg-reconfigure rpcbindsudo /etc/init.d/rpcbind restart
Then edit /etc/exports as root (sudo) and add the line:Shell1/ 192.168.0.0/24(rw,no_root_squash,async,no_subtree_check)
Then restart the NFS serverShell12sudo /etc/init.d/nfs-kernel-server restartsudo exportfs -a
- Now let’s mount the NFS share in the build machine:Shell123mkdir ~/edev/rpi/nfssudo apt-get install nfs-clientsudo mount -t nfs 192.168.0.107/ ~/edev/rpi/nfs
- Let’s retrieve omxplayer source code:Shell12git clone git://github.com/huceke/omxplayer.gitcd omxplayer
- Modify Makefile.include as follows:USE_NFS=1
ifeq ($(USE_NFS), 1)
endifJOBS=8CFLAGS := -isystem$(PREFIX)/include
CXXFLAGS := $(CFLAGS)
CPPFLAGS := $(CFLAGS)
LDFLAGS := -L$(BUILDROOT)/lib
LD := $(TOOLCHAIN)/bin/$(HOST)-ld –sysroot=$(SYSROOT)
CC := $(TOOLCHAIN)/bin/$(HOST)-gcc –sysroot=$(SYSROOT)
CXX := $(TOOLCHAIN)/bin/$(HOST)-g++ –sysroot=$(SYSROOT)
OBJDUMP := $(TOOLCHAIN)/bin/$(HOST)-objdump
RANLIB := $(TOOLCHAIN)/bin/$(HOST)-ranlib
STRIP := $(TOOLCHAIN)/bin/$(HOST)-strip
AR := $(TOOLCHAIN)/bin/$(HOST)-ar
CXXCP := $(CXX) -E
PATH := $(PREFIX)/bin:$(BUILDROOT)/output/host/usr/bin:$(PATH)
CFLAGS += -pipe -mfloat-abi=$(FLOAT) -mcpu=arm1176jzf-s -fomit-frame-pointer -mabi=aapcs-linux -mtune=arm1176jzf-s -mfpu=vfp -Wno-psabi -mno-apcs-stack-check -O3 -mstructure-size-boundary=32 -mno-sched-prolog
LDFLAGS += -L$(SDKSTAGE)/lib -L$(SDKSTAGE)/usr/lib -L$(SDKSTAGE)/opt/vc/lib/
INCLUDES += -isystem$(SDKSTAGE)/usr/include -isystem$(SDKSTAGE)/usr/include/arm-linux-gnueabihf -isystem$(SDKSTAGE)/opt/vc/include -isystem$(SYSROOT)/usr/include -isystem$(SDKSTAGE)/opt/vc/include/interface/vcos/pthreads -isystem$(SDKSTAGE)/usr/include/freetype2
You’ll need to change NFSROOT variable to where you mounted the NFS share.
- We’re now ready to cross-compile omxplayer:Shell123make ffmpegmake -j8make dist
This will create a omxplayer-dist.tar.gz that you can copy in the Raspberry Pi:Shell1sudo cp omxplayer-dist.tar.gz ~/edev/rpi/nfs/
There may be missing dependencies during the build. If it’s the case, you need to install some development package in the Raspberry Pi. Refer to my “How-to fix common build error tutorials“, if the build fails.
- Back to the Raspberry Pi, let’s install it:Shell1234cd /tar xzvf omxplayer-dist.tar.gzcd omxplayer-distsudo cp * / -rf
That’s all. Now we can try the files tested by dom:
- big_buck_bunny_trailer_480p.webm – VP8 video
- trailer_400p.ogg – Ogg theora video
- trailer_VP6.flv – VP6 video
- P1020079.MOV – MJPEG video (720p)
e.g.: omxplayer big_buck_bunny_trailer_480p
The VP8 and Ogg Theora videos played very smoothly,
but I just got a black screen for VP6 and MJPEG videos. since it could not detect the video stream. The firmware has been fixed for VP6 support, and omxplayer for MJPEG support, so all 4 files can now play.
If you don’t want to build omxplayer by yourself, you can download the binary I’ve built: omxplayer-dist.tar.gz.
Jean-Luc started CNX Software in 2010 as a part-time endeavor, before quitting his job as a software engineering manager, and starting to write daily news, and reviews full time later in 2011.
|Support CNX Software - Donate via PayPal, become a Patron on Patreon, or buy review samples|