Last active
September 16, 2021 06:13
-
-
Save frapontillo/03c5cf96bbf41b869a2d159d68176ab8 to your computer and use it in GitHub Desktop.
Record a video from an Android device
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 | |
adb shell screenrecord --bit-rate 6000000 /sdcard/$1.mp4 & PID=$! | |
# Upon a key press | |
read -p "Press [Enter] to stop recording..." | |
# Kills the recording process | |
kill $PID | |
# Wait for 3 seconds for the device to compile the video | |
sleep 3 | |
# Download the video | |
adb pull /sdcard/$1.mp4 | |
# Delete the video from the device | |
adb shell rm /sdcard/$1.mp4 | |
# Kill background process in case kill PID fails | |
trap "kill 0" SIGINT SIGTERM EXIT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment