Sway: Always output AV1.

This commit is contained in:
Dmitry Voronin 2024-12-22 11:18:53 +03:00
parent a7329b10c0
commit 102e731f0a
Signed by: voronind
SSH key fingerprint: SHA256:3kBb4iV2ahufEBNq+vFbUe4QYfHt98DHQjN7QaptY9k

View file

@ -40,10 +40,9 @@ let
picToFile = ''tee "''${scrFile}"'';
screenshot = ''grim'';
updateWaybar = ''{ pkill -RTMIN+4 waybar; } & disown''; # NOTE: Might need to add a delay here if it becomes inconsistent one day.
vidFull = ''-o $(swaymsg -t get_outputs | jq -r ".[] | select(.focused) | .name") -'';
vidPrepFile = prepFile "\${XDG_VIDEOS_DIR[0]}" container;
vidRefLatestFile = refLatestFile container;
vidSelected = ''--geometry "''${scrSelection}"'';
vidSelected = '''';
vidStop = ''pkill -SIGINT wf-recorder'';
prepFile = path: ext: ''
@ -81,20 +80,30 @@ let
[[ "''${scrTransform}" = "normal" ]] && scrTransform=""
'';
vidStart = extra: ''
# NOTE: Use HW/fast encoder for intensive fullscreen rec and re-encode later.
vidStartFull = ''
wf-recorder \
--codec h264_vaapi \
--device /dev/dri/renderD128 \
--no-damage \
--framerate ${toString framerate} \
--file "''${scrFile}" \
${extra} ||
-o $(swaymsg -t get_outputs | jq -r ".[] | select(.focused) | .name") - ||
wf-recorder \
--codec libx264 \
--no-damage \
--framerate ${toString framerate} \
--file "''${scrFile}" \
${extra}
-o $(swaymsg -t get_outputs | jq -r ".[] | select(.focused) | .name") -
'';
vidStartSelected = ''
wf-recorder \
--codec ${codec} \
--no-damage \
--framerate ${toString framerate} \
--file "''${scrFile}" \
--geometry "''${scrSelection}"
'';
# NOTE: Only fullscreen rec is re-encoded.
@ -145,7 +154,7 @@ let
${vidPrepFile}
${notifyStart}
${updateWaybar}
${vidStart vidSelected}
${vidStartSelected}
${notifyEnd}
${updateWaybar}
${vidMuxAudio}
@ -160,7 +169,7 @@ let
${vidPrepFile}
${notifyStart}
${updateWaybar}
${vidStart vidFull}
${vidStartFull}
${notifyEnd}
${updateWaybar}
${vidEncode}