Sway: Simplify codec params.

This commit is contained in:
Dmitry Voronin 2024-12-26 11:39:22 +03:00
parent 732fbbf885
commit aa40735236
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k

View file

@ -11,22 +11,19 @@ let
keyboardLayouts = config.module.keyboard.layouts; keyboardLayouts = config.module.keyboard.layouts;
keyboardOptions = config.module.keyboard.options; keyboardOptions = config.module.keyboard.options;
alpha = config.module.style.opacity.hex;
accent = config.module.style.color.accent + alpha; accent = config.module.style.color.accent + alpha;
alpha = config.module.style.opacity.hex;
border = config.module.style.color.border + alpha; border = config.module.style.color.border + alpha;
borderSize = config.module.style.window.border; borderSize = config.module.style.window.border;
fg = config.module.style.color.fg.light; fg = config.module.style.color.fg.light;
opacity = "26";
selection = with config.module.style.color; "slurp -d -b ${bg.light}${opacity} -c ${fg.light} -w 0 -s 00000000";
wallpaper = config.module.wallpaper.path; wallpaper = config.module.wallpaper.path;
windowGap = config.module.style.window.gap; windowGap = config.module.style.window.gap;
codec = "libsvtav1"; codec = "libsvtav1";
color = config.module.style.color;
container = "mp4"; container = "mp4";
format = "%Y-%m-%d_%H-%M-%S"; format = "%Y-%m-%d_%H-%M-%S";
framerate = 30;
opacity = "26";
pixfmt = "yuv420p10le";
selection = "slurp -d -b ${color.bg.light}${opacity} -c ${color.fg.light} -w 0 -s 00000000";
notifyStart = ''swayscript notify_short''; notifyStart = ''swayscript notify_short'';
notifyEnd = ''swayscript notify_long''; notifyEnd = ''swayscript notify_long'';
@ -84,13 +81,11 @@ let
--codec h264_vaapi \ --codec h264_vaapi \
--device /dev/dri/renderD128 \ --device /dev/dri/renderD128 \
--no-damage \ --no-damage \
--framerate ${toString framerate} \
--file "''${scrFile}" \ --file "''${scrFile}" \
-o $(swaymsg -t get_outputs | jq -r ".[] | select(.focused) | .name") - || -o $(swaymsg -t get_outputs | jq -r ".[] | select(.focused) | .name") - ||
wf-recorder \ wf-recorder \
--codec libx264 \ --codec libx264 \
--no-damage \ --no-damage \
--framerate ${toString framerate} \
--file "''${scrFile}" \ --file "''${scrFile}" \
-o $(swaymsg -t get_outputs | jq -r ".[] | select(.focused) | .name") - -o $(swaymsg -t get_outputs | jq -r ".[] | select(.focused) | .name") -
''; '';
@ -99,9 +94,7 @@ let
wf-recorder \ wf-recorder \
--codec ${codec} \ --codec ${codec} \
--no-damage \ --no-damage \
--framerate ${toString framerate} \
--file "''${scrFile}" \ --file "''${scrFile}" \
--pixel-format "${pixfmt}" \
--codec-param "lp=$(($(cat /proc/cpuinfo | grep ^processor | wc -l) / 2))" \ --codec-param "lp=$(($(cat /proc/cpuinfo | grep ^processor | wc -l) / 2))" \
--geometry "''${scrSelection}" --geometry "''${scrSelection}"
''; '';
@ -111,7 +104,6 @@ let
ffmpeg \ ffmpeg \
-i "''${scrFile}" \ -i "''${scrFile}" \
-c:v ${codec} \ -c:v ${codec} \
-pix_fmt ${pixfmt} \
-f ${container} \ -f ${container} \
-svtav1-params "lp=$(($(cat /proc/cpuinfo | grep ^processor | wc -l) / 2))" \ -svtav1-params "lp=$(($(cat /proc/cpuinfo | grep ^processor | wc -l) / 2))" \
"''${scrFile}_" \ "''${scrFile}_" \