Bug 5469

Summary: Update HandBrake to version 1.3.0
Product: Fedora Reporter: FeRD (Frank Dana) <ferdnyc>
Component: HandBrakeAssignee: Dominik 'Rathann' Mierzejewski <dominik>
Status: RESOLVED FIXED    
Severity: enhancement CC: bcl, negativo17
Priority: P1    
Version: f32   
Hardware: x86_64   
OS: GNU/Linux   
See Also: https://bugzilla.rpmfusion.org/show_bug.cgi?id=5516
namespace:
Attachments: HandBrake.spec for version 1.3.0
Handbrake-no-libva.patch rebased to 1.3.0 dist
Handbrake-nostrip.patch rebased to 1.3.0 dist
Patch to update HandBrake.spec for 1.3.0
fix build with libmfx/QSV enabled
Updated specfile patch against rpmfusion master branch

Description FeRD (Frank Dana) 2019-11-22 00:57:01 CET
Created attachment 2113 [details]
HandBrake.spec for version 1.3.0

As initially discussed on the mailing list, I'm opening this bug to pass along my HandBrake spec file and patch updates to build the more recent 1.3.0 release. So far it builds only in rawhide. (Due to an unresolvable set of builddeps that kill the setup process, when mockbuilding against F31 rpmfusion-free. Something's unhappy between libdav1d and ffmpeg at the moment.) I didn't actually try F30.

Intel QSV is forcibly disabled, since it was causing build failures in the rawhide mockbuild.

* New dependencies added:
    Runtime - libdav1d, libdl, libdrm, libnuma
    Build - meson, python3 (replaces python2)

* Attached patches rebased.

* HandBrake-system-openCL.patch dropped and can be deleted, AFAICT. The extras/cl.h header is no longer part of the distribution.

* Handbrake-no_clip_id.patch untouched, it's only for RHEL. It still applies with some fuzz factor, anyway. (offset 9 lines)
Comment 1 FeRD (Frank Dana) 2019-11-22 00:57:53 CET
Created attachment 2114 [details]
Handbrake-no-libva.patch rebased to 1.3.0 dist
Comment 2 FeRD (Frank Dana) 2019-11-22 00:58:32 CET
Created attachment 2115 [details]
Handbrake-nostrip.patch rebased to 1.3.0 dist
Comment 3 Dominik 'Rathann' Mierzejewski 2019-11-22 14:13:12 CET
Thanks for working on this. I would've preferred if you attached diffs instead of full files. How did you solve the missing -ldl in the final link command for ghb? I tried updating to 1.3.0 locally, but got stuck there.

QSV support requires libmfx >= 1.27 and I'm replacing the current Fedora libmfx with the proper upstream intel-mediasdk soon, so yes, it can be disabled temporarily.
Comment 4 FeRD (Frank Dana) 2019-11-22 19:41:02 CET
Created attachment 2116 [details]
Patch to update HandBrake.spec for 1.3.0
Comment 5 FeRD (Frank Dana) 2019-11-22 19:43:30 CET
(In reply to Dominik 'Rathann' Mierzejewski from comment #3)
> Thanks for working on this. I would've preferred if you attached diffs
> instead of full files.

Sure, I can certainly do that for the spec file. I need to update it anyway to remove the libdav1d version restriction, turns out I was being overly paranoid. It builds just fine with 0.3.0 in F30. Just attached a spec-patch to replace the updated spec.

...Do you want diffs on the _patches_, too, though? That seems kind of weird.

> How did you solve the missing -ldl in the final link
> command for ghb? I tried updating to 1.3.0 locally, but got stuck there.

I just shoe-horned it into GCC.args.0.speed via custom.defs, the same as the other dependencies. This bit of the updated spec:

echo "GCC.args.O.speed = %{optflags} -I%{_includedir}/ffmpeg -ldl -ldav1d -lx265 %{?_with_fdk:-L%{_libdir}/fdk-aac -lfdk-aac} %{?_with_mfx:-lmfx}" > custom.defs
Comment 6 FeRD (Frank Dana) 2019-11-22 19:44:54 CET
(In reply to FeRD (Frank Dana) from comment #5)
>
> I just shoe-horned it into GCC.args.0.speed 

Er, make that GCC.args.O.speed
Comment 7 Dominik 'Rathann' Mierzejewski 2019-11-25 11:18:57 CET
(In reply to FeRD (Frank Dana) from comment #5)
> (In reply to Dominik 'Rathann' Mierzejewski from comment #3)
> > Thanks for working on this. I would've preferred if you attached diffs
> > instead of full files.
> 
> Sure, I can certainly do that for the spec file. I need to update it anyway
> to remove the libdav1d version restriction, turns out I was being overly
> paranoid. It builds just fine with 0.3.0 in F30. Just attached a spec-patch
> to replace the updated spec.

That's great, thanks. Please bump the libmfx-devel requirement to 1.27. The bundled copy was updated with HB 1.2.1, actually, but apparently they started requiring it only now.

> ...Do you want diffs on the _patches_, too, though? That seems kind of weird.

No, full patches are fine.

> > How did you solve the missing -ldl in the final link
> > command for ghb? I tried updating to 1.3.0 locally, but got stuck there.
> 
> I just shoe-horned it into GCC.args.0.speed via custom.defs, the same as the
> other dependencies. This bit of the updated spec:
> 
> echo "GCC.args.O.speed = %{optflags} -I%{_includedir}/ffmpeg -ldl -ldav1d
> -lx265 %{?_with_fdk:-L%{_libdir}/fdk-aac -lfdk-aac} %{?_with_mfx:-lmfx}" >
> custom.defs

Ah, I missed that. That's why seeing the diffs helps. :D
Comment 8 Dominik 'Rathann' Mierzejewski 2019-11-25 13:31:17 CET
Created attachment 2120 [details]
fix build with libmfx/QSV enabled

(In reply to Dominik 'Rathann' Mierzejewski from comment #7)
> (In reply to FeRD (Frank Dana) from comment #5)
> > (In reply to Dominik 'Rathann' Mierzejewski from comment #3)
[...]
> Please bump the libmfx-devel requirement to 1.27. The
> bundled copy was updated with HB 1.2.1, actually, but apparently they
> started requiring it only now.

Actually, scratch that. It builds with 1.25 as well. All you have to do is not apply Patch4 when QSV support is enabled and apply the attached patch. It looks like they patched[1] FFmpeg with some D3D11-related stuff and forgot to put #if #endif guardrails[2] for other platforms.

[1] https://github.com/HandBrake/HandBrake/blob/1.3.0/contrib/ffmpeg/A13-qsv-dx11.patch
[2] https://github.com/HandBrake/HandBrake/blob/1.3.0/libhb/enc_qsv.c#L528
Comment 9 FeRD (Frank Dana) 2019-11-25 18:35:50 CET
Created attachment 2121 [details]
Updated specfile patch against rpmfusion master branch

(In reply to Dominik 'Rathann' Mierzejewski from comment #8)
>
> Actually, scratch that. It builds with 1.25 as well. All you have to do is
> not apply Patch4 when QSV support is enabled and apply the attached patch.
> It looks like they patched[1] FFmpeg with some D3D11-related stuff and
> forgot to put #if #endif guardrails[2] for other platforms.

Yup, that worked great, built with no problems on Fedora 30. (My last build before I reboot to finally let DNF run the system-upgrade.)

I added your new patch as an alternate Patch4. (It'll be HandBrake-no-libva.patch if mfx is disabled, HandBrake-qsv.patch if it's enabled, ...and wow, I feel a bit dirty now.)

_with_mfx is re-enabled by default, and I raised the libmfx minimum version to 1.25 just to be safe, though it might not have been necessary.

Updated specfile diff attached.
Comment 10 Dominik 'Rathann' Mierzejewski 2019-11-27 09:23:35 CET
(In reply to FeRD (Frank Dana) from comment #9)
[...]
> I added your new patch as an alternate Patch4. (It'll be
> HandBrake-no-libva.patch if mfx is disabled, HandBrake-qsv.patch if it's
> enabled, ...and wow, I feel a bit dirty now.)

You can't do that. SRPM will contain different patches depending on build options.
Both patches have to be included.

> _with_mfx is re-enabled by default, and I raised the libmfx minimum version
> to 1.25 just to be safe, though it might not have been necessary.

It's not, I checked.

> Updated specfile diff attached.

Thanks. This also fixes bug 5426, so I'll do the update on F31 as well.
Comment 11 Dominik 'Rathann' Mierzejewski 2019-11-27 11:08:54 CET
I had to fix a couple of build issues on non-x86, but it should be fine now. Waiting for non-x86 builders to become ready: http://koji.rpmfusion.org/koji/taskinfo?taskID=372264 .
Comment 12 FeRD (Frank Dana) 2019-11-27 14:00:36 CET
(In reply to Dominik 'Rathann' Mierzejewski from comment #10)
> (In reply to FeRD (Frank Dana) from comment #9)
> [...]
> > I added your new patch as an alternate Patch4. (It'll be
> > HandBrake-no-libva.patch if mfx is disabled, HandBrake-qsv.patch if it's
> > enabled, ...and wow, I feel a bit dirty now.)
> 
> You can't do that. SRPM will contain different patches depending on build
> options.
> Both patches have to be included.

Ooh! Didn't even think of that, good catch. I should learn to trust my subconscious, it's clearly got a better handle on this stuff. ;-)
Comment 13 Dominik 'Rathann' Mierzejewski 2019-11-27 19:18:34 CET
Updated in F31+.