29

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 -

enter image description here

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
RoCkDevstack
  • 3,517
  • 7
  • 34
  • 56

4 Answers4

43

First record video from AndroidStudio Select "Screen Record" enter image description here

and save .mp4 video then go to any online tools to convert mp4 to gif

for example http://ezgif.com and https://cloudconvert.com

Sally
  • 950
  • 9
  • 15
  • 1
    This was been answered already in my new post, but many thanks again Sally . :) – RoCkDevstack Feb 14 '16 at 16:48
  • 1
    you are welcome :) , i did not see your new post. i was search for direct way to capture GIF but can't find one, i shared what i do may be that help. – Sally Feb 14 '16 at 17:21
  • 2
    Thanks for this info. However "Screen Record" is disabled at my end. Any clue why it could be? – Atul Jun 19 '17 at 02:18
22

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.

Dan Dascalescu
  • 143,271
  • 52
  • 317
  • 404
  • As most of us have telephone with 16:9 display ratio and would wanna take video in portrait mode, I suggest: `--size 648x1152`. – Velda May 22 '19 at 17:01
22

I found the easiest way (you have to update latest android studio & android monitory)

  • Click... option to open More Setting on Android Monitor
  • Select Screen Record option on left
  • Click START RECORDING Button to record video
  • Click STOP RECORDING Button to stop recording
  • Change WEBM format to GIF and save it
  • Enjoy...

enter image description here Watch video tutorial on YouTube

duyuanchao
  • 3,863
  • 1
  • 25
  • 16
  • This answer is what I do as well. The only thing I would add to that answer is enabling show touches on the device as well: https://medium.theuxblog.com/enabling-show-touches-in-android-screen-recordings-for-user-research-cc968563fcb9 I've also found that I like using giphy capture: https://giphy.com/apps/giphycapture – TJ Olsen Oct 11 '19 at 02:13
2

The Android Monitor mentioned in the answer is deprecated in the new Android Studio 3.0.

According to the Documentation you can record a short video of your app like this:

  1. Open an app project.
  2. Run the app on a hardware device.
  3. Click View > Tool Windows > Logcat.
  4. Interact with the display on the hardware device to stage the start of the video.
  5. Click Screen Record in the left side of the Logcat window.
  6. In the Screen Recorder Options dialog, set the recording options:
    • Bit Rate: Enter a bit rate. The default is 4 Mbps.
    • Resolution: Enter a width and height value in pixels. The value must be a multiple of 16. The default is the resolution of the device.
    • Show Taps: Enables visual feedback for taps.
  7. Click Start Recording to start the recording.
  8. Click Stop Recording to stop the recording.
  9. In the Save As dialog, save the MP4 file.
  10. In the Screen Recorder dialog, click one of the buttons to show the file location, open the recording in a player, or dismiss the dialog.

Now you can use http://ezgif.com or https://cloudconvert.com to convert the mp4 to an gif-file like Sally already mentioned.