Thanks to Richard Bradshaw, also known as the @FriendlyTester, who reminded me in a tweet about the Android screen recording feature using an ADB (Android Debug Bridge) command. In one of my last posts, I already wrote about the new QuickTime recording feature for iOS devices running iOS8 in combination with a Mac OS X device running Yosemite.
A couple of posts ago I wrote about an app called ilos that is able to record Android screens as well. However, I totally forgot to mention in that post that Android is already able to record the current screen using an ADB command.
screenrecord command is able to record the display of devices running Android 4.4 (API level 19) and higher. The tool is recording the app interaction to an MPEG-4 file, which can be downloaded from the device using the command
adb pull. This video can then be used as part of your bug report as well.
The following sample will start a recording session of the connected device.
$ adb shell screenrecord /sdcard/NotAbleToLogin.mp4
To stop the screen recording press
Ctrl-C, otherwise the recording will stop automatically after three minutes. However, you can also define a time limit with the paramter
The tool is recording the video in the native display resolution and orientation by default. However, there are some limitations of the screenrecord command that you should know when using it:
- Some Android devices are not able to record the session with their native screen resolution. If you see any kind of problems during the recording session, try to use a lower resolution.
- The tool is not able to record screen orientation during the recording session. When you rotate the device during the session, some parts of the screen will be cut off.
- There is no audio recording support.
The following table is showing the options of the screenrecord command. Note: This table is copied from the developer.android.com page.
|Displays a usage summary.|
|Sets the video size, for example: |
|Sets the video bit rate for the video, in megabits per second. The default value is 4Mbps. You can increase the bit rate to improve video quality or lower it for smaller movie files. The following example sets the recording bit rate to 6Mbps:|
screenrecord --bit-rate 6000000 /sdcard/demo.mp4
|Sets the maximum recording time, in seconds. The default and maximum value is 180 (3 minutes).|
|Rotates the output 90 degrees. This feature is experimental.|
|Displays log information on command line screen. If you do not set this option, the utility does not display any information while running.|
Richard Bradshaw send me a link to his GitHub Gists where he provided a shell script that is able to start, download and delete a recorded video from the Android device. Maybe this can be useful for you guys as well.
BASH script to record Android display and download/delete the video.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|#Check if an argument was supplied|
|if [ -z "$1" ]|
|echo "No argument supplied, please provide video name"|
|# start recording|
|adb shell screenrecord –bit-rate 6000000 /sdcard/$1.mp4 &|
|# Get its PID|
|# Upon a key press|
|read -p "Press [Enter] to stop recording…"|
|# Kills the recording process|
|# Wait for 3 seconds for the device to compile the video|
|# Download the video|
|adb pull /sdcard/$1.mp4|
|# Delete the video from the device|
|adb shell rm /sdcard/$1.mp4|
|# Kill background process incase kill PID fails|
|trap "kill 0" SIGINT SIGTERM EXIT|
Happy recording and testing!