Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to increase time limit of ADB screen record of Android Kitkat

Tags:

android

I was using screen record functionality of ADB to record video of my application. It is very convenient and useful. Only issue I found is maximum time limit of 3 minutes (180 seconds).

Is there any way or workaround or way by which we can increase this time limit?

like image 295
silwar Avatar asked Feb 21 '14 15:02

silwar


People also ask

Is there a time limit for screen recording Android?

Key features include: There's no time limit on recordings, so record as long as you want. Record as many videos as you want. You can record audio narration to go along with your screen recording.

How do I change screen record settings on Android?

Open Quick Settings: The Screen Recorder tool is located in the Quick Settings menu. To open this menu, swipe down from the top of your screen. Tap the Screen Recorder icon: Your Quick Settings tab contains a grid of settings that you can adjust with a tap of a button.

Does screen recording have a time limit?

There is no limit on screen recording, other than how much space is available on your drive. Did the device ever go to sleep while recording?


2 Answers

#!/bin/bash 

Function to keep stream going after 3mins

screenStream() {
while true
do
adb exec-out screenrecord --output-format=h264 --size 1024x768 - 
done
}

Unique file name variable

SecondString=$(date +%s)

Display to screen

screenStream | ffplay -framerate 30 -framedrop -bufsize 16M -

Save to file

screenStream | ffmpeg -i - -s 1024x768 -framerate 30 -bufsize 16M $SecondString.mp4

#Ctrl+C to exit.

like image 98
MShaffer Avatar answered Sep 19 '22 20:09

MShaffer


Here's how I solved it. Make sure you backup screenrecorder some place before you go messing with it. I know that the max time is 180 seconds, and is stored in a 32-bit integer. In hex, this would be B4 00 00 00. So I loaded up screenrecorder into ghex, (my hex editor), and searched for B4 00 00 00. There were only a few candidates. On the 6th try, I found the location where the constant was stored. In my version it was at offset 0001B008. I changed the B4 to D4, which is 212 decimal, and screenrecorder ran for 3 min 32 sec. So then I changed it to 10 02 00 00, which would be 210 hex, which is 528 dec, and it ran for 8 min 48 sec. So I changed it to 10 00 01 00, which would be 10010 hex, which is 65552, and it ran... well, it's still running.

I didn't want to mess with recompiling my OS, I just wanted to change this one constant in the screenrecorder program. So I did. You have to have root permissions to overwrite the screenrecorder, and I had to remount my system folder because it was mounted as read-only. I did that with the command: mount -o rw,remount /system

It would have been awesome if the developers had written screenrecorder to default to 180 seconds, but allowed you to set whatever max timeout you wanted. It's an open source project. I should probably figure out how to submit a patch.

Cheers

like image 28
wxWhatsHisName Avatar answered Sep 23 '22 20:09

wxWhatsHisName