From a91a79cb503b5e33654419e2e40720213785055c Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Sun, 26 Feb 2023 19:56:16 -0600 Subject: [PATCH] refactor(hypr): make screen cap use hardware accel from gpu, record in mp4 --- dots/.config/hypr/scripts/screen-cap.bash | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/dots/.config/hypr/scripts/screen-cap.bash b/dots/.config/hypr/scripts/screen-cap.bash index baf18390..60665c9d 100755 --- a/dots/.config/hypr/scripts/screen-cap.bash +++ b/dots/.config/hypr/scripts/screen-cap.bash @@ -2,7 +2,6 @@ # Dependencies: # - wf-recorder: https://github.com/ammen99/wf-recorder -# - ffmpeg: https://ffmpeg.org/download.html # - notification daemon: https://archlinux.org/packages/?name=notification-daemon # - wl-clipboard: https://github.com/bugaevc/wl-clipboard # @@ -29,12 +28,10 @@ mk-gif() { tmp_dir="$(mktemp -d)" cd "${tmp_dir}" input_tmpfile="${tmp_dir}/$(mktemp wf-recorder.XXXXXXXXXXX)" - wf-recorder -g "$(slurp)" -f "${input_tmpfile}.mp4" --framerate 10 -- & + wf-recorder -g "$(slurp)" -f "${input_tmpfile}.mp4" -c h264_vaapi -d /dev/dri/renderD128 --framerate 24 -- & printf "%s" $! >"${pid_file}" wait - ffmpeg -i "${input_tmpfile}.mp4" -filter_complex "[0:v] palettegen" palette.png - ffmpeg -i "${input_tmpfile}.mp4" -i palette.png -filter_complex "[0:v][1:v] paletteuse" "${input_tmpfile}.gif" - wl-copy --type image/gif <"${input_tmpfile}.gif" + wl-copy --type video/mp4 <"${input_tmpfile}.mp4" rm -f "${pid_file}" ) fi