A small utility to record Android device screen to a GIF

Related tags

Utility RoboGif
Overview

RoboGif

A small utility to record Android device screen to an optimized GIF so you can paste it to GitHub or a similar service.

Requirements

  • Python 2.7 or 3.x
  • adb in path
  • ffmpeg in path (has to be decently new to support palettegen and paletteuse filters and have libx264 if you want video output)

Optional

  • gifsicle for further gif optimization

Getting ffmpeg

OS X
brew install ffmpeg
Linux

On Ubuntu 15.04 or equivalent, you can just use apt:

apt-get install ffmpeg

On Ubuntu 14.04 you can use Ubuntu Multimedia for Trusty PPA to get new ffmpeg.

Windows

Windows support was not tested as of yet. Zeranoe's static builds should work fine as long as they're named ffmpeg.exe in path.

Installation

pip install robogif

Usage

To record a gif:

robogif demo.gif

RoboGif Recorder v1.1.2
Starting recording on <serial>...
Press Ctrl+C to stop recording.
Recording done, downloading file....
5679 KB/s (7036946 bytes in 1.209s)
Converting video to GIF...
Done!
Created demo.gif

Example of a recorded GIF:

GIF example

or to record a video:

robogif demo.mp4

RoboGif Recorder v1.1.2
Starting recording on 061ffcff0b107aef...
Press Ctrl+C to stop recording.
Recording done, downloading file....
7121 KB/s (1048401 bytes in 0.143s)
Optimizing video...
Done!
Created demo.mp4

Connecting devices

robogif requires adb for accessing Android devices. Before recording a GIF or video, you need to connect the target device to your computer using a USB cable. The device must have "USB debugging" enabled. You can check if the device is properly connected by running adb device from your terminal. If your device shows up, you are ready to go.

> adb devices -l
List of devices attached
CVH7N25B12003553       device usb:346594891X product:angler model:Nexus_6P device:angler
Comments
  • ERROR: unable to create encoder input surface (err=-38)

    ERROR: unable to create encoder input surface (err=-38)

    I got this on the android 4.4.2 (API 19) emulator. Can you please let me know if I did anything wrong?

    ADB Recorder v0.1
    Starting recording on device...
    Press Ctrl+C to stop recording.
    ERROR: unable to create encoder input surface (err=-38)
    Traceback (most recent call last):
      File "record.py", line 53, in <module>
        recorder.send_signal(signal.SIGTERM)
      File "/usr/lib/python2.7/subprocess.py", line 1554, in send_signal
        os.kill(self.pid, sig)
    OSError: [Errno 3] No such process
    
    wontfix 
    opened by roycezhc 2
  • err....

    err....

    RoboGif Recorder v1.1.2
    Starting recording on LGH345769dc0a0...
    Press Ctrl+C to stop recording.
    ^CRecording done, downloading file....
    * daemon not running. starting it now on port 5037 *
    * daemon started successfully *
    error: device offline
    Could not download recording from the device.
    Traceback (most recent call last):
      File "/usr/local/bin/robogif", line 9, in <module>
        load_entry_point('robogif==1.1.2', 'console_scripts', 'robogif')()
      File "/usr/local/lib/python2.7/site-packages/click/core.py", line 664, in __call__
        return self.main(*args, **kwargs)
      File "/usr/local/lib/python2.7/site-packages/click/core.py", line 644, in main
        rv = self.invoke(ctx)
      File "/usr/local/lib/python2.7/site-packages/click/core.py", line 837, in invoke
        return ctx.invoke(self.callback, **ctx.params)
      File "/usr/local/lib/python2.7/site-packages/click/core.py", line 464, in invoke
        return callback(*args, **kwargs)
      File "/usr/local/lib/python2.7/site-packages/robogif/recorder.py", line 203, in run
        os.remove(tmp_video_file)
    OSError: [Errno 2] No such file or directory: '/var/folders/_d/zmg1cc01779c3fs35hcdd8sw0000gn/T/sn7JdL.mp4'
    
    opened by sirvon 1
  • Add possibility to change quality parameters

    Add possibility to change quality parameters

    It would be very useful to minimize size of the output file and allow to configure output image size and count of frames. Now, util creates 5-15Mb images, I think it's too much.

    PS: Thank you for this project.

    opened by vbauer 1
  • Improve documentation

    Improve documentation

    Hi,

    your project seems very interesting but the way you connect your Android device to the computer that is running RoboGif is somewhat obscure (at least for me). Could you please improve the documentation?

    Cheers.

    P.

    opened by pierrepo 0
  • Fix: Unhandled error if model name not available.

    Fix: Unhandled error if model name not available.

    Some devices seem to not report their model name (e.g. my Nexus S / 4.0.4), so generating the list of connected devices fails with a KeyError. I've added a fallback that simply displays (unknown) for the model name, if model key is missing inside the device dictionary.

    opened by davidschreiber 0
  • Option for showing touches and swipes

    Option for showing touches and swipes

    First and above all, thanks a lot for your code. It is really useful.

    There is a use case where I can't use it, when I need to show the user iteraction. Would you please consider adding a "touch" option like the one Android Studio has when recording videos?

    opened by msesma 0
  • encounter problem in android os > 4.4( on windows)

    encounter problem in android os > 4.4( on windows)

    ENV: window8.1 + python2.7.12 +cygwin64 + adb1.0.39 +ffmpeg3.3.1

    Edward@USER-Edward /cygdrive/c/Users/Edward/Desktop
    $ robogif demo.gif
    RoboGif Recorder v1.3.0
    Multiple devices found, choose one:
    ===============
    [0] FX08_plus - Baytrail26AB2111 ------> android4.4.4(rooted)
    [1] FX08 - 0123456789ABCDEF --------> android4.4.4(no root)
    [2] Nexus_6P - CVH7N15B13000286 --------> android7.1.2(no root)
    ===============
     Choose[0-2]0
    
    Starting recording on Baytrail26AB2111...
    Press Ctrl+C to stop recording.
    Unable to get output buffers (err=-38)
    Recording has failed, it's possible that your device does not support recording.
    Recording is supported on devices running KitKat (4.4) or newer.
    Genymotion and stock emulator do not support it.
    
    
    Choose[0-2]1
    
    Starting recording on 0123456789ABCDEF...                                             
    Press Ctrl+C to stop recording.                                                       
    Recording done, downloading file....                                                  
    adb: error: cannot create file/directory '/tmp/5h1Lut.mp4': No such file or directory 
    Could not download recording from the device.                                         
    Traceback (most recent call last):                                                    
      File "/usr/bin/robogif", line 11, in <module>                                       
        sys.exit(run())                                                                   
      File "/usr/lib/python2.7/site-packages/click/core.py", line 664, in __call__        
        return self.main(*args, **kwargs)                                                 
      File "/usr/lib/python2.7/site-packages/click/core.py", line 644, in main            
        rv = self.invoke(ctx)                                                             
      File "/usr/lib/python2.7/site-packages/click/core.py", line 837, in invoke          
        return ctx.invoke(self.callback, **ctx.params)                                    
      File "/usr/lib/python2.7/site-packages/click/core.py", line 464, in invoke          
        return callback(*args, **kwargs)                                                  
      File "/usr/lib/python2.7/site-packages/robogif/recorder.py", line 243, in run       
        os.remove(tmp_video_file)                                                         
    OSError: [Errno 2] No such file or directory: '/tmp/5h1Lut.mp4'                       
    
    
    Choose[0-2]2
    
    Starting recording on CVH7N15B13000286...                                                
    Press Ctrl+C to stop recording.                                                          
    Recording done, downloading file....                                                     
    adb: error: cannot create file/directory '/tmp/M2Fjvz.mp4': No such file or directory    
    Could not download recording from the device.                                            
    Traceback (most recent call last):                                                       
      File "/usr/bin/robogif", line 11, in <module>                                          
        sys.exit(run())                                                                      
      File "/usr/lib/python2.7/site-packages/click/core.py", line 664, in __call__           
        return self.main(*args, **kwargs)                                                    
      File "/usr/lib/python2.7/site-packages/click/core.py", line 644, in main               
        rv = self.invoke(ctx)                                                                
      File "/usr/lib/python2.7/site-packages/click/core.py", line 837, in invoke             
        return ctx.invoke(self.callback, **ctx.params)                                       
      File "/usr/lib/python2.7/site-packages/click/core.py", line 464, in invoke             
        return callback(*args, **kwargs)                                                     
      File "/usr/lib/python2.7/site-packages/robogif/recorder.py", line 243, in run          
        os.remove(tmp_video_file)                                                            
    OSError: [Errno 2] No such file or directory: '/tmp/M2Fjvz.mp4'                          
    
    
    
    opened by zhEdward 0
  • Add support for lossygif

    Add support for lossygif

    There's a forked version of gifsicle called lossygif (https://kornel.ski/lossygif) that allows for reducing GIF file sizes even more than using the original gifsicle optimizations.

    gifsicle --lossy=20 -O3 -o out.gif in.gif
    

    Robogif could use lossygif to even further crunch down sizes of generated GIFs. A very convenient feature would be a --max-filesize option, that would tell robogif to continuously increase lossyness, trying get the final file size below that option value. This option can come in handy when a file size restriction is given (e.g. when adding GIF files to GitHub issues).

    robogif --max-filesize=10M out.gif
    
    opened by davidschreiber 0
Owner
Jernej Virag
Jernej Virag
A collection of small utility functions to make it easier to deal with some otherwise nullable APIs on Android.

requireKTX is a collection of small utility functions to make it easier to deal with some otherwise nullable APIs on Android, using the same idea as requireContext, requireArguments, and other similar Android SDK methods.

Márton Braun 82 Oct 1, 2022
Small utility used to add Homewizard Energy Socket tiles to Android Quick Settings

TileWizard [Alpha! Unstable!] Settings Result Functionality: Add up to 5 Wi-Fi Energy Sockets to Android Quick Settings. What do you need: Android dev

Niels Masdorp 2 Oct 19, 2021
Small utility to create/restore encrypted backups

Quick Backup Choose some files and quickly create a complete encrypted and compressed file. Usage Clone the repository Run gradlew installShadowDist T

Leonardo Colman 5 Sep 18, 2021
Small command-line utility to safely merge multiple WhatsApp backups (msgstore.db) into one.

whatsapp-database-merger A small command-line utility that can be used to merge multiple WhatsApp databases (msgstore.db) into one. A few notes: input

Mattia Iavarone 31 Dec 27, 2022
Criminal-Intent - An android app used to record office crimes

What is Criminal Intent? CriminalIntent records the details of “office crimes” –

Mohammad Rashid 1 Feb 11, 2022
A dual screen capable home screen launcher for Android phones with dual displays, such as the LG V60, G8X & Velvet.

Duality-Launcher A dual screen capable home screen launcher for Android phones with dual displays, such as the LG V60, G8X & Velvet

Russ Nash 6 Sep 8, 2022
Screen Capture Utils - A plugin to handle screen capture events on android and ios

Screen Capture Utils A plugin to handle screen capture events on android and ios ?? Initialize SDK late ScreenCaptureUtils screenCaptureUtils;

Chiziaruhoma Ogbonda 41 Apr 12, 2022
Utility for detecting and notifying when your Android app goes background / becomes foreground

Foredroid Utility for detecting and notifying when your Android app goes background / becomes foreground. API-level 14+. Usage: Initialise Foreground

Steve Liles 151 Nov 29, 2022
Utility tool to make you a computer ninja.

Cmd Window Never spend 6 minutes doing something by hand when you can spend 6 hours failing to automate it - Zhuowej Zhang What is this about? This to

Marcin Radoszewski 3 Feb 1, 2022
FractalUtils - A collection of utility functions and classes, with an emphasis on game related utilities

A collection of utility functions and classes written in Kotlin. There is some emphasis on utilities useful for games (Geometry, Random, Time, Updating, etc).

null 2 Nov 11, 2022
A command line utility to help you investigate the sensitive data associated with Macie findings.

Macie Finding Data Reveal This project contains a command line utility to help you investigate the sensitive data associated with Macie findings.

AWS Samples 8 Nov 16, 2022
Utility library that utilizes KSP to generate Room type converter classes.

Roomie Roomie is an annotation processing library that utilizes KSP to geaRoomie is an annotation processing library that utilizes KSP to generate TypeConverter classes for Room. TypeConverter classes most often involve same boiler-plate code and Roomie makes it really easy to quickly create them with a single annotation.nerate TypeConverter classes for Room. TypeConverter classes most often invol

Chukwuka Eze 12 Aug 26, 2022
CHAOS - Like a utility knife for discord

CHAOS - Like a utility knife for discord. Currently under development. If you feel inclined, please support me by contributing to this project. Or alt

caffeine.moe 20 Nov 13, 2022
Obsi-bot: the next generation discord utility bot 🔥

obsi-bot obsi-bot is the next generation discord utility bot. It is developed in Kotlin using kordex and kord Help me translating Feel free to help me

mooziii 2 Nov 7, 2022
Use Android as Rubber Ducky against another Android device

Use Android as Rubber Ducky against another Android device

null 1.4k Jan 9, 2023
:iphone: [Android Library] Get device information in a super easy way.

EasyDeviceInfo Android library to get device information in a super easy way. The library is built for simplicity and approachability. It not only eli

Nishant Srivastava 1.7k Dec 22, 2022
Android device shake detection.

Seismic Android device shake detection. Download Download the latest .jar or depend via Maven: <dependency> <groupId>com.squareup</groupId> <artif

Square 1.2k Dec 27, 2022
An Android library allowing images to exhibit a parallax effect that reacts to the device's tilt

Motion An Android library allowing images to exhibit a parallax effect. By replacing static pictures and backgrounds with a fluid images that reacts t

Nathan VanBenschoten 781 Nov 11, 2022
Android library for checking the internet connectivity of a device.

ConnectionChecker Android library for checking the internet connectivity of a device. Used in https://play.google.com/store/apps/details?id=com.muddas

Muddassir Ahmed Khan 34 Dec 24, 2022