Created
February 3, 2024 00:39
-
-
Save roryabraham/8861232fd07bcded0985ebdd32878253 to your computer and use it in GitHub Desktop.
A useful script to capture android screen from mac or linux terminal
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
#!/bin/bash | |
destination=$1 | |
deviceName="$(adb shell getprop ro.product.model)" | |
function postRecord() { | |
echo "⏳ Pulling screen recording from device..." | |
sleep 3 | |
adb pull /sdcard/tmp.mp4 "$destination" 1>/dev/null | |
adb shell rm /sdcard/tmp.mp4 1> /dev/null | |
echo "🎉 Screen recording saved to $destination" | |
stty echoctl | |
} | |
echo "🎥 Recording screen on $deviceName, press CTRL+C to stop recording..." | |
stty -echoctl | |
trap postRecord SIGINT | |
adb shell screenrecord /sdcard/tmp.mp4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment