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:
123wget https://github.com/Hexxeh/rpi-update/raw/master/rpi-updatechmod 755 rpi-updatesudo ./rpi-update - Add the following two lines to /boot/config.txt:
12start_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
pushd /usr/local/bcm-gcc
sudo git clone git://github.com/raspberrypi/tools.git
export PATH=$PATH:/usr/local/bcm-gcc/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin
popd - 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:
123sudo 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:
1/ 192.168.0.0/24(rw,no_root_squash,async,no_subtree_check)
Then restart the NFS server
12sudo /etc/init.d/nfs-kernel-server restartsudo exportfs -a - Now let’s mount the NFS share in the build machine:
123mkdir ~/edev/rpi/nfssudo apt-get install nfs-clientsudo mount -t nfs 192.168.0.107/ ~/edev/rpi/nfs - Let’s retrieve omxplayer source code:
12git clone git://github.com/huceke/omxplayer.gitcd omxplayer - Modify Makefile.include as follows:
USE_NFS=1
FLOAT=hard
ifeq ($(USE_NFS), 1)
NFSROOT :=/home/jaufranc/edev/rpi/nfs
SDKSTAGE :=$(NFSROOT)
TARGETFS :=$(NFSROOT)
TOOLCHAIN :=/usr/local/bcm-gcc/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian
HOST :=arm-linux-gnueabihf
SYSROOT :=$(NFSROOT)
else
BUILDROOT :=/home/jaufranc/edev/rpi/bcm-rootfs
SDKSTAGE :=/home/jaufranc/edev/rpi/bcm-rootfs
TARGETFS :=/home/jaufranc/edev/rpi/bcm-rootfs
TOOLCHAIN :=/usr/local/bcm-gcc/tools/arm-bcm2708/arm-bcm2708hardfp-linux-gnueabi
HOST :=arm-bcm2708hardfp-linux-gnueabi
SYSROOT :=$(TOOLCHAIN)/tools/arm-bcm2708hardfp-linux-gnueabi/sysroot/
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) -EPATH := $(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/freetype2You’ll need to change NFSROOT variable to where you mounted the NFS share.
- We’re now ready to cross-compile omxplayer:
123make ffmpegmake -j8make dist
This will create a omxplayer-dist.tar.gz that you can copy in the Raspberry Pi:
1sudo 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:
1234cd /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 cryptocurrencies, become a Patron on Patreon, or purchase goods on Amazon or Aliexpress
Thanks for these instructions. Been compiling omxplayer *on* the pi for couple of hours now because I couldn’t get cross compiling to work. CTRL+C’d that and now happily compiling with all my cores 😀
Be sure to add /usr/local/bcm-gcc/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin to your PATH
or you can’t compile ffmpeg.
@Ahto
Glad my instructions could help. I’ve added the missing “export PATH” step.
Thank you for posting this! I wish it were higher in googles results because your instructions are a lot more helpful then most of the other tutorials I’ve seen.
Also, this usage of NFS is SO much cleaner then trying to boot the Raspberry Pi off of a NFS server somewhere else. This way, you can use you’re existing raspberry pi install. You don’t have to mess around with building another SD card.
Beautifully done! If only the omxplayer repo on github had these kinds of instructions…
@jamis
Glad these instructions could help. It took me a little while to find out how to build it, so I thought It might be a good idea to write what I’ve done if others are trying to do the same 🙂
@Jean-Luc Aufranc (CNXSoft)
I know this is a few months old, but you might want to remind people that if they add “export PATH…” to .bashrc they will need to “source ~/.bashrc” in whichever terminal window they plan to run make from to help reduce some frustration 😉
Also thanks a lot for posting this.
Thanks a lot for this. I have run into this problem at the NFS step: I get a number of lines about “could not open…..for tcp6” Also on the client I get “access denied by server” I looked t dmesg on pi and there is no sign my client was trying connection ======================================== pi@raspberrypi ~ $ sudo /etc/init.d/nfs-kernel-server restart [ ok ] Stopping NFS kernel daemon: mountd nfsd. [ ok ] Unexporting directories for NFS kernel daemon…. [ ok ] Exporting directories for NFS kernel daemon…. [….] Starting NFS kernel daemon: nfsdrpc.nfsd: address family inet6 not supported by protocol TCP… Read more »
Sorry. When I changed the
/ 192.168.0.0/24(rw,no_root_squash,async,no_subtree_check)
to
/ 192.168.1.0/24(rw,no_root_squash,async,no_subtree_check)
it worked. I had not paid attention to that.
Please ignore previous request
I have the PATH exported and it is there but it complains.
config.log output on ffmpeg make:
PATH=’/bin:/output/host/usr/bin:/bin:/output/host/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bcm-gcc/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin
arm-linux-gnueabihf-gcc -D__STDC_CONSTANT_MACROS -D__STDC_LIMIT_MACROS -DTARGET_POSIX -D_LINUX -fPIC -DPIC -D_REENTRANT -D_HAVE_SBRK -D_LARGEFILE64_SOURCE -DHAVE_CMAKE_CONFIG -DHAVE_VMCS_CONFIG -D_REENTRANT -DUSE_VCHIQ_ARM -DVCHI_BULK_ALIGN=1 -DVCHI_BULK_GRANULARITY=1 -DEGL_SERVER_DISPMANX -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D__VIDEOCORE4__ -DGRAPHICS_X_VG=1 -U_FORTIFY_SOURCE -Wall -DHAVE_OMXLIB -DUSE_EXTERNAL_FFMPEG -DHAVE_LIBAVCODEC_AVCODEC_H -DHAVE_LIBAVUTIL_MEM_H -DHAVE_LIBAVUTIL_AVUTIL_H -DHAVE_LIBAVFORMAT_AVFORMAT_H -DHAVE_LIBAVFILTER_AVFILTER_H -DOMX -DOMX_SKIP64BIT -isystem/home/jv/edev/rpi/nfs/usr/include -isystem/home/jv/edev/rpi/nfs/usr/include/arm-linux-gnueabihf -isystem/home/jv/edev/rpi/nfs/opt/vc/include -isystem/home/jv/edev/rpi/nfs/usr/include -isystem/home/jv/edev/rpi/nfs/opt/vc/include/interface/vcos/pthreads -isystem/home/jv/edev/rpi/nfs/usr/include/freetype2 -mfpu=vfp -mfloat-abi=hard -mno-apcs-stack-check -mstructure-size-boundary=32 -mno-sched-prolog -mcpu=arm1176jzf-s -c -o /tmp/ffconf.JLOXdiwr.o /tmp/ffconf.JhnDbRzw.c
./configure: 728: ./configure: arm-linux-gnueabihf-gcc: not found
C compiler test failed.
============
I can figure why it cant find it since it is there in the directory (it is linked to gcc-4.7.2