Record/Capture Android App Behavior - Convert To Animated GIF

前端 未结 6 1606
春和景丽
春和景丽 2020-12-28 14:58

I would like to capture/record the behavior of my Android app, running on an emulator and make a GIF image out it. Just like this one -

6条回答
  •  借酒劲吻你
    2020-12-28 15:25

    You can record a video from your emulator or real device using the standard ADB tool:

    adb shell screenrecord /sdcard/foo.mp4
    

    To convert the video from MP4 to animated GIF, use ffmpeg (again, a standard, open-source tool):

     ffmpeg -i foo.mp4 foo.gif
    

    Some refinements

    Given that phones nowadays have huge resolutions, a 10-second GIF can easily exceed several megabytes in size. To avoid that, record at a lower resolution by passing a --size XXXxYYY argument to screenrecord:

    adb shell screenrecord --size 1024x768 /sdcard/compact.mp4
    

    If you need to install ADB on Linux, just run sudo apt install adb.

    If you want to trim the beginning or the end of the video, pass the following arguments to ffmpeg:

    • -ss 00:00:05 - where to start (e.g. 5 seconds into the video)
    • -t 00:00:10 - total duration (e.g. 10 seconds)

    No need for video editors or to upload your possibly confidential screencast online.

提交回复
热议问题