LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   HandBrake giving segmentation faults from SBo and Alien's script (https://www.linuxquestions.org/questions/slackware-14/handbrake-giving-segmentation-faults-from-sbo-and-aliens-script-4175501444/)

moisespedro 04-12-2014 08:25 AM

HandBrake giving segmentation faults from SBo and Alien's script
 
I've installed HandBrake some time ago from SBo but never used it, today while trying to encode a video (with x264 encoder) the softwares crashes and, by running it via terminal, it reported a segmentation fault.

I went on Google and found a few things like this bugreport on Ubuntu.

Because of this part:
Quote:

Configure x264 with "--extra-cflags=-fno-aggressive-loop-optimizations" solves this problem.
Also seems that problem solved in trunk - http://git.videolan.org/?p=x264.git;...eb12504711b94f
I thought that simply using a newer version of the x264 tarball would work, I grabbed Alien's script (that also had the same problem) and edited as this:

Code:

pedro@darkstar:~/Downloads/slackware/alien_repository/handbrake/build$ diff handbrake.SlackBuild /home/pedro/SlackBuilds/14.1/handbrake/handbrake.SlackBuild                                                                                                                                                               
94c94
< X264="r2273-b3065e6"
---
> X264=20140411-2245
156,157c156,157
< SOURCE[14]="$SRCDIR/x264-$X264.tar.gz"
< SRCURL[14]="$CONTRIBURL/x264-$X264.tar.gz"
---
> SOURCE[14]="$SRCDIR/x264-snapshot-${X264}.tar.bz2"
> SRCURL[14]="ftp://ftp.videolan.org/pub/videolan/x264/snapshots/x264-snapshot-${X264}.tar.bz2"
pedro@darkstar:~/Downloads/slackware/alien_repository/handbrake/build$

But it still doesn't work, HandBrake keeps giving a segmentation error.

WhiteWolf1776 04-12-2014 10:16 AM

Some backups don't run properly with Handbrake, so you may need to use makeMkv as a first step. I've not seen this encode issue from a makeMkv output.

Handbrake being only a transcoder, sometimes it needs better inputs to work from. I use aliens pre-built blob.

moisespedro 04-12-2014 11:52 AM

I don't get what you meant. HandBrake always crashes when I try to encode a video using x264, if I switch the encoder to MPEG-4 it runs fine.

Mark Pettit 04-12-2014 12:35 PM

I also recommend AlienBobs prebuilt binary. In fact, If there's anything I want and he has it, that's my first port of call. Period. No arguments.

moisespedro 04-12-2014 01:23 PM

Quote:

Originally Posted by Mark Pettit (Post 5151317)
I also recommend AlienBobs prebuilt binary. In fact, If there's anything I want and he has it, that's my first port of call. Period. No arguments.

I used it and still got the segmentation fault, I used his default script.

moisespedro 04-12-2014 01:50 PM

Well, I decided to try the prebuilt package and it works. Damn, something might be wrong in my system.

j_v 04-12-2014 02:40 PM

Out of curiosity, I tried to test this with the SBo package. Transcoding segfaulted here as well, except if I used the "Placebo" preset. I think you make a good choice to use AlienBOB's prebuilt. I've found that his binaries are quite reliable. I do most of my transcoding using ffmpeg, but have for long been curious about HandBrake. I noted a common error just before segfaults:
Code:

x264 [warning]: --psnr used with psy on: results will be invalid!
x264 [warning]: --tune psnr should be used if attempting to benchmark psnr!

I intend to find the meaning of these errors and figure out what is the cause.

moisespedro 04-12-2014 03:32 PM

Quote:

Originally Posted by j_v (Post 5151363)
Out of curiosity, I tried to test this with the SBo package. Transcoding segfaulted here as well, except if I used the "Placebo" preset. I think you make a good choice to use AlienBOB's prebuilt. I've found that his binaries are quite reliable. I do most of my transcoding using ffmpeg, but have for long been curious about HandBrake. I noted a common error just before segfaults:
Code:

x264 [warning]: --psnr used with psy on: results will be invalid!
x264 [warning]: --tune psnr should be used if attempting to benchmark psnr!

I intend to find the meaning of these errors and figure out what is the cause.

I didn't understand why changing x264 version didn't fix the problem. I also used alien's script with no modifications and the generated binary gave me segmentation faults.

Alien Bob 04-12-2014 04:00 PM

Quote:

Originally Posted by moisespedro (Post 5151339)
I used it and still got the segmentation fault, I used his default script.

Did you install my package or did you use my handbrake.SlackBuild script to produce your own package?

Eric

j_v 04-12-2014 04:38 PM

This page references the bug: https://bugs.launchpad.net/ubuntu/+s...4/+bug/1241772. I have tested the added CFLAG on the SBo SlackBuild and it fixes the issue for me. I will get in touch with the maintainer after dinner.

j_v 04-12-2014 05:04 PM

Here is a link to the patch:

https://github.com/jvvv/slackbuilds/...segfault.patch

I'll be notifying package maintainer after I post this.

Just adding the usual SLKCFLAGS didn't work. So I saved the current environment for CFLAGS and CXXFLAGS, exported the SLKCFLAGS as CFLAGS and CXXFLAGS, and then restored the saved CFLAGS and CXXFLAGS after compilation completes; this worked for me.

Cheers

moisespedro 04-12-2014 05:24 PM

Quote:

Originally Posted by Alien Bob (Post 5151382)
Did you install my package or did you use my handbrake.SlackBuild script to produce your own package?

Eric

As I said before on the thread:
I tried SBo's stock script
I tried yours stock script
I tried a modified version of your script with a newer x264 tarball

All of them gave me the segmentation error. Now I've installed your prebuilt package and it works fine.

Alien Bob 04-12-2014 05:37 PM

Quote:

Originally Posted by moisespedro (Post 5151414)
As I said before on the thread:
I tried SBo's stock script
I tried yours stock script
I tried a modified version of your script with a newer x264 tarball

All of them gave me the segmentation error. Now I've installed your prebuilt package and it works fine.

My package works fine because it was compiled with gcc-4.7. The bug in x264 is only present when you compile it with gcc-4.8 ...

Eric

moisespedro 04-12-2014 05:40 PM

Quote:

Originally Posted by Alien Bob (Post 5151426)
My package works fine because it was compiled with gcc-4.7. The bug in x264 is only present when you compile it with gcc-4.8 ...

Eric

Well but since someone said this on the bugreport

Quote:

Configure x264 with "--extra-cflags=-fno-aggressive-loop-optimizations" solves this problem.
Also seems that problem solved in trunk - http://git.videolan.org/?p=x264.git;...eb12504711b94f
And the bug report is 6 months old I thought a newer tarball would fix it (I used the latest tarball avaliable)

Alien Bob 04-12-2014 05:49 PM

Quote:

Originally Posted by moisespedro (Post 5151427)
And the bug report is 6 months old I thought a newer tarball would fix it (I used the latest tarball avaliable)

Are you sure the build used that newer tarball? Handbrake downloads a very specific version of x264 which is hardcoded in the build script. All my SlackBuild script does is download it beforehand, so that you can do an offline build of the package.
Check your build log (you kept a log did you?) and find out if a x264 tarball was downloaded before the compilation started.

Eric

j_v 04-12-2014 05:50 PM

@Alien Bob: I was wondering how your package worked and not home built ones. At first, I concidered that maybe you had some special CFLAGS in your environment, but that seemed far fetched. I read your slackbuild, and could not find a major difference that told me: "Ah, this is where he fixes the issue!" Thanks for your input and insight.

Cheers,
John

EDIT: rereading this now, it sounds like I am asking a question, but it is just me having an "aha" moment about the difference it made (re: resulting in usable binaries) that you compiled with gcc-4.7.

moisespedro 04-12-2014 07:32 PM

Quote:

Originally Posted by Alien Bob (Post 5151434)
Are you sure the build used that newer tarball? Handbrake downloads a very specific version of x264 which is hardcoded in the build script. All my SlackBuild script does is download it beforehand, so that you can do an offline build of the package.
Check your build log (you kept a log did you?) and find out if a x264 tarball was downloaded before the compilation started.

Eric

Yes, I am sure the newer tarball was used. I removed the old one, the new one was downloaded, extracted and then used. No, I don't have a log. I am still getting the hang of this stuff so I am kinda disorganized.

Alien Bob 04-13-2014 05:05 AM

Quote:

Originally Posted by moisespedro (Post 5151467)
Yes, I am sure the newer tarball was used. I removed the old one, the new one was downloaded, extracted and then used. No, I don't have a log. I am still getting the hang of this stuff so I am kinda disorganized.

I applied the diff you posted earlier on (that changes the version and the download URL of the x264 source tarball) and ran a build. This is what I find in the log file:

Code:

...

  : /usr/bin/wget -O ../download/x264-r2273-b3065e6.tar.gz http://download.handbrake.fr/handbrake/contrib/x264-r2273-b3065e6.tar.gz
  : /usr/bin/mkdir -p contrib/x264/
  : /usr/bin/mkdir -p contrib/libbluray/
  : --2014-04-13 11:34:41--  http://download.handbrake.fr/handbrake/contrib/x264-r2273-b3065e6.tar.gz
  : Resolving download.handbrake.fr (download.handbrake.fr)... /usr/bin/mkdir -p test/

...

  : Connecting to download.handbrake.fr (download.handbrake.fr)|88.190.242.142|:80... connected.
  : HTTP request sent, awaiting response... 200 OK
  : Length: 681489 (666K) [text/plain]
  : Saving to: '../download/x264-r2273-b3065e6.tar.gz'
  :
  :      0K .......... .......... .......... .......... ..........  7%  508K 1s
  :    50K .......... .......... .......... .......... .......... 15%  833K 1s
  :    100K .......... .......... .......... .......... .......... 22% 1.02M 1s
  :    150K .......... .......... .......... .......... .......... 30%  955K 1s
  :    200K .......... .......... .......... .......... .......... 37%  958K 1s
  :    250K .......... .......... .......... .......... .......... 45% 1011K 0s
  :    300K .......... .......... .......... .......... .......... 52% 1.29M 0s
  :    350K .......... .......... .......... .......... .......... 60%  807K 0s
  :    400K .......... .......... .......... .......... .......... 67% 1.39M 0s
  :    450K .......... .......... .......... .......... .......... 75% 1.33M 0s
  :    500K .......... .......... .......... .......... .......... 82%  912K 0s
  :    550K .......... .......... .......... .......... .......... 90% 1.24M 0s
  :    600K .......... .......... .......... .......... .......... 97%  830K 0s
  :    650K .......... .....                                      100% 6.16M=0.7s
  :
  : 2014-04-13 11:34:42 (966 KB/s) - '../download/x264-r2273-b3065e6.tar.gz' saved [681489/681489]

...

  : /usr/bin/tar xfC ../download/x264-r2273-b3065e6.tar.gz ./contrib/x264/
  : touch contrib/x264/.stamp.extract

...

... meaning your newer x264 source is never used, and the handbrake Makefile still downloads the version it has hardcoded.
It is always a good idea to log your compilation process, or even the output of any long-running process which fills more than one screen.

Eric

moisespedro 04-13-2014 05:39 AM

Oh, my mistake then. I apologize.

ponce 04-13-2014 06:05 AM

if feel like testing it, now that I know the cause (thanks Eric!) I created a patch to apply to the Slackbuild on SBo: it updates x264 to the latest snapshot tarball
Code:

diff -Naur HandBrake.orig/HandBrake.SlackBuild HandBrake/HandBrake.SlackBuild
--- HandBrake.orig/HandBrake.SlackBuild 2014-03-25 17:46:03.408351684 +0100
+++ HandBrake/HandBrake.SlackBuild      2014-04-13 12:50:13.664933681 +0200
@@ -5,10 +5,11 @@
 # This slackbuild maintained by Klaatu at klaatu@hackerpublicradio.org
 # Modified by David Somero at SlackBuilds.org.
 # Modified by Erik Hanson at SlackBuilds.org
+# Modified by Matteo Bernardini at SlackBuilds.org
 
 PRGNAM=HandBrake
 VERSION=${VERSION:-0.9.9}
-BUILD=${BUILD:-1}
+BUILD=${BUILD:-2}
 TAG=${TAG:-_SBo}
 
 if [ -z "$ARCH" ]; then
@@ -47,10 +48,19 @@
 chown -R root:root .
 find -L . \
  \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
-  -o -perm 511 \) -exec chmod 755 {} \; -o \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
  \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
  -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
 
+# Update to a more recent x264 to avoid segfaults
+sed -i \
+  -e "s|\ 130$| 142|" \
+  -e "s|r2273\ b3065e6|r2273 aff928d|" \
+  contrib/x264/A00-version-string.patch || exit 1
+sed -i \
+  "s|^X264\.FETCH\.url.*|X264.FETCH.url = http://ponce.cc/slackware/sources/repo/x264-r2273_aff928d.tar.bz2|" \
+  contrib/x264/module.defs || exit 1
+
 ./configure \
  --prefix=/usr \
  --disable-gtk-update-checks \
diff -Naur HandBrake.orig/HandBrake.info HandBrake/HandBrake.info
--- HandBrake.orig/HandBrake.info      2014-03-25 17:46:03.408351684 +0100
+++ HandBrake/HandBrake.info    2014-04-13 12:51:20.511933681 +0200
@@ -25,7 +25,7 @@
          http://mp4v2.googlecode.com/files/mp4v2-trunk-r355.tar.bz2 \
          http://download.m0k.org/handbrake/contrib/mpeg2dec-0.5.1.tar.gz \
          http://download.m0k.org/handbrake/contrib/pthreads-w32-cvs20100909.tar.bz2 \
-          http://download.handbrake.fr/handbrake/contrib/x264-r2273-b3065e6.tar.gz \
+          http://ponce.cc/slackware/sources/repo/x264-r2273_aff928d.tar.bz2 \
          http://download.m0k.org/handbrake/contrib/zlib-1.2.3.tar.gz"
 MD5SUM="ee81337a46f8af76599d6038f193a2c1 \
        ce5a978bb359f642dcbd24c6e14a45a7 \
@@ -51,7 +51,7 @@
        38a753e936df5ef4c2f7de3d16f440f6 \
        a6173dc90cfe7f0414624c3c8bbad727 \
        d1dea735b53176567e9841ca77388633 \
-        10a0f3307027f2d8321f4d834e319208 \
+        95a848eddf84a4c3ba6477d7f365ff63 \
        af3358a811ad3469a2e54db49f77d52a"
 DOWNLOAD_x86_64=""
 MD5SUM_x86_64=""


j_v 04-13-2014 08:37 AM

@ponce: I've tested your patch and it works good for me.


All times are GMT -5. The time now is 06:53 AM.