Skip to content

Instantly share code, notes, and snippets.

@monkeydone
Created February 26, 2019 02:58
Show Gist options
  • Save monkeydone/64f0860dfa13e47c87cd5fb652624dcf to your computer and use it in GitHub Desktop.
Save monkeydone/64f0860dfa13e47c87cd5fb652624dcf to your computer and use it in GitHub Desktop.
android screen to gif file
#/bin/bash
function createGif() {
if [ -e $mp4_name ]; then
rm -rf $mp4_name
fi
echo "record the screen"
adb shell screenrecord $mp4_name --size 1080x1920 --time-limit 10
echo "download the screen file"
adb pull $mp4_name ./d.mp4
echo "convert the screen file to gif file"
ffmpeg -i d.mp4 $gif_name
rm -rf d.mp4
open $gif_name
}
if [ $# == 1 ]; then
gif_name=$1
mp4_name="/sdcard/d.mp4"
echo "create gif file ${gif_name}"
createGif
else
echo "./ a.sh a.gif"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment