Skip to content

Instantly share code, notes, and snippets.

@imsardine
Created December 29, 2016 00:34
Show Gist options
  • Save imsardine/119fcef07cf7778d78fcb9cf5c56043b to your computer and use it in GitHub Desktop.
Save imsardine/119fcef07cf7778d78fcb9cf5c56043b to your computer and use it in GitHub Desktop.
How to circumvent time limit of the screenrecord command
#!/usr/bin/env sh
if [ "$#" -ne 1 ]; then
echo "Usage: adb-record <FILENAME>"
exit -1
fi
RECORDING_FILE=$1
TEMPDIR=`mktemp -d`
adb shell 'rm -rf /sdcard/screenrecord && mkdir /sdcard/screenrecord'
adb shell 'for i in `seq -f %02.0f 40`; do screenrecord /sdcard/screenrecord/$i.mp4; done' &
RECORDING_PID=$!
read -n1 -s -p "Press any key to stop recording..."
kill $RECORDING_PID
cd $TEMPDIR
adb pull /sdcard/screenrecord
for f in screenrecord/*.mp4; do echo "file '$f'" >> inputs.txt; done
ffmpeg -f concat -i inputs.txt -c copy output.mp4
mv output.mp4 $RECORDING_FILE
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment