Tasker screenrecord taskSince Android 4.4 (API level 19) was released, we’ve been able to record video with a built-in screen record command.

Usually this is done via ADB due to the raised permissions, although you can do this with Superuser/root access, or by saving the data into an accessible folder.

The command one executes in a shell script can be found on the Android Developer’s Website. The quick and dirty layout of the screenrecord command is:

  • screenrecord <options> filename

For our example here, open up a terminal emulator and enter the command below. We’re going to record for 20 seconds to a file on the SD card called test.mp4.

screenrecord –time-limit 20 /sdcard/test.mp4

At the end of twenty seconds, you should have a file in your SD card called test.mp4 that should have about 20 seconds of video. You can navigate to t via ES file explorer or whatever file manager you have and verify that it’s there.

If the file is zero bytes after recording, you’re probably going to need to run with Superuser access. If you don’t have root, you can probably change the path to save the video to a folder you have write access to in terminal. As I don’t know what your particular manufacturer might have set up for write permissions on your ROM, you’ll have to guess at it.

Usually apps can write to their own directories, so if you’re running in terminal you may be able to save to something like /data/data/com.terminal/ (something), or you may not have the new hurdles introduced in 4.4.? with the media group restrictions.

For the ADB crowd, the command would be ADB shell screenrecord –time-limit 20 /sdcard/test.mp4. ADB doesn’t seem to have the issues with requiring superuser or being in the media access group on my device, so if you’re fine with tethered this may work best for you.

If you don’t specify a time limit, you’ll be recording for three minutes before screenrecord finally stops. If you’re on an HTC device, you’ll get an error message about a security problem, but it won’t interfere with your recording.

On ADB or Terminal Emulator, you can end screen recording at any time by pressing ctrl-c or closing the emulator window. I have not found a good way yet to do this in Tasker. If you do, feel free to drop a note.

In Tasker, create a task, run shell (the command is the screenrecord command above), check use Root if you’re able to or have issues saving the media. With Tasker, you can also create a widget shortcuts to the task on your home screen making it really easy to tap a button and record a couple of minutes of video.

Important to note that on my device at least I do not see the video in the folder with a Windows machine until I disconnect and reconnect the device. Applications such as ES File Explorer seem to refresh the directory properly when requested to do so, so I think it’s either my machine or Windows 7 dealing with MTP devices in general.