Building Omxplayer for Debian on the Raspberry Pi

Building Omxplayer for Debian on the Raspberry Pi

UPDATE: I have now published a post on Building Omxplayer for Raspbian on the Raspberry Pi, which should be referenced now for building omxplayer on either Raspbian or Debian.This post does contain some useful links and background information that you still may find useful.

NOTE: There is a new default operating system for the Raspberry Pi that includes omxplayer. The following post, assumes that you are using the original Debian image for the SD card image of your operating system. To learn more, please see my post Raspbian Optimize Raspberry Pi.
If you want a media player that takes advantage of the GPU of the Raspberry Pi, then building omxplayer is one solution. This solution allows you to run a standard Debian operating system, but be able to take advantage of hardware accelerated video decoding. So far, this has been tested using the original Debian build for the Raspberry Pi called squeeze.

There are other ways to play hardware accelerate videos as I've mentioned in Playing HD videos in Debian on the Raspberry Pi, and OpenElec for the Raspberry Pi. This solution allows you to download the source code for omxplayer and be able to tweak it if you want to be able to do that, download the source code for ffmpeg and adjust it according to your needs, and download and use the current firmware available for the Raspberry Pi.

Omxplayer was built to be able to create XMBC for the Raspberry Pi. One implementation of XMBC is OpenElec for the Raspberry Pi. I forked a repository from https://github.com/huceke/omxplayer to make my own version of omxplayer. Here are some key differences:

  • Default output is HDMI (no need for -o hdmi)
  • Clears the screen and doesn't output anything unless there is an error
  • Makefiles have been customized  to perform a native build on the Raspberry Pi
  • There is the ability to install or uninstall using the Makefiles
  • There is the ability to make git or make git_clean to download or remove the firmware and ffmpeg dependencies
  • Everything installs under /usr/local
Be sure that you have expanded the file system, or have /usr/local/src mounted on another device besides the default root file system. My post, A bigger slice of Raspberry Pi, covers how to expand the file system, make a swap partition and how to activate it.

Also, you need to make sure all the software and firmware is updated, as discussed in my post Keeping Your Raspberry Pi Fresh.

Build omxplayer using Debian Squeeze on the Raspberry Pi

  • These instructions are very similar to what is shown on my github repository: http://github.com/wrightrocket/omxplayer. Instructions at that site may be updated more frequently than this blog post.
  • Don't startx, either use the console or ssh into the system.
  • Install dependencies for build
    • sudo apt-get install libpcre3-dev libboost-dev git fbset
  • Configure the build directory permissions and change to it
    • sudo chown pi:pi /usr/local/src
    • cd /usr/local/src
  • Get the source code for the player, ffmpeg and the Raspberry Pi firmware. Depending on the speed of your Internet connection, then this might not take more than 5 or 10 minutes if you've got a fast connection, or else you might wish that you did. 
    • git clone https://github.com/wrightrocket/omxplayer.git
    • cd /usr/local/src/omxplayer/
    • make sources
git clone https://github.com/raspberrypi/firmware.git
Cloning into firmware...
remote: Counting objects: 9517, done.
remote: Compressing objects: 100% (5218/5218), done.
remote: Total 9517 (delta 4998), reused 7998 (delta 3489)
Receiving objects: 100% (9517/9517), 391.44 MiB | 1.09 MiB/s, done.
Resolving deltas: 100% (4998/4998), done.
git clone git://git.videolan.org/ffmpeg.git ffmpeg;
Cloning into ffmpeg...
remote: Counting objects: 234992, done.
remote: Compressing objects: 100% (55205/55205), done.
remote: Total 234992 (delta 184984), reused 228269 (delta 179406)
Receiving objects: 100% (234992/234992), 59.52 MiB | 737 KiB/s, done.
Resolving deltas: 100% (184984/184984), done.
cd ffmpeg; git checkout master; git checkout 13a7bd70c8d94c5a46c14e7ac23a170b77eff52e
Already on 'master'
Checking out files: 100% (794/794), done.
Note: checking out '13a7bd70c8d94c5a46c14e7ac23a170b77eff52e'.

  • Start the ffmpeg build process, which takes forever! Not actually, the first time I ran it it took about 140 minutes on a Class 6 SD card. After upgrading to a faster Class 10 SD card, it only took about 123 minutes. Expect between two to three hours for this part to complete.
    • time make -f Makefile.ffmpeg
      • first, the configure process for ffmpeg should run
      • next, just a couple of libavdevice files are made
      • followed by many items in alphabetical order, and much like the making of laws:
      • Important milestone, cheers!
Here's the time that was reported, using a non-overclocked Raspberry Pi and a Class 6 sd card, about 2 hours and 20 minutes.

real    140m28.435s
user    132m8.420s
sys     3m32.930s

Here's the time that was reported, using a non-overclocked Raspberry Pi and a Class 10 sd card, only about 2 hours.
real    123m9.197s
user    119m56.500s
sys     2m4.130s

  • After ffmpeg builds, install these libraries, and then start the omxplayer build process, which only takes about 6 minutes
    • time make -f Makefile.ffmpeg install
    • time make
strip omxplayer.bin
real 6m11.814s
user 5m56.810s
sys 0m8.860s

After the build process has completed, you are ready to install omxplayer
  • Make the file that is able to be distributed because this is built with GPL enabled, omxplayer-dist.tar.gz
    • make dist
  • If  make dist succeeded, then you are ready to install omxplayer
    • sudo make install

1 comment:

Nilesh Pardhe said...

I am trying to run H.264, 40MBps hd video on raspberry pi but bad luck.
in 1080i mode. I have set GPU mem to 256MB and running on 700Mhz.
Video get random fluctuations and flicker and Some time video runs very well but after 2 or 3 iteration video get fluctuations.
Please help me...
Thank You

About Me - WrightRocket

My photo

I've worked with computers for over 30 years, programming, administering, using and building them from scratch.

I'm an instructor for technical computer courses, an editor and developer of training manuals, and an Android developer.