Android Screen Recording using ADB

Android Screenrecord - Adventures in QAThanks 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.

The 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 --time-limit.

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 page.

--helpDisplays a usage summary.
--size <WIDTHxHEIGHT>Sets the video size, for example: 1280x720. The default value is the device’s main display resolution (if supported), 1280×720 if not. For best results, use a size supported by your device’s Advanced Video Coding (AVC) encoder.
--bit-rate <RATE>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
--time-limit <TIME>Sets the maximum recording time, in seconds. The default and maximum value is 180 (3 minutes).
--rotateRotates the output 90 degrees. This feature is experimental.
--verboseDisplays 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
kill $PID
# Wait for 3 seconds for the device to compile the video
sleep 3
# 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

Happy recording and testing!