tweaked vaapi driver

This commit is contained in:
fwastring 2026-03-29 15:20:18 +02:00
parent 966970c256
commit e413d301f6
2 changed files with 21 additions and 0 deletions

View file

@ -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;

View file

@ -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}";
};
}