diff --git a/maskiner/laptop/configuration.nix b/maskiner/laptop/configuration.nix index 52f931f..77054b2 100644 --- a/maskiner/laptop/configuration.nix +++ b/maskiner/laptop/configuration.nix @@ -26,6 +26,13 @@ in enable = true; }; + hardware.graphics = { + enable = true; + extraPackages = with pkgs; [ + intel-media-driver + ]; + }; + webcam-rtsp = { enable = true; streams = { @@ -35,6 +42,7 @@ in framerate = 12; videoSize = "1280x720"; useVaapi = true; + vaapiDriver = "iHD"; vaapiQp = 26; bitrateKbps = 900; maxrateKbps = 1100; @@ -46,6 +54,7 @@ in framerate = 12; videoSize = "1280x720"; useVaapi = true; + vaapiDriver = "iHD"; vaapiQp = 26; bitrateKbps = 900; maxrateKbps = 1100; diff --git a/moduler/services/webcam-rtsp/default.nix b/moduler/services/webcam-rtsp/default.nix index 9db91ae..b0ea347 100644 --- a/moduler/services/webcam-rtsp/default.nix +++ b/moduler/services/webcam-rtsp/default.nix @@ -25,6 +25,7 @@ let useVaapi = cfg.useVaapi; vaapiDevice = cfg.vaapiDevice; vaapiQp = cfg.vaapiQp; + vaapiDriver = cfg.vaapiDriver; }; }; @@ -99,6 +100,11 @@ in default = 24; description = "VAAPI quality parameter (lower means better quality, higher CPU/bitrate)."; }; + vaapiDriver = mkOption { + type = types.nullOr types.str; + default = null; + description = "Optional LIBVA_DRIVER_NAME value (for example iHD)."; + }; streams = mkOption { type = types.attrsOf ( types.submodule { @@ -166,6 +172,11 @@ in default = 24; description = "VAAPI quality parameter for h264_vaapi."; }; + vaapiDriver = mkOption { + type = types.nullOr types.str; + default = null; + description = "Optional LIBVA_DRIVER_NAME value (for example iHD)."; + }; }; } ); @@ -209,6 +220,7 @@ in Type = "simple"; Restart = "always"; RestartSec = "2"; + Environment = optional (streamCfg.vaapiDriver != null) "LIBVA_DRIVER_NAME=${streamCfg.vaapiDriver}"; ExecStart = "${pkgs.ffmpeg}/bin/ffmpeg -hide_banner -loglevel warning -f v4l2 -framerate ${toString streamCfg.framerate} -video_size ${streamCfg.videoSize} -i ${streamCfg.device} ${videoCodecArgs} ${rateControlArgs} -f rtsp ${streamCfg.rtspUrl}"; }; }