Building Omxplayer for Raspbian on the Raspberry Pi
This version of the omxplayer, is nearly identical to the one I published for Debian on the Raspberry Pi, except that it can be built for Raspbian. The same github repository serves to build omxplayer for both Raspbian and Debian. To configure the build for one or the other, the RASPBIAN variable must be set as described below in the Makefile.include.
This means that the primary differences between this and the default build of omxplayer still are:
- 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 sources or make sources-clean to download or remove the firmware and ffmpeg dependencies
- Everything installs under /usr/local
- It is possible to install this pre-built omxplayer for Raspbian Wheezy or Debian Squeeze
Preparing to Build Omxplayer
- First, make sure your firmware is up-to-date, as described in Keeping Your Raspberry Pi Fresh:
- pi@raspberrypi:~$ sudo apt-get update && sudo apt-get upgrade
- Install software needed to perform the update:
- pi@raspberrypi:~$ sudo apt-get install ca-certificates git-core binutils libboost1...-dev libva1 libpcre3-dev
- Download the script:
- pi@raspberrypi:~$ sudo wget https://raw.github.com/Hexxeh/rpi-update/master/rpi-update
- Copy the script to /usr/local/bin:
- pi@raspberrypi:~$ sudo cp rpi-update /usr/local/bin/rpi-update
- Make the script executable:
- pi@raspberrypi:~$ sudo chmod +x /usr/local/bin/rpi-update
- To compile this successfully, use a 240/16MB RAM split between system and GPU:
- pi@raspberrypi:~$ sudo rpi-update 240
- pi@raspberrypi:~$ sudo reboot
Next, make sure proper ownerships are in place, go to the local src directory, and clone the git repository for my omxplayer fork:
- pi@raspberrypi:~$ sudo chown pi:pi /usr/local/src/
- pi@raspberrypi:src $ cd /usr/local/src
- pi@raspberrypi:src $ git clone https://github.com/wrightrocket/omxplayer
- sudo /usr/local/src/omxplayer/install-raspbian-wheezy
- sudo /usr/local/src/omxplayer/install-debian-wheezy
The Debian Wheezy build has been tested to work on both Wheezy and Squeeze.
Building the Omxplayer
Before building, be sure to set update the Makefile.include file for the RASPBIAN variable. If building under Debian, then RASPBIAN=0 is appropriate. If building under the Raspbian OS, then update this file where RASPBIAN=1. The RASPBIAN variable determines whether hardfp or softfp is used.
- If you are building this under Raspbian, and not Debian, then use vi, vim, nano, leafpad or some other editor to modify the RASPBIAN variable at the top of the /usr/local/src/omxplayer/Makefile.include file to set RASPBIAN=1.
- Change to the directory where the source code is located
- cd /usr/local/src/omxplayer/
- Next, the firmware and ffmpeg sources will be downloaded. The firmware is about 427 MB and ffmpeg is about 60MB. This step took about 16 minutes on my connection.
- make sources
- The longest part of the process is compiling the ffmpeg libraries. Under Raspbian this step took about the same amount of time as under Debian. This step took about 131 minutes.
- make -f Makefile.ffmpeg
- After the libraries are built, then they are stripped and copied to the /usr/local/src/omxplayer/ffmpeg_compiled directory. This step is very quick.
- make -f Makefile.ffmpeg install
- Now, omxplayer is ready to be compiled. It should only take about 6 minutes.
- The last step of building should create a /usr/local/src/omxplayer/omxplayer-dist.tar.gz that will be used to install omxplayer and the ffmpeg libraries.
- make dist
Finally, install omxplayer:
- sudo make install
Using the Omxplayer
- To use omxplayer, the system must allocate at least 64MB of RAM for the GPU. Run the script and make sure there is a 192/64 Mb of RAM split between the system and GPU. A split of 128/128 can also be used:
- pi@raspberrypi:~$ sudo rpi-update 192
- pi@raspberrypi:~$ sudo reboot
- To play videos, just execute the omxplayer script
- omxplayer --help Options :
-h / --help print this help
-a / --alang language audio language : e.g. ger
-n / --aidx index audio stream index : e.g. 1
-o / --adev device audio out device : e.g. hdmi/local
-i / --info dump stream format and exit
-s / --stats pts and buffer stats
-p / --passthrough audio passthrough
-d / --deinterlace deinterlacing
-w / --hw hw audio decoding
-3 / --3d switch tv into 3d mode
-y / --hdmiclocksync adjust display refresh rate to match video
- pi@raspberrypi:~$ omxplayer LMFAO.mp4