Thursday, January 01, 2015

Android Screeen Recording

While I was trying to access my broken Nexus 5, I managed to get keyboard/mouse/touch access via the debug bridge (adb), but from time to time I had serious problems actually reading certain parts of the the screen (broken display!).

So I checked if and how I can do screen recordings, and found that it works really easy. At least starting with KitKat.

Fully documented on the official adb pages.

Of course you need USB debug access to your phone, but you do not need root access (!).

So all you need is a terminal/shell and then you can do start screenrecord.

Like:

adb shell screenrecord /sdcard/test.mp4
and stop it with Ctrl-C

and then get the file to your PC with
adb pull /sdcard/test.mp4
and remove it on the device with
adb shell rm /sdcard/test.mp4.


And this is the video, showing at first nothing (display off), then I switched the device on and then I swiped up to unlock:




There are some useful options available:
OptionsDescription
--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), 1280x720 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.
If especially like the --time-limit for short recordings.