I had a a set of AVI's to convert and I wondered if I could utilise the raspberry pi I currently have connected to the network, rather than using a virtual machine on my test vm stack or pulling them down to my laptop for conversion. I use a Handbrake preset as a reliable way of doing conversions so my intention is to replicate this on the pi.
These instructions work to install Handbrake 0.98 on the pi. No pre built packages currently exist so you need to compile from source code. Im interested in using the command line version here, not sure if this will work for the X windows front end. But I just want something which can run efficiently at the command line.
First Download Handbrake Source Code:
This can be got from:
http://handbrake.fr/rotation.php?file=HandBrake-0.9.8.tar.bz2
Extract source tar:
tar -xjf handbrake.tar.bz2
Download and Install Dependancies:
There are a lot of dependancies, but ive managed to get it down to the following.
sudo apt-get install subversion yasm build-essential autoconf libtool zlib1g-dev libbz2-dev libfribidi-dev intltool libglib2.0-dev libdbus-glib-1-dev libgtk2.0-dev libgudev-1.0-dev libwebkit-dev libnotify-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev
Configure and Compile:
In the extracted directory:
sudo ./configure
Change to the build directory and build.
cd ./build
sudo make
Install HandBrake:
sudo make install
Run Handbrake Command Line:
You can run handrake from:
/usr/local/bin/HandBrakeCLI
I will post later some timings to see how a HandBrake encode on the pi compares to other platforms for speed.
Hi;
ReplyDeleteNice work. But i get "undefined reference to av_get_spu_flags" error when i give the make command. I did everything you said there. Can you help me?
Hi, I am currently doing a make myself and needed something to occupy my time (it is taking several hours...). I looked at the build instructions in the doc folder and simply copied the dependencies from Ubuntu (since it is a debian system too):
Deletesudo apt-get install subversion yasm build-essential autoconf libtool zlib1g-dev libbz2-dev libfribidi-dev intltool libglib2.0-dev libdbus-glib-1-dev libgtk2.0-dev libgudev-1.0-dev libwebkit-dev libnotify-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libappindicator-dev
D'oh - same error in the end...
DeleteWas this in the output of the make command? I remember seeing a few warnings but no critical errors. I will rerun the make to see what the output was.
ReplyDeleteyeah - lots of warnings. Mostly deprecation warnings; [variable] set but not used; initialization from incompatible pointer type and [variable] may be used uninitialized in this function.
DeleteBeen years since I have done any programming but I had a look through the code. I found the av_get_spu_flags function in one of the ffmpeg libraries (HandBrake-0.9.8/build/contrib/ffmpeg/ffmpeg-v0.7-1696-gcae4f4b/libavutil/cpu.c). I even managed to successfully build ffmpeg.
I even tried to tried to build HandBrake on my desktop machine (Ubuntu 10.04) but it complained of an old version of yasm - I so need to update things...
Here is a dump of the last thing it tried to do and the associated error:
libtool: link: g++ -g -O2 -I/home/pi/Downloads/HandBrake-0.9.8/build//libhb -D_ENABLE_GST -D_USE_APP_IND -Wl,--export-dynamic -Wl,--exclude-libs -Wl,ALL -Wl,-S -g0 -O3 -o ghb callbacks.o queuehandler.o audiohandler.o subtitlehandler.o x264handler.o main.o settings.o resources.o presets.o preview.o icons.o icon_tools.o values.o appcast.o plist.o hb-backend.o renderer_button.o ghbcellrenderertext.o ghbcompositor.o ghb-dvd.o marshalers.o -pthread -L/home/pi/Downloads/HandBrake-0.9.8/build//libhb -L/home/pi/Downloads/HandBrake-0.9.8/build//contrib/lib -lhb /home/pi/Downloads/HandBrake-0.9.8/build/contrib/lib/liba52.a /home/pi/Downloads/HandBrake-0.9.8/build/contrib/lib/libmkv.a -lavformat -lavcodec -lavutil /home/pi/Downloads/HandBrake-0.9.8/build/contrib/lib/libdca.a /home/pi/Downloads/HandBrake-0.9.8/build/contrib/lib/libdvdnav.a -L/home/pi/Downloads/HandBrake-0.9.8/build/contrib/lib /home/pi/Downloads/HandBrake-0.9.8/build/contrib/lib/libdvdread.a /home/pi/Downloads/HandBrake-0.9.8/build/contrib//lib/libfaac.a /home/pi/Downloads/HandBrake-0.9.8/build/contrib//lib/libmp3lame.a /home/pi/Downloads/HandBrake-0.9.8/build/contrib//lib/libmpeg2.a /home/pi/Downloads/HandBrake-0.9.8/build/contrib/lib/libvorbisenc.a /home/pi/Downloads/HandBrake-0.9.8/build/contrib/lib/libvorbis.a /home/pi/Downloads/HandBrake-0.9.8/build/contrib//lib/libsamplerate.a -lx264 /home/pi/Downloads/HandBrake-0.9.8/build/contrib/lib/libmp4v2.a -lswscale /home/pi/Downloads/HandBrake-0.9.8/build/contrib/lib/libtheora.a -L/home/pi/Downloads/HandBrake-0.9.8/build/contrib//lib /home/pi/Downloads/HandBrake-0.9.8/build/contrib/lib/libogg.a /home/pi/Downloads/HandBrake-0.9.8/build/contrib/lib/libbluray.a -lpthread /home/pi/Downloads/HandBrake-0.9.8/build/contrib/lib/libass.a -lfribidi -lgstinterfaces-0.10 -lgstvideo-0.10 /usr/lib/arm-linux-gnueabihf/libgstbase-0.10.so -lgstpbutils-0.10 /usr/lib/arm-linux-gnueabihf/libgstreamer-0.10.so -lgmodule-2.0 -lgthread-2.0 -lrt -lnotify -ldbus-glib-1 -ldbus-1 -lgudev-1.0 -lwebkitgtk-1.0 -lsoup-2.4 -ljavascriptcoregtk-1.0 -lappindicator -ldbusmenu-glib -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 /usr/lib/arm-linux-gnueabihf/libcairo.so -lpango-1.0 /home/pi/Downloads/HandBrake-0.9.8/build/contrib/lib/libfontconfig.a /home/pi/Downloads/HandBrake-0.9.8/build/contrib/lib/libfreetype.a -lbz2 /home/pi/Downloads/HandBrake-0.9.8/build/contrib/lib/libxml2.a -ldl -lz -lm -lgobject-2.0 -lglib-2.0 -pthread
/home/pi/Downloads/HandBrake-0.9.8/build//contrib/lib/libswscale.a(utils.o): In function `sws_init_context':
utils.c:(.text+0x22e4): undefined reference to `av_get_cpu_flags'
collect2: ld returned 1 exit status
make[3]: *** [ghb] Error 1
make[3]: Leaving directory `/home/pi/Downloads/HandBrake-0.9.8/build/gtk/src'
make[2]: *** [all-recursive] Error 1
make[2]: Leaving directory `/home/pi/Downloads/HandBrake-0.9.8/build/gtk'
make[1]: *** [all] Error 2
make[1]: Leaving directory `/home/pi/Downloads/HandBrake-0.9.8/build/gtk'
make: *** [gtk.build] Error 2
I did notice that HandBrakeCLI has been successfully built.
DeleteI think it is just the GUI that it is having trouble finishing off.
I may be able to live with that outcome - I mainly want to use my raspberry pi as a torrent client and for converting shows from my TiVo for watching on my 30min train ride to/from work. I have kmttg happily running and all it uses is HandBrakeCLI. Although on my desktop I normally run the GUI and have the tweaked presets for SD and HD content that work for all my devices (media player, iPod/iPhone, droid tablet)
But it would be nice to get the GUI working...
Finally managed to get it to build. I ran the make in debug mode (-d) and saw the actual command that was executed. I then manually re-ran the command and added in the cpu.o that it was complaining about not having.
DeleteIf anyone else wants to do this, cd to the folder:
HandBrake-0.9.8/build/gtk/src
Then execute the following command:
/bin/bash ../libtool --tag=CXX --mode=link g++ -g -O2 -I/home/pi/Downloads/HandBrake-0.9.8/build//libhb -D_ENABLE_GST -D_USE_APP_IND -Wl,--export-dynamic -Wl,--exclude-libs,ALL -Wl,-S -g0 -O3 -L/home/pi/Downloads/HandBrake-0.9.8/build//libhb -L/home/pi/Downloads/HandBrake-0.9.8/build//contrib/lib -o ghb callbacks.o queuehandler.o audiohandler.o subtitlehandler.o x264handler.o main.o settings.o resources.o presets.o preview.o icons.o icon_tools.o values.o appcast.o plist.o hb-backend.o renderer_button.o ghbcellrenderertext.o ghbcompositor.o ghb-dvd.o marshalers.o ../../contrib/ffmpeg/ffmpeg-v0.7-1696-gcae4f4b/libavutil/cpu.o -lhb -la52 -lmkv -lavformat -lavcodec -lavutil -ldca -ldvdnav -ldvdread -lfaac -lmp3lame -lmpeg2 -lvorbis -lvorbisenc -logg -lsamplerate -lx264 -lmp4v2 -lswscale -ltheora -lz -lbz2 -lpthread -lbluray -lass -lfontconfig -lfreetype -pthread -lgstinterfaces-0.10 -lgstvideo-0.10 -lgstbase-0.10 -lgstpbutils-0.10 -lgstreamer-0.10 -lgmodule-2.0 -lgthread-2.0 -lrt -lxml2 -lnotify -ldbus-glib-1 -ldbus-1 -lgudev-1.0 -lwebkitgtk-1.0 -lsoup-2.4 -ljavascriptcoregtk-1.0 -lappindicator -ldbusmenu-glib -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lglib-2.0
This was the final step in the make process and will create the executable (ghb). All that is left is the install:
sudo make install
Although it compiles and runs, when you try and actually perform an encode it terminates with an error:
DeleteIllegal instruction
contrib/x264/module.defs
ReplyDeleteneeds an additional
--disable-asm
in the config
That is because x264 asm needs NEON, leading to an "illegal isntruction"
Thanks everyone for you input!
ReplyDeleteIf you want to build Handbrake 0.9.9 you first need to install libvorbis-dev libass-dev libsamplerate-dev libogg-dev libtheora-dev
ReplyDeleteWell, I'm glad that you all got it going. I give props and thanks to the same person that made a package: nobody. As of my install (admittedly, my updates 10 months later could be the problem), this does not work (even using the advice in the comments). After 7 hours of compiling on my Pi, there is no usable binary produced.
ReplyDeleteCommon sense is unfortunately defined as "what is obvious to the person defining it".
Common sense: FICTIONAL NOUN. What is obvious to one, is not always obvious to another, let alone the masses. Unfortunately, even this is not obvious.
So, who is willing to submit a (current) working package?