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

Home
> Linux, Testing, Video
> 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

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:

    wget https://github.com/Hexxeh/rpi-update/raw/master/rpi-update
    chmod 755 rpi-update
    sudo ./rpi-update
  1. Add the following two lines to /boot/config.txt:
    start_file=start_x.elf
    fixup_file=fixup_x.elf
  2. Reboot the Raspberry Pi
  3. 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.
  4. . 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
    popd
  5. 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
  6. 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
  7. Let’s retrieve omxplayer source code:
    git clone git://github.com/huceke/omxplayer.git
    cd omxplayer
  8. Modify Makefile.include as follows:

    USE_NFS=1
    FLOAT=hardifeq ($(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.

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

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

If you don’t want to build omxplayer by yourself, you can download the binary I’ve built today: omxplayer-dist.tar.gz.