diff options
| author | Robert Günzler <r@gnzler.io> | 2020-02-21 01:21:48 +0100 |
|---|---|---|
| committer | Robert Günzler <r@gnzler.io> | 2020-02-21 01:23:15 +0100 |
| commit | e77638e8834991d387ce74da43d86d60665d7528 (patch) | |
| tree | b96dc8a285adc4c83c0815b38f9a3c8521b50dc6 | |
| parent | 58973263a38f93b23f8391ce6ab0be7e3de5b0a0 (diff) | |
grimshot: Use hw encoding with wf-recorder
also adds bin/wfez that has the args for it preset
| -rwxr-xr-x | bin/grimshot | 5 | ||||
| -rwxr-xr-x | bin/wfez | 38 |
2 files changed, 41 insertions, 2 deletions
diff --git a/bin/grimshot b/bin/grimshot index 819e7c5..7af270e 100755 --- a/bin/grimshot +++ b/bin/grimshot @@ -76,10 +76,11 @@ takeScreenshot() { recordScreen() { FILE=$1 GEOM=$2 + REC_OPTS="-c h264_vaapi -d /dev/dri/renderD128" if [ -z "$GEOM" ]; then - wf-recorder -f "$FILE" || die "Unable to invoke wf-recorder" + wf-recorder ${REC_OPTS} -f "$FILE" || die "Unable to invoke wf-recorder" else - wf-recorder -g "$GEOM" -f "$FILE" || die "Unable to invoke wf-recorder" + wf-recorder ${REC_OPTS} -g "$GEOM" -f "$FILE" || die "Unable to invoke wf-recorder" fi } diff --git a/bin/wfez b/bin/wfez new file mode 100755 index 0000000..d2f296c --- /dev/null +++ b/bin/wfez @@ -0,0 +1,38 @@ +#!/bin/sh + +# set -x + +output_file=${1:-"${HOME}/Videos/rec_$(now).mkv"} +audio_output=${WF_AOUT:-alsa_output.pci-0000_00_1f.3.analog-stereo} +audio_input=${WF_AIN:-alsa_input.pci-0000_00_1f.3.analog-stereo} +video_output=${WF_VOUT:-DP-5} +showkeys=${WF_KEYS} + +mux_sink=${WF_ASINK} +if [ -z "${mux_sink}" ]; then + mux_sink=wf-mux + mux_sink_id= + output_loopback_id= + input_loopback_id= + prepare_mux_sink() { + mux_sink_id=$(pactl load-module module-null-sink sink_name="${mux_sink}") + output_loopback_id=$(pactl load-module module-loopback sink="${mux_sink}" source="${audio_output}.monitor") + input_loopback_id=$(pactl load-module module-loopback sink="${mux_sink}" source="${audio_input}") + } + teardown_mux_sink() { + pactl unload-module "${mux_sink_id}" + pactl unload-module "${output_loopback_id}" + pactl unload-module "${input_loopback_id}" + } + trap '{ teardown_mux_sink >/dev/null; }' EXIT + prepare_mux_sink >/dev/null +fi + +if [ -n "${showkeys}" ]; then + echo "Starting wshowkeys on ${video_output}" + echo "WARNING: currently the -o flag to force display to a specific output is not implemented" >&2 + sway exec "wshowkeys -a bottom -a left -F 'Iosevka Sparkle 25' -t 1 -o ${video_output}" >/dev/null + trap '{ pkill wshowkeys; }' EXIT +fi + +wf-recorder -c h264_vaapi -d /dev/dri/renderD128 -o "${video_output}" -a "${mux_sink}.monitor" -f "${output_file}" |