-
-
Save tgehrs/5b2fcdad1dbb5fb103add86b34c05b8d to your computer and use it in GitHub Desktop.
BASH script to record Android display and download/delete the video
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function adb-screenrecord(){ | |
#name the file | |
filename=screen_record_$(date +"%s").mp4 | |
# start recording | |
adb shell screenrecord --bit-rate 6000000 /sdcard/$filename & | |
# 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/$filename ~/Desktop/$filename | |
# Delete the video from the device | |
adb shell rm /sdcard/$filename | |
# Kill background process incase kill PID fails | |
trap "kill 0" SIGINT SIGTERM EXIT | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment