Skip to content

Instantly share code, notes, and snippets.

@FriendlyTester
Created January 30, 2015 17:04
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save FriendlyTester/67c7ad26ab62849aea91 to your computer and use it in GitHub Desktop.
Save FriendlyTester/67c7ad26ab62849aea91 to your computer and use it in GitHub Desktop.
BASH script to record Android display and download/delete the video
#Check if an argument was supplied
if [ -z "$1" ]
then
echo "No argument supplied, please provide video name"
else
# start recording
adb shell screenrecord --bit-rate 6000000 /sdcard/$1.mp4 &
# Get its PID
PID=$!
# Upon a key press
read -p "Press [Enter] to stop recording..."
# Kills the recording process
kill $PID
# Wait for 3 seconds for the device to compile the video
sleep 3
# Download the video
adb pull /sdcard/$1.mp4
# Delete the video from the device
adb shell rm /sdcard/$1.mp4
# Kill background process incase kill PID fails
trap "kill 0" SIGINT SIGTERM EXIT
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment