You are not logged in.

#1 2022-07-11 04:41:14

rajhlinux
Member
Registered: 2022-07-08
Posts: 58

[SOLVED] yay - error making: obs-hevc-vaapi-git

Hello,

I'm trying to install the AUR package: "obs-hevc-vaapi-git":
https://aur.archlinux.org/packages/obs-hevc-vaapi-git

I get this error:

$ yay -s obs-hevc-vaapi-git
1 aur/obs-hevc-vaapi-git 27.2.0.r33.g0dbae4ebe-2 (+10 0.01)
    Free and open source software for video recording and live streaming. With VAAPI HEVC support.
==> Packages to install (eg: 1 2 3, 1-3 or ^4)
==> 1
:: Checking for conflicts...
:: Checking for inner conflicts...
 -> Package conflicts found:
 -> Installing obs-hevc-vaapi-git will remove: obs-studio-git (obs-studio)
 -> Conflicting packages will have to be confirmed manually
[Aur:1]  obs-hevc-vaapi-git-27.2.0.r33.g0dbae4ebe-2

  1 obs-hevc-vaapi-git               (Build Files Exist)
==> Packages to cleanBuild?
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==> N
:: PKGBUILD up to date, Skipping (1/0): obs-hevc-vaapi-git
  1 obs-hevc-vaapi-git               (Build Files Exist)
==> Diffs to show?
==> [N]one [A]ll [Ab]ort [I]nstalled [No]tInstalled or (1 2 3, 1-3, ^4)
==> N
:: (1/1) Parsing SRCINFO: obs-hevc-vaapi-git
==> Making package: obs-hevc-vaapi-git 27.2.0.r33.g0dbae4ebe-2 (Mon 11 Jul 2022 12:38:06 AM EDT)
==> Retrieving sources...
  -> Updating obs-hevc-vaapi-git git repo...
remote: Enumerating objects: 68, done.
remote: Counting objects: 100% (67/67), done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 38 (delta 29), reused 26 (delta 18), pack-reused 0
Unpacking objects: 100% (38/38), 4.38 KiB | 118.00 KiB/s, done.
From https://github.com/obsproject/obs-studio
 + b59f59671...91d50840e refs/pull/6247/merge -> refs/pull/6247/merge  (forced update)
 * [new ref]             refs/pull/6712/head  -> refs/pull/6712/head
  -> Updating ftl-sdk git repo...
  -> Updating obs-browser git repo...
  -> Updating obs-vst git repo...
  -> Found hevc-vaapi.diff
  -> Found fix_python_binary_loading.patch
==> Validating source files with sha256sums...
    obs-hevc-vaapi-git ... Skipped
    ftl-sdk ... Skipped
    obs-browser ... Skipped
    obs-vst ... Skipped
    hevc-vaapi.diff ... Passed
    fix_python_binary_loading.patch ... Passed
==> Making package: obs-hevc-vaapi-git 27.2.0.r33.g0dbae4ebe-2 (Mon 11 Jul 2022 12:38:10 AM EDT)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Updating obs-hevc-vaapi-git git repo...
  -> Updating ftl-sdk git repo...
  -> Updating obs-browser git repo...
  -> Updating obs-vst git repo...
  -> Found hevc-vaapi.diff
  -> Found fix_python_binary_loading.patch
==> Validating source files with sha256sums...
    obs-hevc-vaapi-git ... Skipped
    ftl-sdk ... Skipped
    obs-browser ... Skipped
    obs-vst ... Skipped
    hevc-vaapi.diff ... Passed
    fix_python_binary_loading.patch ... Passed
==> Removing existing $srcdir/ directory...
==> Extracting sources...
  -> Creating working copy of obs-hevc-vaapi-git git repo...
Cloning into 'obs-hevc-vaapi-git'...
done.
Switched to a new branch 'makepkg'
  -> Creating working copy of ftl-sdk git repo...
Cloning into 'ftl-sdk'...
done.
  -> Creating working copy of obs-browser git repo...
Cloning into 'obs-browser'...
done.
  -> Creating working copy of obs-vst git repo...
Cloning into 'obs-vst'...
done.
==> Starting prepare()...
patching file libobs/util/platform-nix.c
Hunk #1 succeeded at 75 (offset 4 lines).
patching file plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
Hunk #1 FAILED at 72.
Hunk #2 succeeded at 177 (offset 4 lines).
Hunk #3 succeeded at 285 (offset 4 lines).
Hunk #4 succeeded at 296 (offset 4 lines).
Hunk #5 FAILED at 348.
Hunk #6 succeeded at 489 (offset 3 lines).
Hunk #7 FAILED at 510.
Hunk #8 succeeded at 572 (offset 2 lines).
Hunk #9 FAILED at 640.
Hunk #10 succeeded at 698 (offset 3 lines).
Hunk #11 succeeded at 728 (offset 3 lines).
4 out of 11 hunks FAILED -- saving rejects to file plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c.rej
patching file plugins/obs-ffmpeg/obs-ffmpeg.c
Hunk #1 succeeded at 40 (offset 3 lines).
Hunk #2 succeeded at 285 (offset 69 lines).
Hunk #3 succeeded at 355 with fuzz 1 (offset 85 lines).
==> ERROR: A failure occurred in prepare().
    Aborting...
 -> error making: obs-hevc-vaapi-git

What could be wrong?

Thanks.

Last edited by rajhlinux (2022-07-17 07:22:06)

Offline

#2 2022-07-11 04:57:50

Adriik
Member
From: Argentina
Registered: 2022-03-10
Posts: 128

Re: [SOLVED] yay - error making: obs-hevc-vaapi-git

patching file plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
Hunk #1 FAILED at 72.

Looks like fail patching a file.

Try with makepkg in a clean environment (an empty directory) or in a clean chroot

Do you have the same problem after following the instructions above?

Last edited by Adriik (2022-07-11 04:58:59)


Solo soy un loco más. Please use [code] [/code] tags.
Command cheatsheetCommand not found?
If I write something wrong in English, please correct me.

Offline

#3 2022-07-11 05:28:53

rajhlinux
Member
Registered: 2022-07-08
Posts: 58

Re: [SOLVED] yay - error making: obs-hevc-vaapi-git

Adriik wrote:
patching file plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
Hunk #1 FAILED at 72.

Looks like fail patching a file.

Try with makepkg in a clean environment (an empty directory) or in a clean chroot

Do you have the same problem after following the instructions above?

Thanks for the quick reply.

Yes, I get the same issue with:

makepkg -s

I have not tried doing it in a clean environment, will try this now. Thanks.

Offline

#4 2022-07-11 05:47:33

rajhlinux
Member
Registered: 2022-07-08
Posts: 58

Re: [SOLVED] yay - error making: obs-hevc-vaapi-git

I get this error when trying to make a "chroot":

$ mkdir ~/chroot

$ CHROOT=$HOME/chroot

$ mkarchroot $CHROOT/root base-devel

unshare: failed to execute pacstrap: No such file or directory

==> ERROR: Failed to install all packages

$ ls

amdgpu-pro-installer  decklink-sdk  ffmpeg-amd-full-git   obs-hevc-vaapi-git  Public             xorgxrdp
amf-headers-git       Desktop       llvm-minimal-git      opencl-amd          Templates          xorgxrdp-glamor
cef-minimal           devtools      Music                 output_h264.mp4     thinclient_drives  xrdp
chroot                Documents     ncurses5-compat-libs  output.mp4          Videos
conky-git             Downloads     nomachine             Pictures            video_sample.mp4

Thanks.

Offline

#5 2022-07-11 06:09:42

Awebb
Member
Registered: 2010-05-06
Posts: 6,286

Re: [SOLVED] yay - error making: obs-hevc-vaapi-git

My bet would be the "git config submodule.plugins/obs-vst.url $srcdir/obs-vst" command in prepare(). Something might have changed over there in the latest commit, as the PKGBUILD has been touched before the current commit. The patch process sees an offset of a few lines and some things straight out fail. I'd contact the maintainer of that package.

Offline

#6 2022-07-11 07:32:00

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,855
Website

Re: [SOLVED] yay - error making: obs-hevc-vaapi-git

Mod note: moving to AUR Issues


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#7 2022-07-11 23:58:00

rajhlinux
Member
Registered: 2022-07-08
Posts: 58

Re: [SOLVED] yay - error making: obs-hevc-vaapi-git

Awebb wrote:

My bet would be the "git config submodule.plugins/obs-vst.url $srcdir/obs-vst" command in prepare(). Something might have changed over there in the latest commit, as the PKGBUILD has been touched before the current commit. The patch process sees an offset of a few lines and some things straight out fail. I'd contact the maintainer of that package.

Thanks for your reply.

Will look into this.

Offline

#8 2022-07-12 01:46:48

loqs
Member
Registered: 2014-03-06
Posts: 17,362

Re: [SOLVED] yay - error making: obs-hevc-vaapi-git

The following diff allowed the package to build,  no further testing was performed

diff --git a/PKGBUILD b/PKGBUILD
index 7a1874a..a82705e 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -2,14 +2,14 @@
 # Contributors: Nigel Kukard <nkukard@LBSD.net> zan <zan@420blaze.it>
 
 pkgname=obs-hevc-vaapi-git
-pkgver=27.2.0.r33.g0dbae4ebe
-pkgrel=2
+pkgver=27.2.0.r614.ga32793dd0
+pkgrel=1
 pkgdesc="Free and open source software for video recording and live streaming. With VAAPI HEVC support."
 arch=(i686 x86_64)
 url="https://github.com/obsproject/obs-studio"
 license=(GPL2)
-depends=(at-spi2-atk ffmpeg jansson libxinerama qt5-x11extras mbedtls libxrandr nss libxss)
-makedepends=(cmake git x264 jack vlc-luajit swig cef-minimal pipewire)
+depends=(at-spi2-atk ffmpeg jansson libxinerama qt5-x11extras mbedtls libxrandr nss libxss pciutils libajantv2)
+makedepends=(cmake git x264 jack vlc-luajit swig cef-minimal pipewire python)
 optdepends=("libfdk-aac: FDK AAC codec support"
             "libxcomposite: XComposite capture support"
             "jack: JACK Support"
@@ -26,9 +26,12 @@ source=("$pkgname::git+https://github.com/obsproject/obs-studio.git#branch=maste
         "git+https://github.com/obsproject/obs-vst.git"
         "hevc-vaapi.diff"
         "fix_python_binary_loading.patch")
-sha256sums=("SKIP" "SKIP" "SKIP" "SKIP"
-            "c4322d8ec5247a7b3f95a124e9312033ceeb11fa379ee8a887f60a01b3fbd0e9"
-            "bdfbd062f080bc925588aec1989bb1df34bf779cc2fc08ac27236679cf612abd")
+sha256sums=('SKIP'
+            'SKIP'
+            'SKIP'
+            'SKIP'
+            'a164522d5d4d2f9b9033eabc0116d483889c4719068278d97430b6da13ce1549'
+            'bdfbd062f080bc925588aec1989bb1df34bf779cc2fc08ac27236679cf612abd')
 
 pkgver() {
   cd $pkgname
diff --git a/hevc-vaapi.diff b/hevc-vaapi.diff
index 1688bed..08cabc1 100644
--- a/hevc-vaapi.diff
+++ b/hevc-vaapi.diff
@@ -1,8 +1,8 @@
 diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c b/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
-index 1598d39db..9b927a9e5 100644
+index 9b9f84ff3..57bc49207 100644
 --- a/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
 +++ b/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
-@@ -72,10 +72,35 @@ struct vaapi_encoder {
+@@ -74,10 +74,35 @@ struct vaapi_encoder {
  	bool initialized;
  };
  
@@ -21,7 +21,7 @@ index 1598d39db..9b927a9e5 100644
 +	.profile = FF_PROFILE_H264_CONSTRAINED_BASELINE,
 +	.level = 40,
 +	.rate_control = "CBR",
-+	.name = "FFMPEG VAAPI",
++	.name = "FFMPEG VAAPI H.264",
 +};
 +
 +static struct type_data hevc_type = {
@@ -29,19 +29,19 @@ index 1598d39db..9b927a9e5 100644
 +	.profile = FF_PROFILE_HEVC_MAIN,
 +	.level = 120,
 +	.rate_control = "CBR",
-+	.name = "FFMPEG VAAPI (hevc)",
++	.name = "FFMPEG VAAPI HEVC",
 +};
 +
 +static const char *vaapi_getname(void *type_data)
  {
 -	UNUSED_PARAMETER(unused);
--	return "FFMPEG VAAPI";
+-	return "FFMPEG VAAPI H.264";
 +	struct type_data *data = type_data;
 +	return data->name;
  }
  
  static inline bool valid_format(enum video_format format)
-@@ -173,15 +198,15 @@ typedef struct {
+@@ -177,15 +202,15 @@ typedef struct {
  	bool maxrate;
  } rc_mode_t;
  
@@ -64,7 +64,7 @@ index 1598d39db..9b927a9e5 100644
  	const rc_mode_t *rc_mode = RC_MODES;
  
  	while (!!rc_mode && strcmp(rc_mode->name, name) != 0)
-@@ -281,6 +306,7 @@ static bool vaapi_update(void *data, obs_data_t *settings)
+@@ -285,6 +310,7 @@ static bool vaapi_update(void *data, obs_data_t *settings)
  
  	info("settings:\n"
  	     "\tdevice:       %s\n"
@@ -72,7 +72,7 @@ index 1598d39db..9b927a9e5 100644
  	     "\trate_control: %s\n"
  	     "\tprofile:      %d\n"
  	     "\tlevel:        %d\n"
-@@ -291,9 +317,9 @@ static bool vaapi_update(void *data, obs_data_t *settings)
+@@ -295,9 +321,9 @@ static bool vaapi_update(void *data, obs_data_t *settings)
  	     "\twidth:        %d\n"
  	     "\theight:       %d\n"
  	     "\tb-frames:     %d\n",
@@ -85,22 +85,26 @@ index 1598d39db..9b927a9e5 100644
  
  	return vaapi_init_codec(enc, device);
  }
-@@ -347,9 +373,12 @@ static void *vaapi_create(obs_data_t *settings, obs_encoder_t *encoder)
+@@ -351,9 +377,16 @@ static void *vaapi_create(obs_data_t *settings, obs_encoder_t *encoder)
+ 	enc = bzalloc(sizeof(*enc));
+ 	enc->encoder = encoder;
  
- 	if (vaapi_codec == AV_CODEC_ID_H264) {
- 		enc->vaapi = avcodec_find_encoder_by_name("h264_vaapi");
+-	enc->vaapi = avcodec_find_encoder_by_name("h264_vaapi");
++	int vaapi_codec = (int)obs_data_get_int(settings, "vaapi_codec");
+ 
+-	enc->first_packet = true;
++	if (vaapi_codec == AV_CODEC_ID_H264) {
++		enc->vaapi = avcodec_find_encoder_by_name("h264_vaapi");
 +		enc->first_packet = true;
 +	}
 +	if (vaapi_codec == AV_CODEC_ID_HEVC) {
 +		enc->vaapi = avcodec_find_encoder_by_name("hevc_vaapi");
 +		enc->first_packet = false;
- 	}
--
--	enc->first_packet = true;
++	}
  
  	blog(LOG_INFO, "---------------------------------");
  
-@@ -485,7 +514,10 @@ static bool vaapi_encode(void *data, struct encoder_frame *frame,
+@@ -488,7 +521,10 @@ static bool vaapi_encode(void *data, struct encoder_frame *frame,
  		packet->data = enc->buffer.array;
  		packet->size = enc->buffer.num;
  		packet->type = OBS_ENCODER_VIDEO;
@@ -108,11 +112,11 @@ index 1598d39db..9b927a9e5 100644
 +		packet->keyframe =
 +			enc->vaapi->id == AV_CODEC_ID_H264
 +				? obs_avc_keyframe(packet->data, packet->size)
-+				: av_pkt.flags & AV_PKT_FLAG_KEY;
++				: enc->packet->flags & AV_PKT_FLAG_KEY;
  		*received_packet = true;
  	} else {
  		*received_packet = false;
-@@ -506,19 +538,20 @@ static void set_visible(obs_properties_t *ppts, const char *name, bool visible)
+@@ -509,18 +545,21 @@ static void set_visible(obs_properties_t *ppts, const char *name, bool visible)
  	obs_property_set_visible(p, visible);
  }
  
@@ -123,7 +127,6 @@ index 1598d39db..9b927a9e5 100644
 +
  	obs_data_set_default_string(settings, "vaapi_device",
  				    "/dev/dri/renderD128");
--	obs_data_set_default_int(settings, "vaapi_codec", AV_CODEC_ID_H264);
 -	obs_data_set_default_int(settings, "profile",
 -				 FF_PROFILE_H264_CONSTRAINED_BASELINE);
 -	obs_data_set_default_int(settings, "level", 40);
@@ -133,14 +136,14 @@ index 1598d39db..9b927a9e5 100644
  	obs_data_set_default_int(settings, "bitrate", 2500);
  	obs_data_set_default_int(settings, "keyint_sec", 0);
  	obs_data_set_default_int(settings, "bf", 0);
--	obs_data_set_default_int(settings, "rendermode", 0);
+ 	obs_data_set_default_int(settings, "rendermode", 0);
 -	obs_data_set_default_string(settings, "rate_control", "CBR");
 +	obs_data_set_default_string(settings, "rate_control",
 +				    codec->rate_control);
  	obs_data_set_default_int(settings, "qp", 20);
  	obs_data_set_default_int(settings, "maxrate", 0);
  }
-@@ -566,9 +599,13 @@ static bool get_device_name_from_pci(struct pci_access *pacc, char *pci_slot,
+@@ -568,9 +607,13 @@ static bool get_device_name_from_pci(struct pci_access *pacc, char *pci_slot,
  	return false;
  }
  
@@ -155,17 +158,10 @@ index 1598d39db..9b927a9e5 100644
  
  	obs_properties_t *props = obs_properties_create();
  	obs_property_t *list;
-@@ -632,40 +669,63 @@ static obs_properties_t *vaapi_properties(void *unused)
+@@ -642,28 +685,58 @@ static obs_properties_t *vaapi_properties(void *unused)
  		}
  	}
  
--	list = obs_properties_add_list(props, "vaapi_codec",
--				       obs_module_text("VAAPI.Codec"),
--				       OBS_COMBO_TYPE_LIST,
--				       OBS_COMBO_FORMAT_INT);
--
--	obs_property_list_add_int(list, "H.264 (default)", AV_CODEC_ID_H264);
--
 -	list = obs_properties_add_list(props, "profile",
 -				       obs_module_text("Profile"),
 -				       OBS_COMBO_TYPE_LIST,
@@ -188,11 +184,6 @@ index 1598d39db..9b927a9e5 100644
 -	obs_property_list_add_int(list, "5.0", 50);
 -	obs_property_list_add_int(list, "5.1", 51);
 -	obs_property_list_add_int(list, "5.2", 52);
--
--	list = obs_properties_add_list(props, "rate_control",
--				       obs_module_text("RateControl"),
--				       OBS_COMBO_TYPE_LIST,
--				       OBS_COMBO_FORMAT_STRING);
 +	if (codec->id == AV_CODEC_ID_H264) {
 +		list = obs_properties_add_list(props, "profile",
 +						obs_module_text("Profile"),
@@ -245,15 +236,10 @@ index 1598d39db..9b927a9e5 100644
 +		obs_property_list_add_int(list, "6.1", 183);
 +		obs_property_list_add_int(list, "6.2", 186);
 +	}
-+ 
-+ 	list = obs_properties_add_list(props, "rate_control",
-+ 				       obs_module_text("RateControl"),
-+ 				       OBS_COMBO_TYPE_LIST,
-+ 				       OBS_COMBO_FORMAT_STRING);
- 	obs_property_list_add_string(list, "CBR (default)", "CBR");
- 	obs_property_list_add_string(list, "CQP", "CQP");
- 	obs_property_list_add_string(list, "VBR", "VBR");
-@@ -687,6 +747,7 @@ static obs_properties_t *vaapi_properties(void *unused)
+ 
+ 	list = obs_properties_add_list(props, "rate_control",
+ 				       obs_module_text("RateControl"),
+@@ -690,6 +763,7 @@ static obs_properties_t *vaapi_properties(void *unused)
  			       obs_module_text("KeyframeIntervalSec"), 0, 20,
  			       1);
  
@@ -261,7 +247,7 @@ index 1598d39db..9b927a9e5 100644
  	return props;
  }
  
-@@ -716,11 +777,28 @@ struct obs_encoder_info vaapi_encoder_info = {
+@@ -719,11 +793,28 @@ struct obs_encoder_info vaapi_encoder_info = {
  	.create = vaapi_create,
  	.destroy = vaapi_destroy,
  	.encode = vaapi_encode,
@@ -293,10 +279,10 @@ index 1598d39db..9b927a9e5 100644
  
  #endif
 diff --git a/plugins/obs-ffmpeg/obs-ffmpeg.c b/plugins/obs-ffmpeg/obs-ffmpeg.c
-index b25201572..84594f2b6 100644
+index da9ef85cd..bcf883ddc 100644
 --- a/plugins/obs-ffmpeg/obs-ffmpeg.c
 +++ b/plugins/obs-ffmpeg/obs-ffmpeg.c
-@@ -37,6 +37,7 @@ extern struct obs_encoder_info aom_av1_encoder_info;
+@@ -40,6 +40,7 @@ extern struct obs_encoder_info aom_av1_encoder_info;
  
  #ifdef LIBAVUTIL_VAAPI_AVAILABLE
  extern struct obs_encoder_info vaapi_encoder_info;
@@ -304,7 +290,7 @@ index b25201572..84594f2b6 100644
  #endif
  
  #ifndef __APPLE__
-@@ -215,9 +216,9 @@ finish:
+@@ -284,9 +285,9 @@ static bool nvenc_supported(bool *out_h264, bool *out_hevc)
  #endif
  
  #ifdef LIBAVUTIL_VAAPI_AVAILABLE
@@ -316,8 +302,8 @@ index b25201572..84594f2b6 100644
  	return !!vaenc;
  }
  #endif
-@@ -269,9 +270,13 @@ bool obs_module_load(void)
- 		obs_register_encoder(&nvenc_encoder_info);
+@@ -354,9 +355,13 @@ bool obs_module_load(void)
+ #endif
  	}
  #if !defined(_WIN32) && defined(LIBAVUTIL_VAAPI_AVAILABLE)
 -	if (vaapi_supported()) {

Edit:
hevc-vaapi.diff

diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c b/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
index 9b9f84ff3..57bc49207 100644
--- a/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
+++ b/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
@@ -74,10 +74,35 @@ struct vaapi_encoder {
 	bool initialized;
 };
 
-static const char *vaapi_getname(void *unused)
+/* Identify codecs, and some default values */
+struct type_data {
+	const int id;
+	const int profile;
+	const int level;
+	const char *name;
+	const char *rate_control;
+};
+
+static struct type_data h264_type = {
+	.id = AV_CODEC_ID_H264,
+	.profile = FF_PROFILE_H264_CONSTRAINED_BASELINE,
+	.level = 40,
+	.rate_control = "CBR",
+	.name = "FFMPEG VAAPI H.264",
+};
+
+static struct type_data hevc_type = {
+	.id = AV_CODEC_ID_HEVC,
+	.profile = FF_PROFILE_HEVC_MAIN,
+	.level = 120,
+	.rate_control = "CBR",
+	.name = "FFMPEG VAAPI HEVC",
+};
+
+static const char *vaapi_getname(void *type_data)
 {
-	UNUSED_PARAMETER(unused);
-	return "FFMPEG VAAPI H.264";
+	struct type_data *data = type_data;
+	return data->name;
 }
 
 static inline bool valid_format(enum video_format format)
@@ -177,15 +202,15 @@ typedef struct {
 	bool maxrate;
 } rc_mode_t;
 
+/* Set "allowed" options per Rate Control */
+static const rc_mode_t RC_MODES[] = {
+	{.name = "CBR", .qp = false, .bitrate = true, .maxrate = false},
+	{.name = "CQP", .qp = true, .bitrate = false, .maxrate = false},
+	{.name = "VBR", .qp = false, .bitrate = true, .maxrate = true},
+	NULL};
+
 static const rc_mode_t *get_rc_mode(const char *name)
 {
-	/* Set "allowed" options per Rate Control */
-	static const rc_mode_t RC_MODES[] = {
-		{.name = "CBR", .qp = false, .bitrate = true, .maxrate = false},
-		{.name = "CQP", .qp = true, .bitrate = false, .maxrate = false},
-		{.name = "VBR", .qp = false, .bitrate = true, .maxrate = true},
-		NULL};
-
 	const rc_mode_t *rc_mode = RC_MODES;
 
 	while (!!rc_mode && strcmp(rc_mode->name, name) != 0)
@@ -285,6 +310,7 @@ static bool vaapi_update(void *data, obs_data_t *settings)
 
 	info("settings:\n"
 	     "\tdevice:       %s\n"
+	     "\tcodec:        %s\n"
 	     "\trate_control: %s\n"
 	     "\tprofile:      %d\n"
 	     "\tlevel:        %d\n"
@@ -295,9 +321,9 @@ static bool vaapi_update(void *data, obs_data_t *settings)
 	     "\twidth:        %d\n"
 	     "\theight:       %d\n"
 	     "\tb-frames:     %d\n",
-	     device, rate_control, profile, level, qp, bitrate, maxrate,
-	     enc->context->gop_size, enc->context->width, enc->context->height,
-	     enc->context->max_b_frames);
+	     device, enc->vaapi->name, rate_control, profile, level, qp,
+	     bitrate, maxrate, enc->context->gop_size, enc->context->width,
+	     enc->context->height, enc->context->max_b_frames);
 
 	return vaapi_init_codec(enc, device);
 }
@@ -351,9 +377,16 @@ static void *vaapi_create(obs_data_t *settings, obs_encoder_t *encoder)
 	enc = bzalloc(sizeof(*enc));
 	enc->encoder = encoder;
 
-	enc->vaapi = avcodec_find_encoder_by_name("h264_vaapi");
+	int vaapi_codec = (int)obs_data_get_int(settings, "vaapi_codec");
 
-	enc->first_packet = true;
+	if (vaapi_codec == AV_CODEC_ID_H264) {
+		enc->vaapi = avcodec_find_encoder_by_name("h264_vaapi");
+		enc->first_packet = true;
+	}
+	if (vaapi_codec == AV_CODEC_ID_HEVC) {
+		enc->vaapi = avcodec_find_encoder_by_name("hevc_vaapi");
+		enc->first_packet = false;
+	}
 
 	blog(LOG_INFO, "---------------------------------");
 
@@ -488,7 +521,10 @@ static bool vaapi_encode(void *data, struct encoder_frame *frame,
 		packet->data = enc->buffer.array;
 		packet->size = enc->buffer.num;
 		packet->type = OBS_ENCODER_VIDEO;
-		packet->keyframe = obs_avc_keyframe(packet->data, packet->size);
+		packet->keyframe =
+			enc->vaapi->id == AV_CODEC_ID_H264
+				? obs_avc_keyframe(packet->data, packet->size)
+				: enc->packet->flags & AV_PKT_FLAG_KEY;
 		*received_packet = true;
 	} else {
 		*received_packet = false;
@@ -509,18 +545,21 @@ static void set_visible(obs_properties_t *ppts, const char *name, bool visible)
 	obs_property_set_visible(p, visible);
 }
 
-static void vaapi_defaults(obs_data_t *settings)
+static void vaapi_defaults(obs_data_t *settings, void *type_data)
 {
+	struct type_data *codec = type_data;
+
 	obs_data_set_default_string(settings, "vaapi_device",
 				    "/dev/dri/renderD128");
-	obs_data_set_default_int(settings, "profile",
-				 FF_PROFILE_H264_CONSTRAINED_BASELINE);
-	obs_data_set_default_int(settings, "level", 40);
+	obs_data_set_default_int(settings, "vaapi_codec", codec->id);
+	obs_data_set_default_int(settings, "profile", codec->profile);
+	obs_data_set_default_int(settings, "level", codec->level);
 	obs_data_set_default_int(settings, "bitrate", 2500);
 	obs_data_set_default_int(settings, "keyint_sec", 0);
 	obs_data_set_default_int(settings, "bf", 0);
 	obs_data_set_default_int(settings, "rendermode", 0);
-	obs_data_set_default_string(settings, "rate_control", "CBR");
+	obs_data_set_default_string(settings, "rate_control",
+				    codec->rate_control);
 	obs_data_set_default_int(settings, "qp", 20);
 	obs_data_set_default_int(settings, "maxrate", 0);
 }
@@ -568,9 +607,13 @@ static bool get_device_name_from_pci(struct pci_access *pacc, char *pci_slot,
 	return false;
 }
 
-static obs_properties_t *vaapi_properties(void *unused)
+static obs_properties_t *vaapi_properties(void *unused, void *type_data)
 {
 	UNUSED_PARAMETER(unused);
+	struct type_data *codec = type_data;
+	struct dstr name;
+
+	dstr_init(&name);
 
 	obs_properties_t *props = obs_properties_create();
 	obs_property_t *list;
@@ -642,28 +685,58 @@ static obs_properties_t *vaapi_properties(void *unused)
 		}
 	}
 
-	list = obs_properties_add_list(props, "profile",
-				       obs_module_text("Profile"),
-				       OBS_COMBO_TYPE_LIST,
-				       OBS_COMBO_FORMAT_INT);
-	obs_property_list_add_int(list, "Constrained Baseline (default)",
-				  FF_PROFILE_H264_CONSTRAINED_BASELINE);
-	obs_property_list_add_int(list, "Main", FF_PROFILE_H264_MAIN);
-	obs_property_list_add_int(list, "High", FF_PROFILE_H264_HIGH);
-
-	list = obs_properties_add_list(props, "level", obs_module_text("Level"),
-				       OBS_COMBO_TYPE_LIST,
-				       OBS_COMBO_FORMAT_INT);
-	obs_property_list_add_int(list, "Auto", FF_LEVEL_UNKNOWN);
-	obs_property_list_add_int(list, "3.0", 30);
-	obs_property_list_add_int(list, "3.1", 31);
-	obs_property_list_add_int(list, "4.0 (default) (Compatibility mode)",
-				  40);
-	obs_property_list_add_int(list, "4.1", 41);
-	obs_property_list_add_int(list, "4.2", 42);
-	obs_property_list_add_int(list, "5.0", 50);
-	obs_property_list_add_int(list, "5.1", 51);
-	obs_property_list_add_int(list, "5.2", 52);
+	if (codec->id == AV_CODEC_ID_H264) {
+		list = obs_properties_add_list(props, "profile",
+						obs_module_text("Profile"),
+						OBS_COMBO_TYPE_LIST,
+						OBS_COMBO_FORMAT_INT);
+		obs_property_list_add_int(list, "Constrained Baseline (default)",
+						FF_PROFILE_H264_CONSTRAINED_BASELINE);
+		obs_property_list_add_int(list, "Main", FF_PROFILE_H264_MAIN);
+		obs_property_list_add_int(list, "High", FF_PROFILE_H264_HIGH);
+
+		list = obs_properties_add_list(props, "level",
+						obs_module_text("Level"),
+						OBS_COMBO_TYPE_LIST,
+						OBS_COMBO_FORMAT_INT);
+		obs_property_list_add_int(list, "Auto", FF_LEVEL_UNKNOWN);
+		obs_property_list_add_int(list, "3.0", 30);
+		obs_property_list_add_int(list, "3.1", 31);
+		obs_property_list_add_int(list, "4.0 (default) (Compatibility mode)",
+						40);
+		obs_property_list_add_int(list, "4.1", 41);
+		obs_property_list_add_int(list, "4.2", 42);
+		obs_property_list_add_int(list, "5.0", 50);
+		obs_property_list_add_int(list, "5.1", 51);
+		obs_property_list_add_int(list, "5.2", 52);
+	} else if (codec->id == AV_CODEC_ID_HEVC) {
+		list = obs_properties_add_list(props, "profile",
+						obs_module_text("Profile"),
+						OBS_COMBO_TYPE_LIST,
+						OBS_COMBO_FORMAT_INT);
+		obs_property_list_add_int(list, "Main",	FF_PROFILE_HEVC_MAIN);
+		obs_property_list_add_int(list, "Main10", FF_PROFILE_HEVC_MAIN_10);
+		obs_property_list_add_int(list, "Rext", FF_PROFILE_HEVC_REXT);
+
+		list = obs_properties_add_list(props, "level",
+						obs_module_text("Level"),
+						OBS_COMBO_TYPE_LIST,
+						OBS_COMBO_FORMAT_INT);
+		obs_property_list_add_int(list, "Auto", FF_LEVEL_UNKNOWN);
+		obs_property_list_add_int(list, "1", 30);
+		obs_property_list_add_int(list, "2", 60);
+		obs_property_list_add_int(list, "2.1", 63);
+		obs_property_list_add_int(list, "3", 90);
+		obs_property_list_add_int(list, "3.1", 93);
+		obs_property_list_add_int(list, "4", 120);
+		obs_property_list_add_int(list, "4.1", 123);
+		obs_property_list_add_int(list, "5", 150);
+		obs_property_list_add_int(list, "5.1", 153);
+		obs_property_list_add_int(list, "5.2", 156);
+		obs_property_list_add_int(list, "6", 180);
+		obs_property_list_add_int(list, "6.1", 183);
+		obs_property_list_add_int(list, "6.2", 186);
+	}
 
 	list = obs_properties_add_list(props, "rate_control",
 				       obs_module_text("RateControl"),
@@ -690,6 +763,7 @@ static obs_properties_t *vaapi_properties(void *unused)
 			       obs_module_text("KeyframeIntervalSec"), 0, 20,
 			       1);
 
+	dstr_free(&name);
 	return props;
 }
 
@@ -719,11 +793,28 @@ struct obs_encoder_info vaapi_encoder_info = {
 	.create = vaapi_create,
 	.destroy = vaapi_destroy,
 	.encode = vaapi_encode,
-	.get_defaults = vaapi_defaults,
-	.get_properties = vaapi_properties,
+	.get_defaults2 = vaapi_defaults,
+	.get_properties2 = vaapi_properties,
+	.get_extra_data = vaapi_extra_data,
+	.get_sei_data = vaapi_sei_data,
+	.get_video_info = vaapi_video_info,
+	.type_data = &h264_type,
+};
+
+struct obs_encoder_info vaapi_hevc_encoder_info = {
+	.id = "ffmpeg_vaapi_hevc",
+	.type = OBS_ENCODER_VIDEO,
+	.codec = "hevc",
+	.get_name = vaapi_getname,
+	.create = vaapi_create,
+	.destroy = vaapi_destroy,
+	.encode = vaapi_encode,
+	.get_defaults2 = vaapi_defaults,
+	.get_properties2 = vaapi_properties,
 	.get_extra_data = vaapi_extra_data,
 	.get_sei_data = vaapi_sei_data,
 	.get_video_info = vaapi_video_info,
+	.type_data = &hevc_type,
 };
 
 #endif
diff --git a/plugins/obs-ffmpeg/obs-ffmpeg.c b/plugins/obs-ffmpeg/obs-ffmpeg.c
index da9ef85cd..bcf883ddc 100644
--- a/plugins/obs-ffmpeg/obs-ffmpeg.c
+++ b/plugins/obs-ffmpeg/obs-ffmpeg.c
@@ -40,6 +40,7 @@ extern struct obs_encoder_info aom_av1_encoder_info;
 
 #ifdef LIBAVUTIL_VAAPI_AVAILABLE
 extern struct obs_encoder_info vaapi_encoder_info;
+extern struct obs_encoder_info vaapi_hevc_encoder_info;
 #endif
 
 #ifndef __APPLE__
@@ -284,9 +285,9 @@ static bool nvenc_supported(bool *out_h264, bool *out_hevc)
 #endif
 
 #ifdef LIBAVUTIL_VAAPI_AVAILABLE
-static bool vaapi_supported(void)
+static bool vaapi_supported(const char *codec_name)
 {
-	AVCodec *vaenc = avcodec_find_encoder_by_name("h264_vaapi");
+	AVCodec *vaenc = avcodec_find_encoder_by_name(codec_name);
 	return !!vaenc;
 }
 #endif
@@ -354,9 +355,13 @@ bool obs_module_load(void)
 #endif
 	}
 #if !defined(_WIN32) && defined(LIBAVUTIL_VAAPI_AVAILABLE)
-	if (vaapi_supported()) {
-		blog(LOG_INFO, "FFMPEG VAAPI supported");
-		obs_register_encoder(&vaapi_encoder_info);
+	if (vaapi_supported("h264_vaapi")) {
+ 		blog(LOG_INFO, "FFMPEG VAAPI supported");
+ 		obs_register_encoder(&vaapi_encoder_info);
+ 	}
+	if (vaapi_supported("hevc_vaapi")) {
+		blog(LOG_INFO, "FFMPEG HEVC VAAPI supported");
+		obs_register_encoder(&vaapi_hevc_encoder_info);
 	}
 #endif
 #endif

Last edited by loqs (2022-07-12 01:59:04)

Offline

#9 2022-07-12 03:32:27

rajhlinux
Member
Registered: 2022-07-08
Posts: 58

Re: [SOLVED] yay - error making: obs-hevc-vaapi-git

loqs wrote:

The following diff allowed the package to build,  no further testing was performed

So this means something is wrong with my system for building the package? If so what could be wrong?

Thanks.

Offline

#10 2022-07-12 03:49:36

Awebb
Member
Registered: 2010-05-06
Posts: 6,286

Re: [SOLVED] yay - error making: obs-hevc-vaapi-git

Have you applied the patches loqs proposed?

Offline

#11 2022-07-12 04:11:08

loqs
Member
Registered: 2014-03-06
Posts: 17,362

Re: [SOLVED] yay - error making: obs-hevc-vaapi-git

The issue was not with your system but the PKGBUILD and hevc-vaapi.diff have not been updated for changes in obs-studio git repo that the package uses as Awebb explained.

git clone https://aur.archlinux.org/obs-hevc-vaapi-git.git
cd obs-hevc-vaapi-git/
git apply -v PKGBUILD.diff # Where PKGBUILD.diff contains the contents of the first code block from post #8

After patching hevc-vaapi.diff should match the second code block from post #8
Edit:
You may also need the following change to cef-minmal

git diff
diff --git a/PKGBUILD b/PKGBUILD
index 17eaba4..498eeec 100755
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -32,6 +32,8 @@ sha1sums_x86_64=("6da8c04199856e8b0992436546f6adf91a863926")
 [[ "$CARCH" = "x86_64" ]] && _arch="64"
 
 build() {
+CFLAGS+=' -ffat-lto-objects'
+CXXFLAGS+=' -ffat-lto-objects'
   cd "$srcdir"/cef_binary_${_pkgver}_linux${_arch}_minimal
   sed -i 's/-Werror/#-Werror/g' cmake/cef_variables.cmake
 

Last edited by loqs (2022-07-12 05:19:05)

Offline

#12 2022-07-12 06:10:18

bulletmark
Member
From: Brisbane, Australia
Registered: 2013-10-22
Posts: 653

Re: [SOLVED] yay - error making: obs-hevc-vaapi-git

loqs wrote:

The issue was not with your system but the PKGBUILD and hevc-vaapi.diff have not been updated for changes in obs-studio git repo that the package uses as Awebb explained.

It seems to me a flaw that a git package would rely on any patch file and thus be chronically fragile to repo updates. Do/should the AUR guidelines recommend against this?

Offline

#13 2022-07-12 07:08:41

rajhlinux
Member
Registered: 2022-07-08
Posts: 58

Re: [SOLVED] yay - error making: obs-hevc-vaapi-git

Awebb wrote:

Have you applied the patches loqs proposed?

Oh I didn't know "loqs" provided a patch.

Will patch it now.

Offline

#14 2022-07-12 07:09:46

rajhlinux
Member
Registered: 2022-07-08
Posts: 58

Re: [SOLVED] yay - error making: obs-hevc-vaapi-git

loqs wrote:

The issue was not with your system but the PKGBUILD and hevc-vaapi.diff have not been updated for changes in obs-studio git repo that the package uses as Awebb explained.

git clone https://aur.archlinux.org/obs-hevc-vaapi-git.git
cd obs-hevc-vaapi-git/
git apply -v PKGBUILD.diff # Where PKGBUILD.diff contains the contents of the first code block from post #8

After patching hevc-vaapi.diff should match the second code block from post #8
Edit:
You may also need the following change to cef-minmal

git diff
diff --git a/PKGBUILD b/PKGBUILD
index 17eaba4..498eeec 100755
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -32,6 +32,8 @@ sha1sums_x86_64=("6da8c04199856e8b0992436546f6adf91a863926")
 [[ "$CARCH" = "x86_64" ]] && _arch="64"
 
 build() {
+CFLAGS+=' -ffat-lto-objects'
+CXXFLAGS+=' -ffat-lto-objects'
   cd "$srcdir"/cef_binary_${_pkgver}_linux${_arch}_minimal
   sed -i 's/-Werror/#-Werror/g' cmake/cef_variables.cmake
 

Thank You mate for the patch. I will patch it now.

Offline

#15 2022-07-12 07:10:08

Awebb
Member
Registered: 2010-05-06
Posts: 6,286

Re: [SOLVED] yay - error making: obs-hevc-vaapi-git

bulletmark wrote:
loqs wrote:

The issue was not with your system but the PKGBUILD and hevc-vaapi.diff have not been updated for changes in obs-studio git repo that the package uses as Awebb explained.

It seems to me a flaw that a git package would rely on any patch file and thus be chronically fragile to repo updates. Do/should the AUR guidelines recommend against this?

obs-hevc-vaapi-git is a modified version of obs-studio. One way to make this more robust would be to fork it on github, patch it there in a stable manner and then let the PKGBUILD build that. You'd probably end up with an old OBS but the AUR helper experience would improve. The other way would be for the AUR maintainer to keep up with the OBS commits.

Offline

#16 2022-07-12 08:05:26

rajhlinux
Member
Registered: 2022-07-08
Posts: 58

Re: [SOLVED] yay - error making: obs-hevc-vaapi-git

I created a file called "PKGBUILD.diff" and paste in the contents from the first code block of post #8.

Then I edited the "hevc-vaapi.diff" file, deleted all the texts and paste in the contents from the second code block of post #8.

Seems like I get an error:

[user@user obs-hevc-vaapi-git]$ ls

fix_python_binary_loading.patch  hevc-vaapi.diff  PKGBUILD  PKGBUILD.diff

[user@user obs-hevc-vaapi-git]$ git apply -v PKGBUILD.diff

PKGBUILD.diff:111: space before tab in indent.
        enc = bzalloc(sizeof(*enc));
PKGBUILD.diff:112: space before tab in indent.
        enc->encoder = encoder;
PKGBUILD.diff:166: space before tab in indent.
        obs_data_set_default_int(settings, "rendermode", 0);
PKGBUILD.diff:223: space before tab in indent.
        list = obs_properties_add_list(props, "rate_control",
PKGBUILD.diff:224: space before tab in indent.
                                       obs_module_text("RateControl"),
Checking patch PKGBUILD...
Checking patch hevc-vaapi.diff...
error: while searching for:
diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c b/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
index 1598d39db..9b927a9e5 100644
--- a/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
+++ b/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
@@ -72,10 +72,35 @@ struct vaapi_encoder {
        bool initialized;
 };


error: patch failed: hevc-vaapi.diff:1
error: hevc-vaapi.diff: patch does not apply

Thanks

Offline

#17 2022-07-12 08:21:15

loqs
Member
Registered: 2014-03-06
Posts: 17,362

Re: [SOLVED] yay - error making: obs-hevc-vaapi-git

You do not need to edit hevc-vaapi.diff git will change that when applying the patch.

$ git reset --hard #undo the changes to hevc-vaapi.diff
HEAD is now at 9adcb14 bumped version number
$ git status
On branch master
Your branch is up to date with 'origin/master'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	PKGBUILD.diff

nothing added to commit but untracked files present (use "git add" to track)
$ git apply -v PKGBUILD.diff
PKGBUILD.diff:111: space before tab in indent.
 	enc = bzalloc(sizeof(*enc));
PKGBUILD.diff:112: space before tab in indent.
 	enc->encoder = encoder;
PKGBUILD.diff:118: trailing whitespace.
 
PKGBUILD.diff:166: space before tab in indent.
 	obs_data_set_default_int(settings, "rendermode", 0);
PKGBUILD.diff:222: trailing whitespace.
 
Checking patch PKGBUILD...
Checking patch hevc-vaapi.diff...
Applied patch PKGBUILD cleanly.
Applied patch hevc-vaapi.diff cleanly.
warning: squelched 2 whitespace errors
warning: 7 lines add whitespace errors.

Edit:

PKGBUILD for cef-minimal updated to 103.0.5060.114 (Current Stable Build) also removed i686 support no longer provided by upstream

# Maintainer: Anderson Rocha <anderson2320@gmail.com>
# Contributor: NexAdn <nexadn@yandex.com>

pkgname=cef-minimal
pkgver="103.0.9"
_pkgcommit="gd0bbcbb"
_chromiumver="103.0.5060.114"
_pkgver="${pkgver}+${_pkgcommit}+chromium-${_chromiumver}"
_url_pkgver="${pkgver}%2B${_pkgcommit}%2Bchromium-${_chromiumver}"
pkgrel=1
pkgdesc="Chromium Embedded Framework minimal release"
arch=("x86_64")
url="https://bitbucket.org/chromiumembedded/cef"
license=("BSD")
depends=("nss" "alsa-lib" "libxss" "libxtst" "libglvnd" "pango" "libxcursor" "dbus" "libxrandr" "libxcomposite" "at-spi2-atk")
makedepends=("cmake")
provides=("cef")
conflicts=("cef-standard" "cef-git")

source_x86_64=(
  "https://cef-builds.spotifycdn.com/cef_binary_${_url_pkgver}_linux64_minimal.tar.bz2"
)

sha1sums_x86_64=('54d8f8bd52fbd0eecf5a0acd92e407f04f699c80')

build() {
CFLAGS+=' -ffat-lto-objects'
CXXFLAGS+=' -ffat-lto-objects'
  cmake -B build -S cef_binary_${_pkgver}_linux64_minimal -DCMAKE_BUILD_TYPE=Release
  cmake --build build
}

package() {
  mkdir -p "$pkgdir"/opt/cef/
  cp -R build/* "$pkgdir"/opt/cef
  install -Dm644 cef_binary_${_pkgver}_linux64_minimal/LICENSE.txt "$pkgdir"/usr/share/licenses/${pkgname}/LICENSE

  # Fix read permissions
  chmod 644 "$pkgdir"/opt/cef/libcef_dll_wrapper/libcef_dll_wrapper.a
}

Last edited by loqs (2022-07-12 10:06:07)

Offline

#18 2022-07-12 09:58:43

bulletmark
Member
From: Brisbane, Australia
Registered: 2013-10-22
Posts: 653

Re: [SOLVED] yay - error making: obs-hevc-vaapi-git

Awebb wrote:

The other way would be for the AUR maintainer to keep up with the OBS commits.

That won't work. Even the most punctual of maintainers can not anticipate git push changes ahead of time so there will always be a small window in which the PKGBUILD can be invalid and unsuspecting users will get install errors. So seems to me just bad practice. Yet add another note to add to my list of why -git AUR packages are a bad idea.

Last edited by bulletmark (2022-07-12 09:59:32)

Offline

#19 2022-07-12 11:08:08

Lone_Wolf
Member
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 11,916

Re: [SOLVED] yay - error making: obs-hevc-vaapi-git

unsuspecting users

Such users should stay away from -git pacakges .


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.


(A works at time B)  && (time C > time B ) ≠  (A works at time C)

Offline

#20 2022-07-14 06:01:05

rajhlinux
Member
Registered: 2022-07-08
Posts: 58

Re: [SOLVED] yay - error making: obs-hevc-vaapi-git

loqs wrote:

You do not need to edit hevc-vaapi.diff git will change that when applying the patch.

$ git reset --hard #undo the changes to hevc-vaapi.diff
HEAD is now at 9adcb14 bumped version number
$ git status
On branch master
Your branch is up to date with 'origin/master'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)
	PKGBUILD.diff

nothing added to commit but untracked files present (use "git add" to track)
$ git apply -v PKGBUILD.diff
PKGBUILD.diff:111: space before tab in indent.
 	enc = bzalloc(sizeof(*enc));
PKGBUILD.diff:112: space before tab in indent.
 	enc->encoder = encoder;
PKGBUILD.diff:118: trailing whitespace.
 
PKGBUILD.diff:166: space before tab in indent.
 	obs_data_set_default_int(settings, "rendermode", 0);
PKGBUILD.diff:222: trailing whitespace.
 
Checking patch PKGBUILD...
Checking patch hevc-vaapi.diff...
Applied patch PKGBUILD cleanly.
Applied patch hevc-vaapi.diff cleanly.
warning: squelched 2 whitespace errors
warning: 7 lines add whitespace errors.

Edit:

PKGBUILD for cef-minimal updated to 103.0.5060.114 (Current Stable Build) also removed i686 support no longer provided by upstream

# Maintainer: Anderson Rocha <anderson2320@gmail.com>
# Contributor: NexAdn <nexadn@yandex.com>

pkgname=cef-minimal
pkgver="103.0.9"
_pkgcommit="gd0bbcbb"
_chromiumver="103.0.5060.114"
_pkgver="${pkgver}+${_pkgcommit}+chromium-${_chromiumver}"
_url_pkgver="${pkgver}%2B${_pkgcommit}%2Bchromium-${_chromiumver}"
pkgrel=1
pkgdesc="Chromium Embedded Framework minimal release"
arch=("x86_64")
url="https://bitbucket.org/chromiumembedded/cef"
license=("BSD")
depends=("nss" "alsa-lib" "libxss" "libxtst" "libglvnd" "pango" "libxcursor" "dbus" "libxrandr" "libxcomposite" "at-spi2-atk")
makedepends=("cmake")
provides=("cef")
conflicts=("cef-standard" "cef-git")

source_x86_64=(
  "https://cef-builds.spotifycdn.com/cef_binary_${_url_pkgver}_linux64_minimal.tar.bz2"
)

sha1sums_x86_64=('54d8f8bd52fbd0eecf5a0acd92e407f04f699c80')

build() {
CFLAGS+=' -ffat-lto-objects'
CXXFLAGS+=' -ffat-lto-objects'
  cmake -B build -S cef_binary_${_pkgver}_linux64_minimal -DCMAKE_BUILD_TYPE=Release
  cmake --build build
}

package() {
  mkdir -p "$pkgdir"/opt/cef/
  cp -R build/* "$pkgdir"/opt/cef
  install -Dm644 cef_binary_${_pkgver}_linux64_minimal/LICENSE.txt "$pkgdir"/usr/share/licenses/${pkgname}/LICENSE

  # Fix read permissions
  chmod 644 "$pkgdir"/opt/cef/libcef_dll_wrapper/libcef_dll_wrapper.a
}

Alright I will try this again.

Thanks.

Offline

#21 2022-07-14 06:13:42

rajhlinux
Member
Registered: 2022-07-08
Posts: 58

Re: [SOLVED] yay - error making: obs-hevc-vaapi-git

Alright, I removed the "obs-hevc-vaapi-git" and "git clone" a new one.

Then I simply created a "PKGBUILD.diff" file and pasted in the contents of code block 1 from post# 8.

I get this error below:

[user@user obs-hevc-vaapi-git]$ ls
fix_python_binary_loading.patch  hevc-vaapi.diff  PKGBUILD
[user@user obs-hevc-vaapi-git]$ git reset --hard #undo the changes to hevc-vaapi.diff
HEAD is now at 9adcb14 bumped version number
[user@user obs-hevc-vaapi-git]$ git status
On branch master
Your branch is up to date with 'origin/master'.

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        PKGBUILD.diff

nothing added to commit but untracked files present (use "git add" to track)
[user@user obs-hevc-vaapi-git]$ git apply -v PKGBUILD.diff
PKGBUILD.diff:111: space before tab in indent.
        enc = bzalloc(sizeof(*enc));
PKGBUILD.diff:112: space before tab in indent.
        enc->encoder = encoder;
PKGBUILD.diff:166: space before tab in indent.
        obs_data_set_default_int(settings, "rendermode", 0);
PKGBUILD.diff:223: space before tab in indent.
        list = obs_properties_add_list(props, "rate_control",
PKGBUILD.diff:224: space before tab in indent.
                                       obs_module_text("RateControl"),
Checking patch PKGBUILD...
Checking patch hevc-vaapi.diff...
error: while searching for:
diff --git a/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c b/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
index 1598d39db..9b927a9e5 100644
--- a/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
+++ b/plugins/obs-ffmpeg/obs-ffmpeg-vaapi.c
@@ -72,10 +72,35 @@ struct vaapi_encoder {
        bool initialized;
 };


error: patch failed: hevc-vaapi.diff:1
error: hevc-vaapi.diff: patch does not apply
[user@user obs-hevc-vaapi-git]$

Last edited by rajhlinux (2022-07-14 06:28:02)

Offline

#22 2022-07-14 06:15:54

Awebb
Member
Registered: 2010-05-06
Posts: 6,286

Re: [SOLVED] yay - error making: obs-hevc-vaapi-git

bulletmark wrote:

and unsuspecting users will get install errors. So seems to me just bad practice. Yet add another note to add to my list of why -git AUR packages are a bad idea.

How does one end up being "unsuspecting" when dealing with -git packages? They are there for those cases, where you absolutely want or need the latest commit. This ops-hevc-vaapi package has no business being a -git package instead of being nailed to a commit compatible with the patches, but this package isn't representative of -git packages.

Offline

#23 2022-07-14 07:09:18

loqs
Member
Registered: 2014-03-06
Posts: 17,362

Re: [SOLVED] yay - error making: obs-hevc-vaapi-git

OK I have uploaded the diff to a pastebin.  The below works for me

$ git clone https://aur.archlinux.org/obs-hevc-vaapi-git.git
$ cd obs-hevc-vaapi-git/
$ curl -o PKGBUILD.diff http://ix.io/44jC
$ sha256sum PKGBUILD.diff
f2aa89e3f701d8430d574022e34cac27e9c7569e3ec18a8a8d1ccd03fe230c45  PKGBUILD.diff
$ git apply -v PKGBUILD.diff
PKGBUILD.diff:111: space before tab in indent.
 	enc = bzalloc(sizeof(*enc));
PKGBUILD.diff:112: space before tab in indent.
 	enc->encoder = encoder;
PKGBUILD.diff:118: trailing whitespace.
 
PKGBUILD.diff:166: space before tab in indent.
 	obs_data_set_default_int(settings, "rendermode", 0);
PKGBUILD.diff:222: trailing whitespace.
 
Checking patch PKGBUILD...
Checking patch hevc-vaapi.diff...
Applied patch PKGBUILD cleanly.
Applied patch hevc-vaapi.diff cleanly.
warning: squelched 2 whitespace errors
warning: 7 lines add whitespace errors.

Last edited by loqs (2022-07-14 07:09:59)

Offline

#24 2022-07-15 01:15:12

rajhlinux
Member
Registered: 2022-07-08
Posts: 58

Re: [SOLVED] yay - error making: obs-hevc-vaapi-git

loqs wrote:

OK I have uploaded the diff to a pastebin.  The below works for me

Thank You mate, will try this now.

Last edited by rajhlinux (2022-07-15 01:16:22)

Offline

#25 2022-07-17 07:16:32

rajhlinux
Member
Registered: 2022-07-08
Posts: 58

Re: [SOLVED] yay - error making: obs-hevc-vaapi-git

loqs wrote:

OK I have uploaded the diff to a pastebin.  The below works for me

Thank You mate, this has worked.

I will post your solution to the AUR comment section, so that it can help many of the OBS users like myself, who are trying to get GPU acceleration in HEVC encoding for live recording or streaming.

Also thanks to everyone for their support.

Offline

Board footer

Powered by FluxBB