Connect with us

How To

How to Compile VLC Media Player on Raspberry Pi with Hardware Acceleration

Published

on

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. VLC can be accessed on Raspbian OS. Raspbian is the popular Raspberry Pi OS based on Debian, which is one of the earliest Linux distributions. Raspberry Pi users can easily install VLC by opening the Terminal and running the command.

The build of the VLC media player available on the Raspbian’s repositories lacks OpenMAX support, which is incapable of playing the video properly. So you cannot easily install VLC by opening the Terminal and running the command (sudo apt-get install vlc). There is a better option to compile the VLC Media Player with hardware acceleration for the Raspberry Pi.

Raspberry Pi VLC

Related: How to create a Raspberry Pi Clock using the Sense HAT

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

For this project, you just need the Raspberry Pi and its basic peripherals, power source, screen keyboardmouse, and microSD card. You will require all these to get the Raspbian OS 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 remove that version by running the following command.

sudo apt-get purge vlc

Step 1: Install Raspbian OS on your Raspberry Pi if you don’t already have it. 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
wget http://download.videolan.org/vlc/2.2.5.1/vlc-2.2.5.1.tar.xz
tar -xJf vlc-2.2.5.1.tar.xz

Raspberry Pi VLC

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

Step 3: Then, update the package list and install the needed dependencies. You need to copy and paste the second command here, and it’s quite a long one:

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: To compile the VLC Media Player, go to the VLC Media Player’s directory and run a few more commands. You can copy and paste the below command:

cd vlc-2.2.5.1
./bootstrap
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 a 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 is to install the binaries from the building process and copies them to the appropriate locations:

sudo make install

Now, you have compiled and installed the VLC media player.

Step 5: You can start the program through the menu bar ( Sound & Video > VLC Media Player) or Terminal ( with the command VLC). After starting the program, open the setting dialogue and change the settings ( Tools > Preferences) so that it looks similar to this:

Audio
Output module: ALSA audio output

Audio

Video
Output: OpenMAX IL video output

video

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, and it is recommended to learn some basic hotkeys such as CTRL+Q for quitting.

Step 6: Now, you can send audio over the HDMI connection (optional). At this point, the VLC Media Player will send audio out only through the Raspberry Pi’s headphone jack, so 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, and others 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 Advanced Options > A4 Audio > Choose the audio output: 2 Fore HDMI.

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. If you want to remove the VLC Media Player 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 VLC on Raspberry Pi.

Facebook

Trending