search
尋找貓咪~QQ 地點 桃園市桃園區 Taoyuan , Taoyuan

讓VLC驅動Raspberry pi硬解( How to use VLC with hardware acceleration on a Raspberry pi) – jashliao部落

讓VLC驅動Raspberry pi硬解(

How to use VLC with hardware acceleration on a Raspberry pi)

 

在GOOGLE查[raspberry pi vlc hardware acceleration]

資料來源:http://www.oblivion-software.de/index.php?id=56&type=98

 

When using Raspbian, a Debian derivative, VLC is readily available from the repositories, alas the binary does not make use of Raspberrypi’s hardware acceleration. Watching videos is no fun with that version of VLC. The only alternative is omxplayer which comes with the distribution. Fortunately, VLC now does support hardware acceleration, only you have to compile it yourself, which is not for the fainthearted.

Here’s how to do it.

There is a guide on the web at

http://intensecode.blogspot.de/2013/10/tutorial-vlc-with-hardware-acceleration.html

that is the base of this document, but it is missing some details which will be provided here.

Step 1: System Update

It is always wise to have the operating system up-to-date.

# sudo apt-get update
# sudo apt-get upgrade

Step 2: Update gcc

There is a bug in gcc 4.6 which causes the compile to fail (when trying to build the current version). Therefore we have to update to gcc 4.7 or later in the first place. That won’t hurt anyway.

With gcc 4.6 you are very likely going to run into this:

demux/oggseek.c: In function ‘Oggseek_GranuleToAbsTimestamp’:
ERROR : demux/oggseek.c:805: 1: unrecognizable insn:

(insn 266 265 267 6 (set (subreg:SI (reg:DI 213 [ p_stream_4(D)->i_keyframe_offset ]) 0)

(sign_extend:SI (mem/s:QI (plus:SI (reg/v/f:SI 178 [ p_stream ])

(const_int 1080 [0x438])) [0 p_stream_4(D)->i_keyframe_offset+0 S1 A64]))) demux/oggseek.c:786 -1

(nil))

demux/oggseek.c:805:1: internal compiler error: in extract_insn, at recog.c:2109

Please submit a full bug report,

with preprocessed source if appropriate.

See for instructions.
Preprocessed source stored into /tmp/ccMrDMIU.out file, please attach this to your bugreport.

make: *** [all] Error 2

Update C++ compiler

It would be possible to remove gcc 4.6, but this is not recommended as it might break a lot of dependencies. It is better to install the new version in parallel, and switch to it:

# sudo apt-get install gcc-4.7 g++-4.7

Then remove all update alternatives (this may cause some warnings and errors to be reported, but that is no problem and can be ignored):

# sudo update-alternatives –remove-all gcc
# sudo update-alternatives –remove-all g++

Now add gcc 4.6 and gcc 4.7 as alternatives, make g++ a slave configuration of gcc. That switches g++ always together with gcc 4.6:

# sudo update-alternatives –install /usr/bin/gcc gcc /usr/bin/gcc-4.6 60 –slave /usr/bin/g++ g++ /usr/bin/g++-4.6
# sudo update-alternatives –install /usr/bin/gcc gcc /usr/bin/gcc-4.7 40 –slave /usr/bin/g++ g++ /usr/bin/g++-4.7

The command update-alternatives will now allow to switch between the versions. Simply use it to go to gcc 4.7 now:

# sudo update-alternatives –config gcc

This will show a list of alternatives from which you can select the new version, just follow the instructions.

Step 3: environment preparation – build tools installation

# sudo apt-get install git libtool build-essential pkg-config autoconf

Step 4: get VLC sources from git

# git clone git://git.videolan.org/vlc.git
# cd vlc
# ./bootstrap

Step 5: configure enabling the important modules for hardware acceleration on raspberry

This is a list of modules that are required, according to the base article:

# sudo apt-get install liba52-0.7.4-dev libdirac-dev libdvdread-dev libkate-dev libass-dev libbluray-dev libcddb2-dev libdca-dev libfaad-dev libflac-dev libmad0-dev libmodplug-dev libmpcdec-dev libmpeg2-4-dev libogg-dev libopencv-dev libpostproc-dev libshout3-dev libspeex-dev libspeexdsp-dev libssh2-1-dev liblua5.1-0-dev libopus-dev libschroedinger-dev libsmbclient-dev libtwolame-dev libx264-dev libxcb-composite0-dev libxcb-randr0-dev libxcb-xv0-dev libzvbi-dev

The following modules should also be installed to avoid problems:

  • No sound (bad…)

  • No XML support (cannot read playlists)

  • No SDL support (cannot switch to full screen, brings dbus support along)

  • No short keys (very bad, cannot pause/exit when in full screen)

  • And quite a few more

# sudo apt-get install libdvbpsi-dev libasound2-dev libxml2-dev libxpm-dev libsdl1.2-dev sdl-image1.2 libxcb-keysyms1-dev libxinerama-dev libxext-dev qt4-dev-tools

Maybe you want QtCreator as well if you have the Qt libraries anyway, but if you don’t want to write software with Qt, you don’t need that one:

# sudo apt-get qtcreator

Step 6: compile

Now do configure and build:

# ./configure –enable-rpi-omxil –enable-dvbpsi –enable-x264
# make clean all

Now go and watch TV, go to bed, whatever: That’ll take some six hours now.

As last step, start the installation:

# sudo make install

Step 7: The installed version of VLC will not find some libs

Some libs cannot be found after make install, so let’s help VLC out:

# sudo ln -s /usr/local/lib/libvlc* /usr/lib/
# sudo ln -s /usr/local/lib/libx264.a /usr/lib/
# sudo ln -s /usr/local/lib/vlc /usr/lib/vlc

Step 8: Start VLC

# vlc –vout omxil_vout

Change VLC properties

Change VLC properties

To make sure that VLC starts with hardware acceleration, the command line parameter should be added to the properties.

Step x: after recompiles

If you happen to recompile VLC (e.g. if you decide to change some configure option), remember to reset it after make install:

# vlc –reset-config –reset-plugins-cache

Resume

Now that VLC works with hardware acceleration I can say this is nice, but not as expected: With acceleration on I hoped that the videos would run inside the VLC window as usual. But they don’t – an overlay opens that shows the video that cannot be resized, just as with omxplayer.

Also, some videos that do run smoothly with omxplayer (like a full HD 1920×1080 Bluray Video by Nightwish) stops every 2 or 3 seconds for some 5 seconds. No good.

Seems to me I’ll have to put some extra work in it, still…

Bluray Full HD playback with omxplayer
Bluray Full HD playback with omxplayer

 

 




熱門推薦

本文由 jashliaoeuwordpress 提供 原文連結

寵物協尋 相信 終究能找到回家的路
寫了7763篇文章,獲得2次喜歡
留言回覆
回覆
精彩推薦