Last week on our Android customization series, we dove into a deep and involved developer tool called ADB, or Android Debug Bridge. Our purpose last week was pretty simple, we were trying to hunt down apps that were eating up the battery on our Android devices, and we used logcat to do so.

This week, now that you’ve got ADB up and rolling, let’s keep using it. I have a short list of tasks I want to perform with ADB, but we will start off with the most fun of them all, capturing a screen recording on your Android device.

Before we get started

You do not require any special apps or to have root on your device to follow along today, or for any of our upcoming ADB tasks in the coming weeks. You will, however, need to have a connected computer with ADB setup and ready to roll.

Nexus 9 HP Chromebook USB ADB logcat

You will need to at least follow along our previous project to see how ADB is setup and enabled on your connected computer, and be ready to connect with an appropriate USB cable for your Android device.

Warning: The screen record functionality in ADB is for video only, it does not capture the audio of your device, please be prepared to capture audio separately, if required. The recording is limited to about 3 minutes in length, to help prevent copyright violations, I presume. Screen rotation is not supported, pick an orientation and stick with it for the recording.

Capture a screen recording with ADB

First things first, connect your Android device to your PC. Follow any steps required to enable ADB, fire up your command/Terminal window and get ready to rock.

ADB screenrecord sample

In your command or Terminal window, enter adb devices and hit enter.

As mentioned last week, you do not really need to do this, but it is always nice to see that your device is connected and reporting to your computer properly.

Now, enter adb shell and hit enter.

Shell enables a subset of new tools within ADB, and, in a manner of speaking, provides access to the command line controls of your actual device. If that does not make sense, don’t worry about it, we’ll have the chance to explain in more detail at a later date.

Enter screenrecord /sdcard/video.mp4 and hit enter.

You are now recording your Android device display.

To stop the recording, wait for three minutes to expire, or simply press Ctrl+C into the command/Terminal window.

ADB screenrecord Moto G on Chromebook

The video file is saved to your Android device, and will be located where you specified above, which would be on your /sdcard/ if you entered the exact text above. Feel free to specify a new storage location on your device, and a new file name as well, be careful not to run the command again right away, as it may overwrite your previous video.mp4 file.

What’s next

Our implementation above utilizes the bare bones defaults of the screen record tool. There are additional options available that may be of use to you.

First, the default will record the video at your device’s screen resolution, if supported. If you have issues, try specifying a specific screen resolution. The general format is to add –size WIDTHxHEIGHT to your command. For example, screenrecord –size 1280×720 /sdcard/recordings/my720pvideo.mp4. Consult your manufacturer for supported resolutions on your Android device’s AVC encoder.

You can also control the bit-rate and recording time (up to 3 minutes.) Head on over to the ADB help pages for more details – fair warning, our next few Android customization posts will cover our favorite tools on that ADB page, feel free to jump ahead if you wish. For now, the following image has the few supported screen record options for you.

ADB screenshots command options

Next week

Now that you have a screen recording or two saved to your Android device, you may want to get it off the device and onto your computer. We have talked about file transfers before on our Android customization series, but we’ve got ADB at our disposal now, so let’s use it. Next week, we will use ADB to transfer files to and from your computer and Android device.

What do you use a screen recording for? Work, entertainment, send to a friend to show them a problem you are having?

Jonathan Feist
Android purist and enthusiast, rarely more than arms reach from a stock Nexus 7. Often accused of being a Google fanboy, proud of it. Proponent for Android customization and personalization, if you can change it, make it your own!
Show 13 comments