Raspberry Pi Now Has Experimental Support for VP6, VP8, MJPEG and Ogg Theora Video Codecs

Orange Pi Development Boards

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.

480p VP8 Video Playback in the Raspberry Pi
480p VP8 Video Playback in the Raspberry Pi

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:

  1. Download and run Hexxeh’s rpi-update script in the Raspberry Pi in order to get the very latest build:
  2. Add the following two lines to /boot/config.txt:
  3. Reboot the Raspberry Pi
  4. The GPU firmware is now updated, but you still need the latest version of omxplayer. You  have two choices:
    1. Wait for the next build to be available on http://omxplayer.sconde.net/ (should be there in a few days).
    2. Build it yourself.
  5. 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

  6. 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:

    Then edit /etc/exports as root (sudo) and add the line:

    Then restart the NFS server
  7. Now let’s mount the NFS share in the build machine:
  8. Let’s retrieve omxplayer source code:
  9. 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) -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.

  10. We’re now ready to cross-compile omxplayer:

    This will create a omxplayer-dist.tar.gz that you can copy in the Raspberry Pi:

    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.
  11. Back to the Raspberry Pi, let’s install it:

That’s all. Now we can try the files tested by dom:

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.

Support CNX Software - Donate via PayPal or become a Patron on Patreon

15
Leave a Reply

avatar
15 Comment threads
0 Thread replies
0 Followers
 
Most reacted comment
Hottest comment thread
5 Comment authors
ใช้ OMXPlayer เล่นภาพเคลื่อนไหว | Unofficial of Raspberry Pi Fan in ThailandMost Embedded GPUs Do NOT Support Hardware Video Decoding Acceleration. The VPU Does.jviyercross-compile omxplayer on a debian-desktop for Rpi | johannes degenhardRaspberry Pi 试验性支持 VP6, VP8, MJPEG和Ogg Theora 视频编码 摇电 - mftvrocks Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
trackback

[…] vous êtes un vrai geek, vous pouvez installer ça vous même. Toutes les instructions sont là. Soyez prêt à de la compilation à gogo !  Mais ça laisse un bon espoir pour un meilleur […]

Ahto
Guest
Ahto

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.

trackback

[…] http://www.cnx-software.com/2013/01/…-video-codecs/ […]

jamis
Guest

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…

HardwareHaquer
Guest

@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.

trackback

[…] ที่คอมไพล์มาแล้วใช้งานได้เลยก็ที่ CNX-Soft […]

trackback

[…] of this tutorial is based on the nice tutorial on this page. Mostly i updated some stuff to current omxplayer […]

jviyer
Guest
jviyer

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
========================================
[email protected] ~ $ 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
mountdrpc.mountd: svc_tli_create: could not open connection for udp6
rpc.mountd: svc_tli_create: could not open connection for tcp6
rpc.mountd: svc_tli_create: could not open connection for udp6
rpc.mountd: svc_tli_create: could not open connection for tcp6
rpc.mountd: svc_tli_create: could not open connection for udp6
rpc.mountd: svc_tli_create: could not open connection for tcp6
. ok
[email protected] ~ $ sudo exportfs -ra
[email protected] ~ $ dmesg
….
[ 267.879935] NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory
[ 267.882608] NFSD: starting 90-second grace period
[ 517.148071] nfsd: last server has exited, flushing export cache
[ 519.424426] NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory
[ 519.424553] NFSD: starting 90-second grace period

=========================================
On client m/c:
sudo mount -t nfs 192.168.1.8:/ ~/edev/rpi/nfs
is what I issued since it needed host:dir format and the ip-addr of the rpi is 192.168.1.8

could you help me ?
thanks,

jviyer
Guest
jviyer

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

jviyer
Guest
jviyer

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

trackback

[…] the Raspberry Pi guys used some features of the VideoCore IV GPU, but not the hardware codecs, to implemented VP6, VP8, MJPEG decoding in standard resolution. More recent GPUs comes with Renderscript and OpenCL support, which allows […]

trackback

[…] ที่คอมไพล์มาแล้วใช้งานได้เลยก็ที่ CNX-Soft […]