Skip to content

Instantly share code, notes, and snippets.

@roryabraham
Created February 3, 2024 00:39
Show Gist options
  • Save roryabraham/8861232fd07bcded0985ebdd32878253 to your computer and use it in GitHub Desktop.
Save roryabraham/8861232fd07bcded0985ebdd32878253 to your computer and use it in GitHub Desktop.
A useful script to capture android screen from mac or linux terminal
#!/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