Connect with us

How To

How to Compile VLC Media Player with Hardware Acceleration for Raspberry Pi?



Raspberry Pi VLC

The VLC media player is one of the best options available for playing videos and music. VLC Media Player is considered one of the best video players available. It is available for many Operating Systems which include Windows, OS X, and Linux. Raspberry Pi VLC can be made possible with the help of Raspbian OS, Raspbian the popular Raspberry Pi OS, is based on the Debian, one of the earliest Linux distributions, Raspberry Pi users can easily install VLC by opening the Terminal and running the command.

sudo apt-get install vlc

Raspberry Pi VLC
Raspberry Pi VLC

The build of VLC media player available on the Raspbian’s repositories lacks the OpenMAX support, which is incapable of playing the video properly. So that close up the Terminal and don’t enter that command above, you can undo those things easily because there is another better option to compile the VLC Media Player with a hardware acceleration for the Raspberry Pi.

Related: How to Create A Raspberry Pi Clock Using the Sense HAT?

How to Compile VLC Media Player With Hardware Acceleration for Raspberry Pi? | Raspberry Pi VLC

Here we are going to give you detailed instructions on how to easily compile VLC media player with the hardware acceleration. For this project, you just need the Raspberry Pi and its basic peripherals. a power source, screen keyboardmouse, and microSD card. You will need all this to get the Raspbian installed in the first place.

Before getting started, a quick note for those who already have the Raspbian and may have installed the VLC media player from Raspbian’s repositories: We recommend you to remove that version. You can do this by running the following command:

sudo apt-get purge vlc

Step 1: Install Raspbian, If you don’t already have the Raspbian, install Raspbian on your Raspberry Pi. Click the link for a complete installation guide.

Step 2: Download and extract the VLC media player. Get into the Terminal and run the following commands:

cd Downloads
tar -xJf vlc-

Raspberry Pi VLC
Raspberry Pi VLC

Now you have downloaded and extracted the latest version of the VLC Media Player into your Downloads directory.

Step 3: Install the dependencies, Now update the package list and install the needed dependencies. You need to copy and paste the second command here, its quite long:

sudo apt-get update
sudo apt-get install autopoint gettext liba52-0.7.4-dev libaa1-dev libasound2-dev libass-dev libavahi-client-dev libavc1394-dev libavcodec-dev libavformat-dev libbluray-dev libcaca-dev libcddb2-dev libcdio-dev libchromaprint-dev libdbus-1-dev libdc1394-22-dev libdca-dev libdirectfb-dev libdvbpsi-dev libdvdnav-dev libdvdread-dev libegl1-mesa-dev libfad-dev libflac-dev libfluidsynth-dev libfreerdp-dev libfreetype6-dev libfribidi-dev libgl1-mesa-dev libgles1-mesa-dev libgles2-mesa-dev libgnutls28-dev libgtk2.0-dev libidn11-dev libiso9660-dev libjack-jackd2-dev libkate-dev liblircclient-dev liblivemedia-dev liblua5.2-dev libmad0-dev libmatroska-dev libmodplug-dev libmpcdec-dev libmpeg2-4-dev libmtp-dev libncursesw5-dev libnotify-dev libogg-dev libomxil-bellagio-dev libopus-dev libpng12-dev libpulse-dev libqt4-dev libraw1394-dev libresid-builder-dev librsvg2-dev libsamplerate0-dev libschroedinger-dev libsdl-image1.2-dev libsdl1.2-dev libshine-dev libshout3-dev libsidplay2-dev libsmbclient-dev libspeex-dev libspeexdsp-dev libssh2-1-dev libswscale-dev libtag1-dev libtheora-dev libtwolame-dev libudev-dev libupnp-dev libv4l-dev libva-dev libvcdinfo-dev libvdpau-dev libvncserver-dev libvorbis-dev libx11-dev libx264-dev libxcb-composite0-dev libxcb-keysyms1-dev libxcb-randr0-dev libxcb-shm0-dev libxcb-xv0-dev libxcb1-dev libxext-dev libxinerama-dev libxml2-dev libxpm-dev libzvbi-dev lua5.2 oss4-dev pkg-config zlib1g-dev libtool build-essential autoconf

Now you are ready to compile.

Step 4: Compile the VLC Media Player, Now go to the VLC Media Player’s directory and run a few more commands. You may wish to copy and paste again for the third one here:

cd vlc-
CFLAGS=”-I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/mmal -I/opt/vc/include/interface/vchiq_arm -I/opt/vc/include/IL -I/opt/vc/include/GLES2 -mfloat-abi=hard -mcpu=cortex-a7 -mfpu=neon-vfpv4″ CXXFLAGS=”-I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -I/opt/vc/include/interface/mmal -I/opt/vc/include/interface/vchiq_arm -I/opt/vc/include/IL -mfloat-abi=hard -I/opt/vc/include/GLES2 -mcpu=cortex-a7 -mfpu=neon-vfpv4″ LDFLAGS=”-L/opt/vc/lib” ./configure –prefix=/usr –enable-omxil –enable-omxil-vout –enable-rpi-omxil –disable-mmal-codec –disable-mmal-vout –enable-gles2

And then another command, which, is very short one:

make -j3

Now, you have to wait for sometime around 20-25 minutes.

If the process goes through, you have successfully compiled the VLC Media Player. The last command in the instructions install the binaries from the building process and copies them to the appropriate locations:

sudo make install
Step 5: Change settings, Now you have compiled and installed the VLC media player. You can start the program through the menu bar ( Sound & Video > VLC Media Player) or Terminal ( with the command VLC). After starting the program, you can open the setting dialogue and change the settings ( Tools > Preferences), So that it looks similar to this:

Output module: ALSA audio output

Raspberry Pi VLC
Raspberry Pi VLC

Output: OpenMAX IL video output

Raspberry Pi VLC
Raspberry Pi VLC

When you play something, you can notice that the video plays in the overlay and not inside the window. You can only control the playback using your keyboard So that it is recommended to learn some basic hotkeys such as CTRL+Q for quitting.

Step 6: Now you can send the audio out over the HDMI connection (optional). There is another thing which you may need to change here before you finish. At this point, the VLC Media Player will send audio out only through the Raspberry Pi‘s headphone jack, So that you have to plug in headphones, and the auxiliary cord to the stereo system or the standalone speakers to hear your videos. This works for some users, but others may need to push the audio out of the HDMI port.

To do this, open the Terminal and run the command sudo raspi-config. In the resulting menu, navigate to the Advanced Options > A4 Audio > Choose the audio output: 2 Fore HDMI.

And that’s all! Here you have the functioning version of the VLC Media Player and can push the audio out of the headphone jack or the HDMI port at will. If you want to remove the VLC Media Player, you can do this by running the following command inside the VLC directory:

sudo make uninstall

Now you can enjoy watching your favourite videos. These are the ways to compile Raspberry Pi VLC. Thank you for reading this post.