-
-
Save drjunior/d2d7063275e689e2e147334d4aab426e to your computer and use it in GitHub Desktop.
Screen Record for Android
This file contains 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
if [ -z "$1" ]; then | |
shot_path=$(date +%Y-%m-%d-%H-%M-%S).mp4 | |
else | |
shot_path="$*" | |
fi | |
ffmpeg="ffmpeg" | |
n6_frame="n6-background.png" | |
trap ctrl_c INT | |
function ctrl_c() { | |
echo "** Trapped CTRL-C" | |
echo "** Downloading screencast" | |
sleep 2 | |
adb shell am broadcast -a com.android.systemui.demo -e command exit | |
adb pull /sdcard/Movies/$shot_path . | |
if [ -x $(which "$ffmpeg") ] && [ -e "$n6_frame" ] | |
then | |
$ffmpeg -i $n6_frame -i $shot_path -filter_complex "[1:v]scale=480:-1[scaled_overlay],[0:v][scaled_overlay]overlay=x=(main_w-overlay_w)/2:y=(main_h-overlay_h)/2" $shot_path-frame.mp4 | |
fi | |
alldone | |
} | |
function setup() { | |
adb shell settings put global sysui_demo_allowed 1 | |
adb shell am broadcast -a com.android.systemui.demo -e command network -e mobile show -e datatype lte -e level 4 | |
adb shell am broadcast -a com.android.systemui.demo -e command battery -e level 100 -e plugged false | |
adb shell am broadcast -a com.android.systemui.demo -e command network -e wifi show -e level 4 | |
# Tweak this if you want the clock to changed | |
adb shell am broadcast -a com.android.systemui.demo -e command clock -e hhmm 0440 | |
# Remove this if you want notifications to be availalbe | |
adb shell am broadcast -a com.android.systemui.demo -e command notifications -e visible false | |
echo When finished, run: adb shell am broadcast -a com.android.systemui.demo -e command exit | |
} | |
function alldone() { | |
adb shell am broadcast -a com.android.systemui.demo -e command exit | |
} | |
setup | |
adb shell screenrecord --bit-rate 6000000 /sdcard/Movies/$shot_path | |
echo "Finished" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment