fix(hypr): drop gifski and use native ffmpeg for screen caps

This commit is contained in:
Price Hiller 2022-10-07 13:18:40 -05:00
parent 8fbe4e92be
commit 878d1549ec

View File

@ -2,9 +2,7 @@
# Dependencies: # Dependencies:
# - wf-recorder: https://github.com/ammen99/wf-recorder # - wf-recorder: https://github.com/ammen99/wf-recorder
# - Gifski: https://github.com/ImageOptim/gifski # - ffmpeg: https://ffmpeg.org/download.html
# - I do a conversion from mp4 to gif because there is various issues with recording straight to gif format with
# wf-recorder
# - notification daemon: https://archlinux.org/packages/?name=notification-daemon # - notification daemon: https://archlinux.org/packages/?name=notification-daemon
# - wl-clipboard: https://github.com/bugaevc/wl-clipboard # - wl-clipboard: https://github.com/bugaevc/wl-clipboard
# #
@ -28,11 +26,11 @@ mk-gif() {
notify-send "Starting ${program_name}" "Recording GIF of Selected Region" -a "${program_name}" notify-send "Starting ${program_name}" "Recording GIF of Selected Region" -a "${program_name}"
( (
cd "/tmp" cd "/tmp"
input_tmpfile="/tmp/$(mktemp wf-recorder.XXXXXXXXXXX).mp4" input_tmpfile="/tmp/$(mktemp wf-recorder.XXXXXXXXXXX)"
wf-recorder -g "$(slurp)" -f "${input_tmpfile}" & wf-recorder -g "$(slurp)" -f "${input_tmpfile}.mp4" -- &
printf "%s" $! >"${pid_file}" printf "%s" $! >"${pid_file}"
wait wait
gifski "${input_tmpfile}" --output "${input_tmpfile}.gif" ffmpeg -i "${input_tmpfile}.mp4" -vf "fps=10,scale=320:-1:flags=lanczos,split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse" -loop 0 "${input_tmpfile}.gif"
wl-copy --type image/gif <"${input_tmpfile}.gif" wl-copy --type image/gif <"${input_tmpfile}.gif"
rm -f "${pid_file}" rm -f "${pid_file}"
) )