Skip to content

Instantly share code, notes, and snippets.

@Gen2ly
Created August 23, 2012 20:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Gen2ly/3441383 to your computer and use it in GitHub Desktop.
Save Gen2ly/3441383 to your computer and use it in GitHub Desktop.
Create screencasts of area, full-screen, or window
#!/bin/bash
# Create screencasts of area, full-screen, or window
# Required program(s)
req_progs=(ffcast ffmpeg)
for p in ${req_progs[@]}; do
hash "$p" 2>&- || \
{ echo >&2 " Required program \"$p\" not installed."; exit 1; }
done
# Name screencast sequentially
if ! [ -f screencast-[0-9][0-9][0-9][0-9]* ]; then
cstname=screencast-0000
else
cstprev=$(ls -1 screencast-[0-9][0-9][0-9][0-9]* | tail -1)
cstnumb=$(echo $cstprev | grep -o [0-9][0-9][0-9][0-9])
cstname=screencast-$(printf "%04u" $((++cstnumb)))
fi
case $1 in
a ) ffcast -s ffmpeg -- -vcodec huffyuv -sameq -acodec pcm_s16le -f alsa -i pulse -ac 2 $cstname-area.avi ;;
f ) ffcast ffmpeg -- -vcodec huffyuv -sameq -acodec pcm_s16le -f alsa -i pulse -ac 2 $cstname-full.avi ;;
m ) ffcast -s % ffmpeg -f x11grab -follow_mouse 100 -s %wx%h -i :0.0+%x+%y -vcodec huffyuv -sameq -acodec pcm_s16le -f alsa -i pulse -ac 2 $cstname-mous.avi ;;
w ) ffcast -wb ffmpeg -- -vcodec huffyuv -sameq -acodec pcm_s16le -f alsa -i pulse -ac 2 $cstname-wind.avi ;;
* ) echo " ${0##*/} <a|f|m|w> - create screencasts (a)rea (f)ull-screen (m)ouse (w)indow"
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment