record.sh 486 B

12345678910111213
  1. #!/bin/sh
  2. if [ -f "ffmpeg.pid" ]; then
  3. kill "$(cat ffmpeg.pid)"
  4. rm -f ffmpeg.pid
  5. dunstify -a ffmpeg -h string:x-dunst-stack-tag:FFMPEG "ffmpeg" "Recording stopped"
  6. else
  7. default_sink="$(pactl info @DEFAULT_SINK@ | grep "^Default Sink" | awk '{print $3}').monitor"
  8. ffmpeg -f x11grab -i :0.0 -f pulse -ac 2 -i "$default_sink" -f pulse -i default -map 0 -map 1 -map 2 "$1" &
  9. echo $! > ffmpeg.pid
  10. dunstify -a ffmpeg -h string:x-dunst-stack-tag:FFMPEG "ffmpeg" "Recording started"
  11. fi