Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 621228 - media-video/handbrake is not really compatible with ffmpeg (even not fully compatible with system libav)
Summary: media-video/handbrake is not really compatible with ffmpeg (even not fully co...
Status: RESOLVED UPSTREAM
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Ian Whyman (thev00d00) (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-06-08 16:47 UTC by Pacho Ramos
Modified: 2019-03-28 07:44 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
handbrake-1.0.7-r1.ebuild (handbrake-1.0.7-r1.ebuild,3.93 KB, text/plain)
2017-07-05 11:12 UTC, Pacho Ramos
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pacho Ramos gentoo-dev 2017-06-08 16:47:06 UTC
I was facing some issues and, after reporting to upstream, it seemed that upstream doesn't support any setup relying on system libs... and they are based on libav, then, incompatibilities with system ffmpeg are even worse:
https://github.com/HandBrake/HandBrake/issues/771

As you can see there, I have tried to suggest them to change this but they refuse to do anything... and I think that further discussion there will lead to nothing (at best). I don't see why if they don't have time to support all the variations, they use the less used variation in downstream... but I guess this is due to the usual ffmpeg vs libav way :(

Also some people reported to ffmpeg upstream... but that is neither to go anywhere:
https://trac.ffmpeg.org/ticket/6304

I, personally, think that maybe we could allow (via a default off USE flag) to rely on their bundled libav copy :/. Other option for the USE flag would be to rely on the system-ffmpeg (default on I guess for security concerns) USE flag for that. That USE flag would allow the usual "libav" USE handling (system-ffmpeg alone would default to system ffmpeg, system-ffmpeg+libav would use system libav and -system-ffmpeg would end up using the bundled/supported copy).

What do you think? Because I fail to see other options apart of discovering incompatibilities like this randomly on every version bump of relevant packages and upstream refusing to fix the bugs becauase they want to use their libav copy 

Thanks
Comment 1 Pacho Ramos gentoo-dev 2017-06-14 18:42:46 UTC
If you prefer , I can try to do the changes myself
Comment 2 Ian Whyman (thev00d00) (RETIRED) gentoo-dev 2017-06-26 19:00:30 UTC
It is annoying! Feel free to have a stab at it.
Comment 3 Pacho Ramos gentoo-dev 2017-07-05 11:12:24 UTC
Created attachment 480828 [details]
handbrake-1.0.7-r1.ebuild

For now it doesn't compile due to undefined symbols related with x265... probable we need to find how to pass -LX265 when internal libav is tried to be built :/

Anyway, it looks really ugly to make it not try to download libav, patch it and configure&build it during src_compile :S
Comment 4 Pacho Ramos gentoo-dev 2017-07-05 11:27:50 UTC
All that ugly stuff is done by make/include/contrib.defs

Ideally we should be able to replace most of that cruft downloading libav-12 from https://download.handbrake.fr/handbrake/contrib/libav-12.tar.gz and unpacking it to "${S}"/build/contrib/ffmpeg, also we should apply all the patches from "${S}"/contrib/ffmpeg

Regarding how to configure that libav copy... for now I got the options from the generated config.log :S
./configure --prefix=/var/tmp/portage/media-video/handbrake-1.0.7-r1/work/HandBrake-1.0.7/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-muxers --disable-network --disable-hwaccels --disable-vaapi --disable-vdpau --disable-encoders --enable-libmp3lame --enable-encoder=aac --enable-encoder=ac3 --enable-encoder=eac3 --enable-encoder=flac --enable-encoder=mpeg2video --enable-encoder=mpeg4 --enable-encoder=libmp3lame --enable-libopus --enable-encoder=libopus --enable-libvpx --enable-encoder=libvpx_vp8 --disable-decoder=libvpx_vp8 --enable-encoder=libvpx_vp9 --disable-decoder=libvpx_vp9 --enable-zlib --enable-bzlib --enable-pthreads --cc=/usr/lib64/ccache/bin/gcc --extra-ldflags='-O2 -pipe -march=native -fno-stack-protector -mfpmath=sse -msse2 -L/var/tmp/portage/media-video/handbrake-1.0.7-r1/work/HandBrake-1.0.7/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 --disable-debug --extra-cflags='-O2 -pipe -march=native -fno-stack-protector -mfpmath=sse -msse2 -I/var/tmp/portage/media-video/handbrake-1.0.7-r1/work/HandBrake-1.0.7/build/contrib/include -DNDEBUG'


But I don't know how handbrake will built against that copy and not the system one :/
Comment 5 Steve Dibb (RETIRED) gentoo-dev 2017-07-21 07:20:48 UTC
(In reply to Pacho Ramos from comment #4)
> All that ugly stuff is done by make/include/contrib.defs
> 
> Ideally we should be able to replace most of that cruft downloading libav-12
> from https://download.handbrake.fr/handbrake/contrib/libav-12.tar.gz and
> unpacking it to "${S}"/build/contrib/ffmpeg, also we should apply all the
> patches from "${S}"/contrib/ffmpeg
> 
> Regarding how to configure that libav copy... for now I got the options from
> the generated config.log :S
> ./configure
> --prefix=/var/tmp/portage/media-video/handbrake-1.0.7-r1/work/HandBrake-1.0.
> 7/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-muxers --disable-network
> --disable-hwaccels --disable-vaapi --disable-vdpau --disable-encoders
> --enable-libmp3lame --enable-encoder=aac --enable-encoder=ac3
> --enable-encoder=eac3 --enable-encoder=flac --enable-encoder=mpeg2video
> --enable-encoder=mpeg4 --enable-encoder=libmp3lame --enable-libopus
> --enable-encoder=libopus --enable-libvpx --enable-encoder=libvpx_vp8
> --disable-decoder=libvpx_vp8 --enable-encoder=libvpx_vp9
> --disable-decoder=libvpx_vp9 --enable-zlib --enable-bzlib --enable-pthreads
> --cc=/usr/lib64/ccache/bin/gcc --extra-ldflags='-O2 -pipe -march=native
> -fno-stack-protector -mfpmath=sse -msse2
> -L/var/tmp/portage/media-video/handbrake-1.0.7-r1/work/HandBrake-1.0.7/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
> --disable-debug --extra-cflags='-O2 -pipe -march=native -fno-stack-protector
> -mfpmath=sse -msse2
> -I/var/tmp/portage/media-video/handbrake-1.0.7-r1/work/HandBrake-1.0.7/build/
> contrib/include -DNDEBUG'
> 
> 
> But I don't know how handbrake will built against that copy and not the
> system one :/

Not that I want to give up, but, at what point do we decide that it's too much an effort to provide a possible solution that supports all the features (patches) that upstream does to their libraries?

On a larger scale, do we have a policy in general for packages that are impossible to completely decouple from the bundled libs?

Do we have an overlay somewhere that builds HandBrake using their methods that perhaps we can steer someone towards if they want?

We can build against our local libs, without all the patches, but I think it'd be sane to probably restrict them at least to the specific versions they are using (libav-12*, etc.).
Comment 6 Pacho Ramos gentoo-dev 2017-07-21 08:55:01 UTC
What we do for example with gst-plugins-libav (that uses ffmpeg and not libav in upstream side even with that name) is to rely on system libs for USE ffmpeg and bundled ffmpeg version for USE libav (to not break the tree for people having USE libav system wide).

The problem here is that not only libav is bundled... but all the libs :/, then, even if I would like to be able to simply build with bundled libs optionally via a USE flag, I am not sure if all people would agree :/

Maybe we could simply rely on a "vanilla" USE flag:
- vanilla -> build handbrake with all the bundled libs as upstream wants
- vanilla disabled -> the current "partially working" situation

What do you think about that? :/ 

But that still has some issues as building with upstream methods leads to ugly things to happen like downloading sources and running configure from src_compile :|

If upstream could, at least, be able to provide splitted "phases" to, for example, download all sources with one call, running all configures with another, build with another... But I doubt they will want to do that :(
Comment 7 Ian Whyman (thev00d00) (RETIRED) gentoo-dev 2018-05-12 08:50:14 UTC
Having myself been round that loop a few times, I am not sure what we can do here.

Thankfully normally we have new enough libraries to avoid breakages, but if upstream wont work with us I think we have to do our best with what we are offered.
Comment 8 Pacho Ramos gentoo-dev 2019-03-28 07:44:17 UTC
This was finally fixed upstream as they switched to follow ffmpeg some time ago:
https://github.com/HandBrake/HandBrake/issues/974