1{
2 lib,
3 stdenv,
4 fetchFromGitHub,
5 gst_all_1,
6 pciutils,
7 pkg-config,
8 meson,
9 ninja,
10 obs-studio,
11}:
12
13stdenv.mkDerivation rec {
14 pname = "obs-vaapi";
15 version = "0.4.2";
16
17 src = fetchFromGitHub {
18 owner = "fzwoch";
19 repo = pname;
20 rev = version;
21 hash = "sha256-ykiLsHL3hoe0ibxMxp4zrqeSeQfgnJfNg7Yb5i9HDJQ=";
22 };
23
24 nativeBuildInputs = [
25 pkg-config
26 meson
27 ninja
28 ];
29 buildInputs = with gst_all_1; [
30 gstreamer
31 gst-plugins-base
32 obs-studio
33 pciutils
34 ];
35
36 # - We need "getLib" instead of default derivation, otherwise it brings gstreamer-bin;
37 # - without gst-plugins-base it won't even show proper errors in logs;
38 # - Without gst-plugins-bad it won't find element "vapostproc";
39 # - gst-vaapi adds "VA-API" to "Encoder type";
40 # Tip: "could not link appsrc to videoconvert1" can mean a lot of things, enable GST_DEBUG=2 for help.
41 passthru.obsWrapperArguments =
42 let
43 gstreamerHook =
44 package: "--prefix GST_PLUGIN_SYSTEM_PATH_1_0 : ${lib.getLib package}/lib/gstreamer-1.0";
45 in
46 with gst_all_1;
47 builtins.map gstreamerHook [
48 gstreamer
49 gst-plugins-base
50 gst-plugins-bad
51 gst-vaapi
52 ];
53
54 # Fix output directory
55 postInstall = ''
56 mkdir $out/lib/obs-plugins
57 mv $out/lib/obs-vaapi.so $out/lib/obs-plugins/
58 '';
59
60 meta = {
61 description = "OBS Studio VAAPI support via GStreamer";
62 homepage = "https://github.com/fzwoch/obs-vaapi";
63 changelog = "https://github.com/fzwoch/obs-vaapi/releases/tag/${version}";
64 maintainers = with lib.maintainers; [
65 ahuzik
66 pedrohlc
67 ];
68 license = lib.licenses.gpl2Plus;
69 platforms = [
70 "x86_64-linux"
71 "i686-linux"
72 ];
73 };
74}