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