Android 下如何录制App操作生成Gif动态图

 

需求

统计结果1

Android App开发完了,自然希望录个gif做个展示。视频也可以做展示,但是需要上传到优酷、土豆等等,而且本来就十几秒的App演示操作过程,视频网站的广告就要一分钟(吐槽一些),没有gif轻量简单省流量。

上图是我录制的一个短信轰炸机应用,可以查看这篇文章《Android 短信轰炸机App 开发记录》http://blog.csdn.net/never_cxb/article/details/47614247

本文教大家如何录制gif,本文链接 http://blog.csdn.net/never_cxb/article/details/50515216,转载请注明出处。

思路

生成gif的思路是两步

  1. 把App操作过程录制成视频

  2. 根据视频转换成Gif

目前网上录制GIf的思路也基本都是分为这2步,不知道有没有更好的方法,一步就生成gif动态的?欢迎留言补充

利用adb 录制屏幕

在Android sdk下面有一些很有用的工具,adb位于platform-tools文件夹,开发者用它在设备上安装启动应用。早期的sdk版本中,adb位于tools文件夹中。

在终端(linux或者mac os)或者命令提示符(windows)键入

adb help all
  • 1

可以列出所有可用的命令。

注意,如果经常使用adb工具,建立把sdk的文件夹路径添加到PATH环境变量中。不加入到环境变量中,每次启动adb都需要cd到platform-tools文件夹的位置。

我们录制屏幕利用 adb shell screenrecord命令,还可以使用adb shell screenshot进行截屏。下面是使用说明

tomchen$ ./adb shell screenrecord --helpUsage: screenrecord [options] <filename>Records the device's display to a .mp4 file.Options:--size WIDTHxHEIGHT    Set the video size, e.g. "1280x720".  Default isthe device's main    display resolution (if supported), 1280x720 ifnot.  For best results,    use a size supported bythe AVC encoder.--bit-rate RATE    Set the video bit rate, in megabits per second.  Default 4Mbps.--time-limit TIME    Set the maximum recording timein seconds.  Default / maximum is180.--rotate    Rotate the output 90 degrees.--verbose    Display interesting information on stdout.--help    Show this message.Recording continues until Ctrl-C is hit orthetime limit is reached.tomchen$ pwd/Applications/sdk/platform-tools
    关键字:
50000+
5万行代码练就真实本领
17年
创办于2008年老牌培训机构
1000+
合作企业
98%
就业率

联系我们

电话咨询

0532-85025005

扫码添加微信