美文网首页Android经验分享
Android操作生成gif图

Android操作生成gif图

作者: 没头脑和挺高兴 | 来源:发表于2019-02-26 10:44 被阅读0次

目标

  • 在Android手机上进行操作
  • 最终生成操作的gif图

限制

  • 需要用命令行

方案

  • adb shell screenrecord /sdcard/demo.mp4 --size 1080x1920 --time-limit 10
  • adb pull /sdcard/demo.mp4 .
  • ffmpeg -i demo.mp4 small.gif

安装

  • brew install ffmpeg

脚本

脚本地址

#/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


参考

相关文章

网友评论

    本文标题:Android操作生成gif图

    本文链接:https://www.haomeiwen.com/subject/jvooyqtx.html