Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handbrake v1.3.2 on RaspberryPi 4 with Raspian Buster #2

Open
der-ule opened this issue May 11, 2020 · 15 comments
Open

Handbrake v1.3.2 on RaspberryPi 4 with Raspian Buster #2

der-ule opened this issue May 11, 2020 · 15 comments

Comments

@der-ule
Copy link

der-ule commented May 11, 2020

Hi there,

I came across your instructions today and I was able to successfully compile Handbrake v1.3.2 on the Raspberry Pi 4 with Raspian Buster, I just needed to add a two dependencies, otherwise, everything worked perfectly, thank you!

1. Missing dependencies meson and libnuma-dev

sudo apt-get install git autoconf automake build-essential cmake libass-dev libbz2-dev libfontconfig1-dev libfreetype6-dev libfribidi-dev libharfbuzz-dev libjansson-dev liblzma-dev libmp3lame-dev libogg-dev libopus-dev libsamplerate-dev libspeex-dev libtheora-dev libtool libtool-bin libvorbis-dev libx264-dev libxml2-dev m4 make patch pkg-config python tar yasm zlib1g-dev libvpx-dev xz-utils bzip2 zlib1g meson libnuma-dev

3. Download source code directly from official website

https://handbrake.fr/rotation.php?file=HandBrake-1.3.2-source.tar.bz2

I hope this helps anyone trying this.

@rafaelmaeuer
Copy link

Hey thank you for sharing this.

I tried to rebuild it with your updates but make -j $(nproc) fails with following error:

/usr/bin/ld: ./contrib/lib/libx265.a(cpu.cpp.o): in function `x265::cpu_detect(bool)':
cpu.cpp:(.text+0x24): undefined reference to `x265_cpu_fast_neon_mrc_test'
/usr/bin/ld: ./contrib/lib/libx265.a(cpu.cpp.o): in function `x265_10bit::cpu_detect(bool)':
cpu.cpp:(.text+0x24): undefined reference to `x265_10bit_cpu_fast_neon_mrc_test'
/usr/bin/ld: ./contrib/lib/libx265.a(cpu.cpp.o): in function `x265_12bit::cpu_detect(bool)':
cpu.cpp:(.text+0x24): undefined reference to `x265_12bit_cpu_fast_neon_mrc_test'
collect2: error: ld returned 1 exit status
make: *** [../test/module.rules:47: HandBrakeCLI] Fehler 1

Any idea how to fix this?

@der-ule
Copy link
Author

der-ule commented Oct 7, 2020

Can it be that you forgot STEP 6 ?

https://github.com/kapitainsky/handbreak-RaspberryPi#6-we-have-to-make-quick-and-dirty-hack-to-x265-source-code

Otherwise I wouldn't know, I just followed all the step as described and worked perfectly (after the extra dependencies).

Good luck.

@rafaelmaeuer
Copy link

Thanks for the fast reply!

No, I pay attention to every step.
But I have repeated the process several times and tried to skip some steps without luck.

Step 6 has a different path though: ./contrib/x265/x265_3.2.1/source/common/primitives.cpp.
Might the x265 version make the difference? Did you compile with x265_3.0 instead of x265_3.2.1?

For me x265 is irrelevant, I only need x264, is it possible to disable x265 on compilation?

@der-ule
Copy link
Author

der-ule commented Oct 7, 2020

I just gave it another try and it worked fine, here are my steps from step #3:

wget https://github.com/HandBrake/HandBrake/releases/download/1.3.2/HandBrake-1.3.2-source.tar.bz2

tar -xf HandBrake-1.3.2-source.tar.bz2

cd HandBrake-1.3.2/

echo "X265_8.CONFIGURE.extra += -DENABLE_ASSEMBLY=OFF -DENABLE_PIC=ON -DENABLE_AGGRESSIVE_CHECKS=ON -DENABLE_TESTS=ON -DCMAKE_SKIP_RPATH=ON" >> ./contrib/x265_8bit/module.defs && echo "X265_10.CONFIGURE.extra += -DENABLE_ASSEMBLY=OFF -DENABLE_PIC=ON -DENABLE_AGGRESSIVE_CHECKS=ON -DENABLE_TESTS=ON -DCMAKE_SKIP_RPATH=ON" >> ./contrib/x265_10bit/module.defs && echo "X265_12.CONFIGURE.extra += -DENABLE_ASSEMBLY=OFF -DENABLE_PIC=ON -DENABLE_AGGRESSIVE_CHECKS=ON -DENABLE_TESTS=ON -DCMAKE_SKIP_RPATH=ON" >> ./contrib/x265_12bit/module.defs && echo "X265.CONFIGURE.extra += -DENABLE_ASSEMBLY=OFF -DENABLE_PIC=ON -DENABLE_AGGRESSIVE_CHECKS=ON -DENABLE_TESTS=ON -DCMAKE_SKIP_RPATH=ON" >> ./contrib/x265/module.defs

./configure --launch-jobs=$(nproc) --disable-gtk --disable-nvenc --disable-qsv --enable-fdk-aac

cd build/

make -j $(nproc) (wait for downloads to finish and interrupt)

nano ./contrib/x265/x265_3.2.1/source/common/primitives.cpp

Modify the file to look like this (change == to !=)

tail -6 ./contrib/x265/x265_3.2.1/source/common/primitives.cpp
#if X265_ARCH_ARM != 0
void PFX(cpu_neon_test)(void) {}
int PFX(cpu_fast_neon_mrc_test)(void) { return 0; }
#endif // X265_ARCH_ARM
}
#endif

make clean

make -j $(nproc)

And here my OS information

pi@raspberrypi:~/test_handbrake/HandBrake-1.3.2/make $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
pi@raspberrypi:~/test_handbrake/HandBrake-1.3.2/make $ uname -a
Linux raspberrypi 4.19.97-v7l+ #1294 SMP Thu Jan 30 13:21:14 GMT 2020 armv7l GNU/Linux

I hope this helps you, for the rest, the author posted a couple of links as reference, you may find more information in them.

Good luck.

@rafaelmaeuer
Copy link

Wow this time it run through, I explicitly executed Step 2 again:

sudo curl -L 'http://ftp.debian.org/debian/pool/main/n/nasm/nasm_2.14-1_armhf.deb' -o /var/cache/apt/archives/nasm_2.14-1_armhf.deb && sudo dpkg -i /var/cache/apt/archives/nasm_2.14-1_armhf.deb

But not sure if this made the difference, regarding the steps you mentioned above...
Thanks for your help! As next step I try to build the user-interface too...

@der-ule
Copy link
Author

der-ule commented Oct 7, 2020

I am glad that it worked out, I did not repeated steps #1 and #2 above because it is still the same raspberry :)

BTW I just gave it a try with the new v1.3.3 release, it works the same:
https://handbrake.fr/rotation.php?file=HandBrake-1.3.3-source.tar.bz2

@kapitainsky
Copy link
Owner

I do not have running RPi at the moment to test but I can see that there is newer nasm, so maybe in step 2 replacing
nasm_2.14-1_armhf.deb with nasm_2.15.05-1_armhf.deb can improve situation.

@kapitainsky
Copy link
Owner

I also thing that I should update step 3 - as I understand from your posts it works perfectly now with HandBreak 1.3.2 or 1.3.3 and it is not required to cherry pick specific commit

@kapitainsky
Copy link
Owner

@rafaelmaeuer could you please share if you succeeded building UI?

@der-ule
Copy link
Author

der-ule commented Oct 7, 2020

That's right v1.3.2 and v1.3.3 compile without a problems:

pi@raspberrypi:~/test_handbrake/HandBrake-1.3.3/build $ ./HandBrakeCLI --version
[12:01:41] hb_init: starting libhb thread
[12:01:41] thread b3d702f0 started ("libhb")
HandBrake 1.3.3

@rafaelmaeuer
Copy link

@kapitainsky I was successful in building the GUI for v1.3.3. Thanks again for sharing this!
Find all updates in my fork: https://github.com/rafaelmaeuer/handbrake-raspberry-pi

@kapitainsky
Copy link
Owner

@rafaelmaeuer do you mind if I include GUI parts in my guide?

@rafaelmaeuer
Copy link

no feel free :)

@plusterkopp
Copy link

plusterkopp commented Feb 18, 2021

Would it be possible to somehow use the latest x265 with aarch64 assembly? http://x265.org/faster-arm64-encodes-using-x265/
Not that the speedup is too great. But can one take a prebuilt set of x265 libs and just compile the rest of handbrake?

@Rowley2504
Copy link

Just got 1.6.1 to build

sudo apt install libturbojpeg0-dev git autoconf automake build-essential cmake libass-dev libbz2-dev libfontconfig1-dev libfreetype6-dev libfribidi-dev libharfbuzz-dev libjansson-dev liblzma-dev libmp3lame-dev libogg-dev libopus-dev libsamplerate-dev libspeex-dev libtheora-dev libtool libtool-bin libvorbis-dev libx264-dev libxml2-dev m4 make patch pkg-config python tar yasm zlib1g-dev libvpx-dev xz-utils bzip2 zlib1g meson libnuma-dev

wget https://github.com/HandBrake/HandBrake/releases/download/1.6.1/HandBrake-1.6.1-source.tar.bz2

tar -xf HandBrake-1.6.1-source.tar.bz2

cd HandBrake-1.6.1/

echo "X265_8.CONFIGURE.extra += -DENABLE_ASSEMBLY=OFF -DENABLE_PIC=ON -DENABLE_AGGRESSIVE_CHECKS=ON -DENABLE_TESTS=ON -DCMAKE_SKIP_RPATH=ON" >> ./contrib/x265_8bit/module.defs && echo "X265_10.CONFIGURE.extra += -DENABLE_ASSEMBLY=OFF -DENABLE_PIC=ON -DENABLE_AGGRESSIVE_CHECKS=ON -DENABLE_TESTS=ON -DCMAKE_SKIP_RPATH=ON" >> ./contrib/x265_10bit/module.defs && echo "X265_12.CONFIGURE.extra += -DENABLE_ASSEMBLY=OFF -DENABLE_PIC=ON -DENABLE_AGGRESSIVE_CHECKS=ON -DENABLE_TESTS=ON -DCMAKE_SKIP_RPATH=ON" >> ./contrib/x265_12bit/module.defs && echo "X265.CONFIGURE.extra += -DENABLE_ASSEMBLY=OFF -DENABLE_PIC=ON -DENABLE_AGGRESSIVE_CHECKS=ON -DENABLE_TESTS=ON -DCMAKE_SKIP_RPATH=ON" >> ./contrib/x265/module.defs

./configure --launch-jobs=$(nproc) --disable-gtk --disable-nvenc --disable-qsv --enable-fdk-aac

cd build/

make -j $(nproc) (wait for downloads to finish and interrupt)

nano ./contrib/x265/x265-snapshot-20221130-12747/source/common/primitives.cpp

Modify the file to look like this (change == to !=)

tail -6 ./contrib/x265/x265_3.2.1/source/common/primitives.cpp
#if X265_ARCH_ARM != 0
void PFX(cpu_neon_test)(void) {}
int PFX(cpu_fast_neon_mrc_test)(void) { return 0; }
#endif // X265_ARCH_ARM
}
#endif
make clean

make -j $(nproc)
sudo make install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants