Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 6231
Joined: Wed Aug 17, 2011 7:41 pm
Location: Cambridge

Re: Bulding omxplayer for Raspberry Pi

Sat Apr 21, 2012 2:32 pm

omxplayer is the command line version of the media player used in XBMC for Raspberry Pi.

It uses a similar build environment to xbmc, so I'd suggest you to start with the same procedure for creating the nfs rootfs and installing libs on the Raspberry Pi as here:

I've written the instructions to a text file, as this forum is not great for formatting/editing. 

Please post if you spot any improvements.

Note: This is slightly simpler to build than xbmc, but is still not easy, so not recommended for the beginner.

Have fun!

Posts: 65
Joined: Sat Apr 21, 2012 7:23 pm

Re: Bulding omxplayer for Raspberry Pi

Sat Apr 21, 2012 8:29 pm

Great, thanks!

What kind of documentation did you peruse to make this?

Posts: 35
Joined: Thu May 31, 2012 11:29 pm

Re: Bulding omxplayer for Raspberry Pi

Sat Jun 23, 2012 12:28 am

@dom :

I am really sorry to bother but I get stuck for hours/days now : Could you please give me some hints.

When I run "make ffmpeg" i get the following error : bcm2708-gcc is unable to create an executable file.

Every thing looks ok regarding "bcm2708-gcc" :
which bcm2708-gcc
ll /usr/local/bcm-gcc/bin/bcm2708-gcc
lrwxrwxrwx 1 mxav mxav 29 2012-06-22 15:41 /usr/local/bcm-gcc/bin/bcm2708-gcc -> arm-bcm2708-linux-gnueabi-gcc*
which arm-bcm2708-linux-gnueabi-gcc
ll /usr/local/bcm-gcc/bin/arm-bcm2708-linux-gnueabi-gcc
-rwxrwxr-x 1 mxav mxav 241164 2012-06-22 15:41 /usr/local/bcm-gcc/bin/arm-bcm2708-linux-gnueabi-gcc*
But when i try to execute it :
-bash: /usr/local/bcm-gcc/bin/arm-bcm2708-linux-gnueabi-gcc: No such file or directory
I tried with my standard login (mxav) and with root ("sudo su" and then "make ffmpeg")
Both have the same $PATH that includes bcm2708-gcc : /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/bcm-gcc/bin
But they fail with this same error : "bcm2708-gcc is unable to create an executable file."
and can't execute "usr/local/bcm-gcc/bin/arm-bcm2708-linux-gnueabi-gcc" :
"-bash: /usr/local/bcm-gcc/bin/arm-bcm2708-linux-gnueabi-gcc: No such file or directory"

I think the first parts of the instructions (xbmc build) were ok, but there must be something wrong with the way i installed the ARM compiler.

Could you please confirm that i understand it right ->

When you say :
You will need an ARM compiler. I'll assume you are using this one: ... /linux-x86
On Build Machine:
sudo cp /usr/local/bcm-gcc/arm-bcm2708-linux-gnueabi/sys-root/lib/ /opt/bcm-rootfs/usr/lib
do you mean :
git clone
sudo cp -a ./tools/arm-bcm2708/linux-x86 /usr/local/bcm-gcc
sudo cp /usr/local/bcm-gcc/arm-bcm2708-linux-gnueabi/sys-root/lib/ /opt/bcm-rootfs/usr/lib
When you say :
cd /usr/lib/arm-linux-gnueabi/
sudo ln -sf
sudo ln -sf
sudo ln -sf
sudo ln -sf
cd /usr/lib
sudo ln -sf

cd /usr/lib/arm-linux-gnueabi/
sudo rm
sudo rm
sudo rm
sudo rm
cd /usr/lib
sudo rm
Do you confirm it should be done on the Raspberry Pi rootfs :
"/opt/bcm-rootfs/usr/lib/arm-linux-gnueabi/" and not on "/usr/lib/arm-linux-gnueabi/" which does not exist on my Ubuntu 11.10 VM-Build-Machine ?


Do you confirm that the following lines preceded by a "#" must not be done ?
#cd /lib
#sudo ln -sf arm-linux-gnueabi/
#sudo ln -sf arm-linux-gnueabi/
Do you confirm that we should stop following "xbmc build" just before executing those instructions
On build machine
# now. Need to edit tools/rbp/ and change USE_BUILDROOT=1 to USE_BUILDROOT=0
and skip to "omxplayer_build" right here :

I have had a really similar problem trying to build XBMC with the following error at the step "make -C tools/rbp/depends all" :
make[2]: /usr/local/bcm-gcc/bin/arm-bcm2708-linux-gnueabi-g++: Command not found
mxav@ubuntu:~/xbmc-rbp$ ll /usr/local/bcm-gcc/bin/arm-bcm2708-linux-gnueabi-g++
-rwxr-xr-x 1 mxav mxav 245260 2012-06-21 00:49 /usr/local/bcm-gcc/bin/arm-bcm2708-linux-gnueabi-g++*
mxav@ubuntu:~/xbmc-rbp$ /usr/local/bcm-gcc/bin/arm-bcm2708-linux-gnueabi-g++
bash: /usr/local/bcm-gcc/bin/arm-bcm2708-linux-gnueabi-g++: No such file or directory

Posts: 35
Joined: Thu May 31, 2012 11:29 pm

Re: Bulding omxplayer for Raspberry Pi

Tue Jun 26, 2012 11:58 am

Update : I have been able to build OMXPlayer :) !!!!!!

I still don't understand why "arm-bcm2708-linux-gnueabi-g++" and "arm-bcm2708-linux-gnueabi-gcc" didn't want to play and where throwing those "No such file or directory", but after "git cloning" several times I ended up with some working compiler.

So, I confirm dom's instructions still work with Debian Wheezy Beta;
I had to adapt Makefile.include and Makefile.ffmpeg to my conf and to include new PATH (for Wheezy ? / for the new firmwares ?)

- Makefile.include :

ifeq ($(USE_BUILDROOT), 1)
BUILDROOT :=/opt/xbmc-bcm/buildroot
SDKSTAGE :=$(BUILDROOT)/output/staging
TARGETFS :=$(BUILDROOT)/output/target
TOOLCHAIN :=$(BUILDROOT)/output/host/usr/
HOST :=arm-unknown-linux-gnueabi
SYSROOT :=$(BUILDROOT)/output/host/usr/arm-unknown-linux-gnueabi/sysroot
BUILDROOT :=/opt/bcm-rootfs
SDKSTAGE :=/opt/bcm-rootfs
TARGETFS :=/opt/bcm-rootfs
TOOLCHAIN :=/home/mxav/tools/arm-bcm2708/linux-x86
HOST :=bcm2708
SYSROOT :=/home/mxav/tools/arm-bcm2708/linux-x86/arm-bcm2708-linux-gnueabi/sys-root


CFLAGS := -isystem$(BUILDROOT)/usr/include -isystem$(PREFIX)/include -I/home/mxav/rootfs/opt/vc/include/interface/vcos/pthreads -I/home/mxav/rootfs/usr/include/arm-linux-gnueabi
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=softfp -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)/staging/usr/include -isystem$(SDKSTAGE)/staging/opt/vc/include
- Makefile.ffmpeg :
include Makefile.include



all: checkout configure compile

find ffmpeg -name '*.so*' -exec cp {} . \;
$(TOOLCHAIN)/bin/$(HOST)-strip *.so*

cd ffmpeg; \
make -j4

cd ffmpeg; \
./configure \
--extra-cflags="-mfpu=vfp -mfloat-abi=softfp -mno-apcs-stack-check -mstructure-size-boundary=32 -mno-sched-prolog" \
--enable-cross-compile \
--enable-shared \
--disable-static \
--arch=arm \
--cpu=arm1176jzf-s \
--target-os=linux \
--disable-muxers \
--enable-muxer=spdif \
--enable-muxer=adts \
--disable-encoders \
--enable-encoder=ac3 \
--enable-encoder=aac \
--disable-decoder=mpeg_xvmc \
--disable-devices \
--disable-ffprobe \
--disable-ffplay \
--disable-ffserver \
--disable-ffmpeg \
--enable-shared \
--disable-doc \
--enable-postproc \
--enable-gpl \
--enable-protocol=http \
--enable-pthreads \
--disable-runtime-cpudetect \
--enable-pic \
--disable-armv5te \
--disable-neon \
--enable-armv6t2 \
--enable-armv6 \
--enable-armvfp \
--enable-hardcoded-tables \
--disable-runtime-cpudetect \
--disable-debug \

@rm -rf ffmpeg

git clone git:// ffmpeg; \
cd ffmpeg; git checkout master; git checkout 13a7bd70c8d94c5a46c14e7ac23a170b77eff52e

cd ffmpeg; make -j4 DESTDIR="$(WORK)/ffmpeg_compiled" install
$(TOOLCHAIN)/bin/$(HOST)-strip ffmpeg_compiled/usr/local/lib/*.so
Feel free tu use, but adapt bold parts according to your configuration :
  • - "mxav" was the Ubuntu login I used on the build machine
    - "/home/mxav/tools/" was the directory used to "git clone"
    - "JOBS=2" I am not sure this variable is used any way (Should have been the number of concurrent cc i guess)
    - "/home/mxav/rootfs/opt/vc/include/interface/vcos/pthreads" added to CFLAGS to avoid "Error: vcos_platform_types.h: No such file or directory"
    - "/home/mxav/rootfs/usr/include/arm-linux-gnueabi" added to CFLAGS to get rid of "bits/predefs.h: No such file or directory"
    - "$(TOOLCHAIN)/bin/" added to "$(HOST)-strip" to set the full path to the utility.
If you find any big mistake <- tell me here.


You can get the version I have built here : ... ist.tar.gz

This version adds "Volume control" with "+" and "-" (<- This is what I was interested in and it cost me 3 sleep less night ...) and a few other things <- See :

- Dirty install :
wget ... ist.tar.gz
tar zxvf ./omxplayer-dist.tar.gz

- Run :
LD_LIBRARY_PATH=omxplayer-dist/usr/lib/omxplayer ./omxplayer-dist/usr/usr/bin/omxplayer.bin -o hdmi ../big_buck_bunny_1080p_h264_ac3.mkv


Posts: 3
Joined: Tue Jul 03, 2012 5:24 pm

Re: Bulding omxplayer for Raspberry Pi

Tue Jul 03, 2012 6:50 pm

Where did you get rootfs/opt/vc/... and stuff like that. Is rootfs mounted to RPi filesystem over the network or is there a place I can download all that stuff from? The XBMC build notes are quite confusing and I'm not sure what exactly should I do and what to skip when I just want omxplayer.

Posts: 35
Joined: Thu May 31, 2012 11:29 pm

Re: Bulding omxplayer for Raspberry Pi

Tue Jul 03, 2012 8:34 pm

Hi lpsk,

rootfs is a copy of the complet file system from the debian image.

You get it from downloading the image here :
and the following dom's instructions here :

You have to follow all the steps, but the part you are interested in for rootfs is :
mkdir -p ~/mnt
sudo mount -o loop,offset=80740352 sd.img ~/mnt
sudo rm -rf ~/rootfs
sudo cp -a ~/mnt ~/rootfs
Basically it means that on the (Ubuntu) build machine you should :

- Create an empty directory : mkdir -p ~/mnt
- Mount the Debian image (starting at 80740352) on this new directory : sudo mount -o loop,offset=80740352 sd.img ~/mnt
- Supress any previous rootfs directory (just in case) : sudo rm -rf ~/rootfs
- Copy the mounted image in your newly created rootfs directory : sudo cp -a ~/mnt ~/rootfs

Once this is done, just follow dom's instructions and you should be able to boot your Pi via NFS from this fresh rootfs on the Build machine.

Be careful if you are not using the Debian Squeeze image when you use "sudo mount -o loop,offset=80740352 sd.img ~/mnt"

The offset 80740352 represents the sector in the image where file system starts times the sector size : 157696*512=80740352

If you use the Debian Wheezy image, the FS layout is different and the correct offset should be 62914560 :
"sudo mount -o loop,offset=62914560 sd.img ~/mnt"


Return to “Other projects”