Skip to content

Instantly share code, notes, and snippets.

@maha-dev
Created June 1, 2011 04:10
Show Gist options
  • Save maha-dev/1001775 to your computer and use it in GitHub Desktop.
Save maha-dev/1001775 to your computer and use it in GitHub Desktop.
ubuntu: screen capture
#!/bin/bash
#sudo apt-get install ffmpeg screen libnotify-bin
existing=`ps -ef | grep 'SCREEN -d -m -t screen-cap' | grep -v grep | awk '{print $2}'`
if [ -z "$existing" ]
then
screen -d -m -t screen-cap ffmpeg -y -f x11grab -vc x264 -s 1366x700 -r 30 -b 2000k -g 300 -i :0.0+0,40 ~/Desktop/session-recording.avi
existing=`ps -ef | grep 'SCREEN -d -m -t screen-cap' | grep -v grep | awk '{print $2}'`
notify-send "Screen Capture in progress pid:$existing" "Click the capture button again to end it."
else
kill -3 "$existing"
ps=`ps -ef | grep 'SCREEN -d -m -t screen-cap' | grep -v grep | awk '{print $2}'`
notify-send "Killing screen-cap $existing", "recheck; none existing: pid:$ps"
fi
@maha-dev
Copy link
Author

maha-dev commented Jun 1, 2011

Add to Panel -> Custom Application Launcher -> Launcher properties
Application Type: Application in Terminal
Name: screen-cap
Command: /path/to/bin/screen-cap
Choose a nice icon and press OK

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment