Record Screen on Simulator/Emulator and create gif from recorded files

Sometimes, we want to share there are some problem on the app, and we can record a video from device, but the video files are usually too…

Record Screen on Simulator/Emulator and create gif from recorded files

Sometimes, we want to share there are some problem on the app, and we can record a video from device, but the video files are usually too large, if we can change the video to gif files it might be better.

There was a tool ffmpeg , this file is good to transfer files to different types, for example, we can use it to convert webm to mp4 , and can reduce file size change video or audio rates.

Record Screen on Emulator

iOS Simulator

On the iOS simulator, we can use the menu item File/Record Screen or with short key: ⌘ + R .

Android Emulator

To record video from Android Emulator, we can open the logcat view on the Android Studio, and there is a button titled Screen Record, show as the picture below.

Screen Record button on Logcat

Click the button above, it will show a dialog let us change the settings of the video to record.

Convert mp4 files to gif with ffmpeg

Before start, we need install the ffmpeg tool on the machine, after install the ffmpeg, we can use the following command to convert mp4 file to gif file.

For example, I have two mp4 files on my desktop like below:.
├── [3.3M]  android.mp4
└── [ 13M]  ios.mp4

To convert the gif files, we can use the following command:ffmpeg -y -i ios.mp4 -r 4 -vf scale=320:-1 ios.gif
ffmpeg -y -i android.mp4 -r 4 -vf scale=320:-1 android.gif

After converted, the gif file size are like below:.
├── [439K]  android.gif
└── [650K]  ios.gif