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

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

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:
    wget https://github.com/Hexxeh/rpi-update/raw/master/rpi-update
    chmod 755 rpi-update
    sudo ./rpi-update
  2. Add the following two lines to /boot/config.txt:
    start_file=start_x.elf
    fixup_file=fixup_x.elf
  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:
    sudo apt-get install nfs-kernel-server nfs-common rpcbind
    sudo dpkg-reconfigure rpcbind
    sudo /etc/init.d/rpcbind restart

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

    / 192.168.0.0/24(rw,no_root_squash,async,no_subtree_check)

    Then restart the NFS server

    sudo /etc/init.d/nfs-kernel-server restart
    sudo exportfs -a
  7. Now let’s mount the NFS share in the build machine:
    mkdir ~/edev/rpi/nfs
    sudo apt-get install nfs-client
    sudo mount -t nfs 192.168.0.107/ ~/edev/rpi/nfs
  8. Let’s retrieve omxplayer source code:
    git clone git://github.com/huceke/omxplayer.git
    cd omxplayer
  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:
    make ffmpeg
    make -j8
    make dist

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

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

  11. Back to the Raspberry Pi, let’s install it:
    cd /
    tar xzvf omxplayer-dist.tar.gz
    cd omxplayer-dist
    sudo cp * / -rf

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.

Digg This
Reddit This
Stumble Now!
Buzz This
Vote on DZone
Share on Facebook
Bookmark this on Delicious
Kick It on DotNetKicks.com
Share on LinkedIn
Bookmark this on Technorati
Post on Twitter

Categories: Linux, Testing, Video Tags: cross-compilation, omxplayer, raspberry pi, tutorial, ubuntu, video
  1. Ahto
    January 27th, 2013 at 20:18 | #1

    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 :D

    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.

  2. January 27th, 2013 at 20:50 | #2

    @Ahto
    Glad my instructions could help. I’ve added the missing “export PATH” step.

  3. March 14th, 2013 at 05:48 | #3

    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…

  4. March 14th, 2013 at 20:16 | #4

    @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 :)

  5. March 16th, 2013 at 04:34 | #5

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

  6. jviyer
    November 6th, 2013 at 23:53 | #6

    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
    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
    pi@raspberrypi ~ $ sudo exportfs -ra
    pi@raspberrypi ~ $ 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,

  7. jviyer
    November 7th, 2013 at 00:09 | #7

    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

  8. jviyer
    November 7th, 2013 at 03:00 | #8

    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

  1. January 27th, 2013 at 00:44 | #1
  2. January 28th, 2013 at 00:50 | #2
  3. April 8th, 2013 at 20:15 | #3
  4. June 2nd, 2013 at 20:45 | #4
  5. August 14th, 2013 at 22:21 | #5
  6. December 10th, 2013 at 11:20 | #6