Skip to content

Instantly share code, notes, and snippets.

@ryanmr
Last active August 29, 2015 14:09
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 ryanmr/34eb927d8ac0fa5ff7e5 to your computer and use it in GitHub Desktop.
Save ryanmr/34eb927d8ac0fa5ff7e5 to your computer and use it in GitHub Desktop.
#!/bin/bash
# don't forget to include ADB in your path
# for example, in your ~/.bashrc, somewhere near the top
# export PATH=$PATH:/path/to/android-sdk/sdk/platform-tools
# check if there is a filename
if [ -z "$1" ]; then
echo usage: $0 filename
exit
fi
FILENAME=$1
# what to show when recording is stopped
control_c() {
echo -en "\n *** Stopping recording! *** \n"
echo -en "\n *** Use an Android File Explorer to access your video $FILENAME files on the device! *** \n"
exit $?
}
# trap the control-c interrupt
trap control_c SIGINT
# http://en.wikipedia.org/wiki/Bit_rate
BITRATE=9000000
COUNTER=0
MAXLENGTH=20
echo "At anytime, CTRL+C to stop the recording!"
# run the loop
while [ $COUNTER -lt $MAXLENGTH ]; do
TARGET=$1-$COUNTER.mp4
# echo "adb shell screenrecord --bit-rate "$BITRATE" --time-limit 180 /sdcard/"$TARGET
adb shell screenrecord --bit-rate $BITRATE --time-limit 180 "/sdcard/"$TARGET
let COUNTER=COUNTER+1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment