Source link: https://gist.github.com/tasomaniac/93cefd97af13e2ea2b2f248affb373bd
Screen Record for Android
Shell file (1 KB): screenrecord.sh
#!/bin/sh set -e if [ -z "$1" ]; then
shot_path=$(date +%Y-%m-%d-%H-%M-%S).mp4 else
shot_path="$*" fi trap ctrl_c INT trap alldone EXIT function ctrl_c() {
printf "\n\nDownloading screencast"
sleep 2
adb pull /sdcard/Movies/$shot_path .
}
function alldone() {
adb shell settings put system show_touches 0
adb shell am broadcast -a com.android.systemui.demo -e command exit >/dev/null
printf "\nRecording Finished"
open -R $shot_path
}
function setup() {
echo "Setup"
adb shell settings put system show_touches 1
adb shell settings put global sysui_demo_allowed 1 >/dev/null
adb shell am broadcast -a com.android.systemui.demo -e command network -e mobile show -e datatype lte -e level 4 >/dev/null
adb shell am broadcast -a com.android.systemui.demo -e command battery -e level 100 -e plugged false >/dev/null
adb shell am broadcast -a com.android.systemui.demo -e command network -e wifi show -e level 4 >/dev/null
# Tweak this if you want the clock to changed
adb shell am broadcast -a com.android.systemui.demo -e command clock -e hhmm 0700 >/dev/null
# Remove this if you want notifications to be availalbe
adb shell am broadcast -a com.android.systemui.demo -e command notifications -e visible false >/dev/null
echo "Recording Started."
echo "Press CTRL-C to stop."
}
setup adb shell screenrecord --bit-rate 6000000 /sdcard/Movies/$shot_path