Skip to content

Instantly share code, notes, and snippets.

@lxlgarnett
Created September 7, 2020 12:24
Show Gist options
  • Save lxlgarnett/e7c57998de26a149e633a9acdd4306a7 to your computer and use it in GitHub Desktop.
Save lxlgarnett/e7c57998de26a149e633a9acdd4306a7 to your computer and use it in GitHub Desktop.
Records screen record of Android device by using adb command.
#!/bin/bash
date_string=`date +%F-%s`
# Creates Screenrecords directory if not exist.
mkdir -p Screenrecords
function finish() {
adb shell pkill -SIGINT screenrecord
adb pull /sdcard/screenrecord_"$date_string".mp4 ./Screenrecords/
adb shell rm /sdcard/screenrecord_"$date_string".mp4
}
trap finish SIGINT
printf "Press Ctrl+C to stop screen recording.\n"
adb shell screenrecord /sdcard/screenrecord_"$date_string".mp4
@starikcetin
Copy link

@lxlgarnett
Copy link
Author

@starikcetin
That's great. Thank you

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