# HandBrake crashes



## tankist02 (Mar 25, 2015)

It looks recent updates broke HandBrake. When I installed official packages a couple of weeks ago it worked fine. Then I switched building from updated ports and noticed that handbrake started crashing while opening a file:


```
$ HandBrakeCLI -i test.avi -o test.mp4 -e x264 -q 20
[16:42:11] hb_init: starting libhb thread
HandBrake rev5474 (2015031199) - FreeBSD amd64 - http://handbrake.fr
4 CPUs detected
Opening test.avi...
[16:42:11] hb_scan: path=test.avi, title_index=1
libbluray/bdnav/index_parse.c:162: indx_parse(): error opening test.avi/BDMV/index.bdmv
libbluray/bdnav/index_parse.c:162: indx_parse(): error opening test.avi/BDMV/BACKUP/index.bdmv
libbluray/bluray.c:1725: nav_get_title_list(test.avi) failed (0x80600f000)
[16:42:11] bd: not a bd - trying as a stream/file instead
libdvdnav: Using dvdnav version 4.1.3
libdvdread: Missing symbols in libdvdcss.so.2, this shouldn't happen !
libdvdread: Using libdvdcss version  for DVD access
Segmentation fault (core dumped)
```


----------



## protocelt (Mar 27, 2015)

Hi,

If you switched from using pkg(8) to install packages to ports, I think your best bet while you won't like it, is too re-install all of your installed ports. That should fix any issues that you have now or will have in the near future from the result of mixing ports and packages.


----------



## tankist02 (Mar 30, 2015)

That's what I did. I rebuilt everything from ports using Poudriere. Mostly default options except vlc, mplayer and ffmeg where I enabled VDPAU/VAAPI (I have bad tearing without it). Then I disabled official packages location and pointed pkg to the poudriere repo following instructions in FreeBSD.conf. Then I ran

`pkg update
pkg upgrade -f`

Everything worked fine except HandBrake, though I am not sure when exactly it started crashing.


----------



## protocelt (Mar 30, 2015)

tankist02 said:


> That's what I did. I rebuilt everything from ports using poudriere. Mostly default options except vlc, mplayer and ffmeg where I enabled VDPAU/VAAPI (I have bad tearing without it). Then I disabled official packages location and pointed pkg to the poudriere repo following instructions in FreeBSD.conf. Then I ran
> 
> 
> ```
> ...


If you weren't aware already, it looks like there was a PR 197774 filed for this issue and was possibly fixed with the latest update to multimedia/handbrake.


----------



## tankist02 (Mar 31, 2015)

Updated ports, ran Poudriere build and got the following error:


```
set -e; cd ./contrib/ffmpeg/libav-v10.1/; ./configure --prefix=/wrkdirs/usr/ports/multimedia/handbrake/work/HandBrake-0.10.1/build/contrib/ --disable-shared --enable-static --enable-gpl --disable-doc --disable-bsfs --enable-bsf=aac_adtstoasc --disable-avconv --disable-avplay --disable-avprobe --disable-avdevice --disable-avfilter --disable-avserver --disable-muxers --disable-network --disable-hwaccels --disable-encoders --enable-encoder=aac --enable-encoder=ac3 --enable-encoder=flac --enable-encoder=mpeg2video --enable-encoder=mpeg4 --enable-libvpx --enable-encoder=libvpx_vp8 --disable-decoder=libvpx_vp8 --enable-zlib --enable-bzlib --cc="/usr/bin/cc" --extra-ldflags="-O2 -pipe -DLIBICONV_PLUG -fstack-protector -fno-strict-aliasing -I/usr/local/include -DLIBICONV_PLUG -L/wrkdirs/usr/ports/multimedia/handbrake/work/HandBrake-0.10.1/build/contrib/lib" --enable-nonfree --enable-libfdk-aac --enable-encoder=libfdk_aac --enable-muxer=matroska --enable-muxer=webm --enable-muxer=mov --enable-muxer=mp4 --enable-muxer=psp --enable-muxer=ipod --enable-pthreads --disable-devices --disable-debug --extra-cflags="-O2 -pipe -DLIBICONV_PLUG -fstack-protector -fno-strict-aliasing -I/usr/local/include -DLIBICONV_PLUG -I/wrkdirs/usr/ports/multimedia/handbrake/work/HandBrake-0.10.1/build/contrib/include -DNDEBUG"
ERROR: libvpx encoder version must be >=0.9.6

If you think configure made a mistake, make sure you are using the latest
version from Git.  If the latest version fails, report the problem to the
libav-tools@libav.org mailing list or IRC #libav on irc.freenode.net.
Include the log file "config.log" produced by configure as this will help
solving the problem.
../contrib/ffmpeg/module.rules:2: recipe for target 'contrib/ffmpeg/.stamp.configure' failed
gmake[1]: *** [contrib/ffmpeg/.stamp.configure] Error 1
gmake[1]: Leaving directory '/wrkdirs/usr/ports/multimedia/handbrake/work/HandBrake-0.10.1/build'
*** Error code 1

Stop.
make: stopped in /usr/ports/multimedia/handbrake
====>> Cleaning up wrkdir
===>  Cleaning for handbrake-0.10.1
build of multimedia/handbrake ended at Tue Mar 31 08:36:14 PDT 2015
build time: 00:00:44
!!! build failure encountered !!!
```

Installed version of libvpx:

`# pkg info libvpx`

```
libvpx-1.3.0
Name  : libvpx
Version  : 1.3.0
Installed on  : Sat Mar 21 13:32:49 PDT 2015
Origin  : multimedia/libvpx
Architecture  : freebsd:10:x86:64
Prefix  : /usr/local
Categories  : multimedia
Licenses  : BSD3CLAUSE
Maintainer  : ashish@FreeBSD.org
WWW  : http://www.webmproject.org/
Comment  : VP8/VP9 Codec SDK
Options  :
   DEBUG  : off
   POSTPROC  : on
   RUNTIME  : on
   SHARED  : on
   THREADS  : on
Shared Libs provided:
   libvpx.so.1
Annotations  :
   repo_type  : binary
   repository  : poudriere
Flat size  : 3.94MiB
Description  :
libvpx is the VP8/VP9 Codec SDK.

WWW: http://www.webmproject.org/
```

Anything else I should do to fix this problem?


----------



## protocelt (Mar 31, 2015)

It builds on my AMD64 box running CURRENT fine. Is this by chance a 32bit system your building on? A quick search pulled up this which looks like the same error your running into. If this is the case you may want to file a PR for this issue if one doesn't exist already.

EDIT: It looks like this error also happens on 10.1-RELEASE AMD64 as well.


----------



## talsamon (Apr 2, 2015)

I see the maintainer marked it as broken. Curiously on my sytem (10.1-RELEASE.p8; amd64) it compiled without problems.  I can't say why, maybe it's the the version of ffmpeg:
`pkg info ffmpeg\*`

```
ffmpeg-2.3.6_1,1
ffmpeg26-2.6.1
```

(but it's only a guess)..


----------



## talsamon (Apr 2, 2015)

But it fails in poudriere with:

```
../contrib/ffmpeg/module.rules:2: recipe for target 'contrib/ffmpeg/.stamp.configure' failed
gmake[1]: *** [contrib/ffmpeg/.stamp.configure] Error 1
gmake[1]: Leaving directory '/wrkdirs/usr/ports/multimedia/handbrake/work/HandBrake-0.10.1/build'
*** Error code 1
```
Also fails with `portmaster`.


----------



## talsamon (Apr 2, 2015)

I updated my system 18 Minutes ago, now it works anymore. What is changed in the last update?


----------



## talsamon (Apr 2, 2015)

Maybe, I have found it.
I have commented out this two lines in the Makefile:


```
#  ${TOUCH} ${BUILD_WRKSRC}/contrib/libvpx/.stamp.extract
#  ${TOUCH} ${BUILD_WRKSRC}/contrib/x264/.stamp.extract
```

and multimedia/handbrake compiles and starts. (Don't know what this lines exactly do). I have not tested if it works right. I will send this to the maintainer.


----------



## talsamon (Apr 2, 2015)

The maintainer wrote I shall post a bugreport - PR 199126.


----------



## talsamon (Apr 2, 2015)

Seems this may be the definite cause.

I put in the Makefile under `LIB_DEPENDS=`

```
libvpx.so:${PORTSDIR}/multimedia/libvpx \
libx264.so:${PORTSDIR}/multimedia/libx264
```
Seems they are missed.

And uncommented the two lines I commented out before.

Seems to work.


----------



## talsamon (Apr 3, 2015)

*tankist02* I have tested converting flv to mp4, this works (found no avi in the moment).


----------



## tankist02 (Apr 3, 2015)

I updated the ports and now get this:


```
# make
===>  handbrake-0.10.1 is marked as broken: Fails to build.
*** Error code 1

Stop.
make: stopped in /usr/ports/multimedia/handbrake
```

My platform:


```
FreeBSD bclinton 10.1-STABLE FreeBSD 10.1-STABLE #0 r280839: Tue Mar 31 22:00:24 PDT 2015  toor@bclinton:/usr/obj/usr/src/sys/GENERIC  amd64
```


----------



## tankist02 (Apr 3, 2015)

If I comment out


```
#BROKEN=  Fails to build
```

in the port Makefile then handbrake builds and works just fine.


----------



## tankist02 (Apr 4, 2015)

What's interesting is that while I can build Handbrake using its port directly:

`cd /usr/ports
make`

but the build fails in Poudriere which uses the same /usr/ports tree. I don't have Poudriere-specific make settings. Poudriere jail is the same architecture (amd64 10-STABLE) with the same svn revision as the host system. All related packages options are default (I think).

What should I check?


----------



## talsamon (Apr 4, 2015)

If you created `poudriere` with `poudriere ports -c` , then it has an own portstree.
On my system it's /usr/local/poudriere/ports/default/. If it is so, you have change the multimedia/handbrake/Makefile too. (Or wait till is fixed with an update).
With which command you run poudriere?


----------



## tankist02 (Apr 4, 2015)

Poudriere uses common ports:


```
poudriere ports -l
PORTSTREE METHOD TIMESTAMP PATH
default  -  /usr/ports
```

because I set it up with:


```
poudriere ports -c -F -f none -M /usr/ports -p default
```

To build packages:


```
poudriere bulk -f ~/ports.list -j 10-stable-amd64
```


----------



## talsamon (Apr 4, 2015)

As I looked now in my Makefile I see it's overwritten, you have to put in the two lines  again.


----------



## talsamon (Apr 4, 2015)

Sorry, that was a mistake. I deinstalled multimedia/handbrake and reinstall it in the port. It compiles fine without any changes in the Makefile. Seems someone has changed something I not noticed (maybe it's related to update of multimedia/libav today, but I don't know).
Maybe, you had only update again.


----------



## talsamon (Apr 4, 2015)

Now I am puzzled too. Same effect as you. It builds normal in the port, but not in poudriere - strange (With the "old" error).


----------



## kpa (Apr 4, 2015)

Tried building multimedia/handbrake out of interest on my ports-mgmt/poudriere-devel builder. It fails in configure stage with:


```
...
set -e; cd ./contrib/ffmpeg/libav-v10.1/; ./configure --prefix=/wrkdirs/usr/ports/multimedia/handbrake/work/HandBrake-0.10.1/build/contrib/ --disable-shared --enable-static --enable-gpl --disable-doc --disable-bsfs --enable-bsf=aac_adtstoasc --disable-avconv --disable-avplay --disable-avprobe --disable-avdevice --disable-avfilter --disable-avserver --disable-muxers --disable-network --disable-hwaccels --disable-encoders --enable-encoder=aac --enable-encoder=ac3 --enable-encoder=flac --enable-encoder=mpeg2video --enable-encoder=mpeg4 --enable-libvpx --enable-encoder=libvpx_vp8 --disable-decoder=libvpx_vp8 --enable-zlib --enable-bzlib --cc="/usr/bin/cc" --extra-ldflags="-O2 -pipe -DLIBICONV_PLUG -fstack-protector -fno-strict-aliasing -I/usr/local/include -DLIBICONV_PLUG -L/wrkdirs/usr/ports/multimedia/handbrake/work/HandBrake-0.10.1/build/contrib/lib" --enable-nonfree --enable-libfdk-aac --enable-encoder=libfdk_aac --enable-muxer=matroska --enable-muxer=webm --enable-muxer=mov --enable-muxer=mp4 --enable-muxer=psp --enable-muxer=ipod --enable-pthreads --disable-devices --disable-debug --extra-cflags="-O2 -pipe -DLIBICONV_PLUG -fstack-protector -fno-strict-aliasing -I/usr/local/include -DLIBICONV_PLUG -I/wrkdirs/usr/ports/multimedia/handbrake/work/HandBrake-0.10.1/build/contrib/include -DNDEBUG"
ERROR: libvpx encoder version must be >=0.9.6
```

All options for the port are the defaults. It looks like it's failing to detect the bundled libvpx properly.


----------



## talsamon (Apr 20, 2015)

It seems there's another bug. Update to handbrake-0.10.1_2 causes other errors.
I write it in the PR 199126.


----------



## talsamon (Apr 21, 2015)

Maintainer writes:


> handbrake likes to use its own libraries and may not behave if a conflicting library has been installed.  You need to deinstall multimedia/x265 before building.  The attached patch will make this explicit.



And so it was. (But it is not the nice way...).


----------

