Last active
December 13, 2019 19:52
-
-
Save FranciscoG/4eb62608a2678eb0348d793a07e58c32 to your computer and use it in GitHub Desktop.
Using adb to create screen recordings of all plugged in Android devices
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 | |
# TODO: | |
# - add option to change the time limit | |
# - add option to change the output folder | |
# - add option to delete recordings on device once they have been pulled | |
# - figure out how to kill script when everything is done | |
# how many seconds to record for | |
LIMIT=5 | |
# where to send the file when it's done | |
FOLDER=~/Downloads/ | |
timestamp=$(date +%Y-%m-%d-%H:%M:%S) | |
record () { | |
local d=$1 | |
local f="/sdcard/${d}-${timestamp}.mp4" | |
echo "recording file ${f} for ${LIMIT} seconds" | |
(adb -s "$d" shell "screenrecord --time-limit ${LIMIT} ${f}") | |
wait | |
(adb -s "$d" pull "$f" "$FOLDER") | |
wait | |
open "$FOLDER" | |
} | |
adb devices | while read -r line | |
do | |
if [ ! "$line" = "" ] && [ "$(echo "$line" | awk '{print $2}')" = "device" ] | |
then | |
device=$(echo "$line" | awk '{print $1}') | |
record "$device" & | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment