Page MenuHomeFreeBSD

multimedia/handbrake: update to 1.3.2
ClosedPublic

Authored by naito.yuichiro_gmail.com on May 7 2020, 1:20 AM.

Details

Summary

HandBrake 1.3.2 has been released.
I want to upgrade multimedia/handbrake port.

List of changes since 1.3.1.

  • meson patch has been removed. It has been merged to upstream.
  • master site has been changed. Upstream has been changed to use GitHub CDN.
Test Plan

Build successfully on i386, amd64, powerpc64.
QSV works on amd64.

Diff Detail

Repository
rP FreeBSD ports repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

@pkubaj
Could you please check this patch on your powerpc64?

@jbeich

My HandBrake 1.3.2 & 1.3.1 fails to encode H.265 video by QSV on my skylake machine.
HandBrake 1.3.2 shows following log.

libva info: VA-API version 1.7.0
libva info: User environment variable requested driver 'iHD'
libva info: Trying to open /usr/local/lib/dri/iHD_drv_video.so
libva info: Found init function __vaDriverInit_1_7
libva info: va_openDriver() returns 0
[10:46:45] qsv_hevc_make_header: MFXVideoENCODE_EncodeFrameAsync failed (-5)
[10:46:45] encqsvInit: qsv_hevc_make_header failed
[10:46:45] Failure to initialise thread 'Quick Sync Video encoder (Intel Media SDK)'
[10:46:45] comb detect: heavy 0 | light 0 | uncombed 0 | total 0
[10:46:45] decomb: deinterlaced 0 | blended 0 | unfiltered 0 | total 0
[10:46:45] vfr: 0 frames output, 0 dropped and 0 duped for CFR/PFR
[10:46:45] vfr: lost time: 0 (0 frames)
[10:46:45] vfr: gained time: 0 (0 frames) (0 not accounted for)
[10:46:45] ac3-decoder done: 0 frames, 0 decoder errors
[10:46:45] mpeg4-decoder done: 0 frames, 0 decoder errors
[10:46:45] sync: got 0 frames, 6751 expected
[10:46:46] Finished work at: Thu May 7 10:46:46 2020

Are there any regressions in intel-media-sdk?

I can't test it, multimedia/dav1d fails at checksum:

=======================<phase: checksum       >============================
===>  License BSD2CLAUSE accepted by the user
===> Fetching all distfiles required by dav1d-0.6.0_1 for building
=> SHA256 Checksum OK for videolan-dav1d-efd9e5518e0ed5114f8b4579debd7ee6dbede21f_GL0.tar.gz.
=> SHA256 Checksum mismatch for e04227c5f672.patch.
===>  Refetch for 1 more times files:  e04227c5f672.patch
===>  License BSD2CLAUSE accepted by the user
=> e04227c5f672.patch doesn't seem to exist in /portdistfiles/.
=> Attempting to fetch https://code.videolan.org/videolan/dav1d/commit/e04227c5f672.patch
e04227c5f672.patch                                    1153  B 2955 kBps    00s
===> Fetching all distfiles required by dav1d-0.6.0_1 for building
===>  License BSD2CLAUSE accepted by the user
===> Fetching all distfiles required by dav1d-0.6.0_1 for building
=> SHA256 Checksum OK for videolan-dav1d-efd9e5518e0ed5114f8b4579debd7ee6dbede21f_GL0.tar.gz.
=> SHA256 Checksum mismatch for e04227c5f672.patch.
===>  Giving up on fetching files:  e04227c5f672.patch
Make sure the Makefile and distinfo file (/usr/ports/multimedia/dav1d/distinfo)
are up to date.  If you are absolutely sure you want to override this
check, type "make NO_CHECKSUM=yes [other args]".
*** Error code 1

OK on 12.1 and head (powerpc64).

This revision is now accepted and ready to land.May 8 2020, 8:55 AM

OK on 12.1 and head (powerpc64).

Thanks for the testing.
I'm investigating why H.265 QSV encoding doesn't work.
I'm running following software on my skylake PC.

FreeBSD 13.0-CURRENT #22 r360680
handbrake-1.3.2
intel-media-sdk-20.1.1
libva-2.7.1
libva-intel-media-driver-20.1.1
libva-utils-2.7.1

Are there any regressions in intel-media-sdk?

FFmpeg works on my Skylake fine with -c:v h264_qsv, including -look_ahead 1 which requires running as root. I quickly test runtime for regressions on every update, including libva-intel-media-driver updates.

[10:46:45] qsv_hevc_make_header: MFXVideoENCODE_EncodeFrameAsync failed (-5)

Tracked down to MediaSDK@b7dad9db since rP529258. However, ffmpeg -c:v hevc_qsv and H.264 (Intel QSV) in HandBrake still work fine. -5 is MFX_ERR_NOT_ENOUGH_BUFFER, so maybe HandBrake does something unexpected.

H.264 (Intel QSV) works fine inside 11.3 i386 jail. Tested on drm-v5.1 host.

@jbeich

Thanks for your reply.
I can confirm that ffmpeg can encode both h264_qsv and hevc_qsv.
HandBrake built from master branch of HandBrake repository doesn't encode H.265 QSV, too.
It seems that it is a HandBrake problem and not ports.

So would you commit this patch?
I continue investigating and will report to HandBrake Github.

This revision was automatically updated to reflect the committed changes.

HandBrake built from master branch of HandBrake repository doesn't encode H.265 QSV, too.

MediaSDK built from master branch also fails H.265 QSV in HandBrake.

I continue investigating and will report to HandBrake Github.

If during debugging you want to restore the old behavior try the following:

--- multimedia/intel-media-sdk/Makefile~
+++ multimedia/intel-media-sdk/Makefile
@@ -3,6 +3,7 @@
 PORTNAME=	intel-media-sdk
 DISTVERSIONPREFIX=	intel-mediasdk-
 DISTVERSION=	20.1.1
+PORTREVISION=	1
 CATEGORIES=	multimedia
 
 PATCH_SITES=	https://github.com/${GH_ACCOUNT}/${GH_PROJECT}/commit/
--- /dev/null
+++ multimedia/intel-media-sdk/files/patch-old-hevchw
@@ -0,0 +1,9 @@
+--- _studio/shared/include/mfx_config.h.orig	2020-04-21 15:46:17 UTC
++++ _studio/shared/include/mfx_config.h
+@@ -125,6 +125,4 @@
+ 
+ #define CMAPIUPDATE
+ 
+-#define MFX_ENABLE_HEVCEHW_REFACTORING
+-
+ #endif // _MFX_CONFIG_H_

If during debugging you want to restore the old behavior try the following:

Thank you so much.
The patch solves H.265 QSV issue so that Intel Media SDK has refactored hevc code since 20.1.0.
It seems that requires more buffer memory than before.

I made a quick fix for HandBrake that doubles buffer memory.

yuichiro-naito/HandBrake@e468a37

It works for H.265 QSV encoding.