Skip to content

Instantly share code, notes, and snippets.

@ver-1000000
Created September 20, 2020 07:53
Show Gist options
  • Save ver-1000000/331989711d6237b229fb8404c12b9357 to your computer and use it in GitHub Desktop.
Save ver-1000000/331989711d6237b229fb8404c12b9357 to your computer and use it in GitHub Desktop.
Linuxでffmpeg/slopを使って矩形選択スクリーンキャプチャするやつ
#!/bin/bash
PID=`pgrep -f "ffmpeg -f x11grab -s"`
if [ `echo $PID | wc -w` = 1 ];
then
tput bel
SLOP=$(slop -f "%x %y %w %h %g %i") || exit 1
read -r X Y W H G ID < <(echo $SLOP)
ffmpeg -f x11grab -s "$W"x"$H" -i :0.0+$X,$Y -f alsa -i pulse -fs 128M ~/Downloads/`date +%4Y-%m-%d_%I-%m-%S`.mp4
else
tput bel; sleep 0.1; tput bel;
kill $PID
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment