195

Forget screenshots, is it posible to capture a video of the running application in android? Rooted or non-rooted, I don't care, I want atleast 15fps.

Update: I don't want any external hardware. The intent is to make it perfectly portable and every frame is captured within Android OS. If it crosses the boundaries of the app sdk, I'm willing to go to OS level modifications but I would need a starting point.

10
  • I completely see what is being said here. It seems like the emulator should have the feature to redirect the current screen into a video file as well. I would love a feature like this so that I could make informative videos of my games and apps. Commented May 27, 2011 at 3:57
  • 1
    Did u got solution for this? if so please share with us. i too have to caputre video of android screen.
    – deepa
    Commented Jul 19, 2011 at 7:59
  • @deepa nope there's no good way of doing this.
    – Taranfx
    Commented Jul 22, 2011 at 0:29
  • Check this project: sourceforge.net/projects/ashot Commented Aug 1, 2011 at 19:27
  • Is it possible to read from the hardware screen buffer ?
    – mP.
    Commented Dec 2, 2011 at 8:55

18 Answers 18

245

Android 4.4 (KitKat) and higher devices have a shell utility for recording the Android device screen. Connect a device in developer/debug mode running KitKat with the adb utility over USB and then type the following:

adb shell screenrecord /sdcard/movie.mp4
(Press Ctrl-C to stop)
adb pull /sdcard/movie.mp4

Screen recording is limited to a maximum of 3 minutes.

Reference: https://developer.android.com/studio/command-line/adb.html#screenrecord

14
  • is giving me response like screenrecord: not found adb is out dated why?
    – Poison
    Commented Jan 29, 2014 at 9:25
  • 1
    Sounds like your Android SDK is out of date. Open up Android SDK Manager and download the latest SDK tools. Commented Jan 30, 2014 at 3:53
  • Is it possible to extend the recording time? Commented Jun 2, 2014 at 3:48
  • 1
    Just to add, this page has a package having a standalone adb + script "ScreenRecord.bat" which can be double clicked to start recording android screen video.. skipser.com/p/2/p/record-screen-video-in-android.html
    – arunskrish
    Commented Jul 23, 2014 at 7:19
  • 1
    I get the error WARNING: linker: libsac3d.so has text relocations. This is wasting memory and is a security risk. Please fix. ERROR: unable to configure codec (err=-2147483648) WARNING: failed at 1080x1920, retrying at 720x1280
    – Pete_ch
    Commented Dec 1, 2014 at 5:18
17

I know this is an old question but since it appears to be unanswered to the OPs liking. There is an app that accopmlishes this in the Android Market Screencast link

6
  • 29
    Worth mentioning that it requires root, btw. Commented Jan 25, 2012 at 10:22
  • Not functional on my HTC One. Worked fine on my Galaxy S II, though.
    – MiloDC
    Commented May 20, 2013 at 20:08
  • 1
    This one does not require root. Seems promising so far...droid-at-screen.ribomation.com/installation
    – Fraggle
    Commented Oct 24, 2013 at 22:27
  • droid-at-screen doesn't do video, @Fraggle. Just screenshots. It can do continuous capture, but at about 1fps. Commented Nov 13, 2013 at 20:29
  • Currently I'm using this sourceforge.net/projects/ashot to just show the screen on my mac, then using my standard tools (SnapPro X) to capture a movie from that part of the screen. Not sure what the frame rate is on ashot, but I think higher than 1 fps.
    – Fraggle
    Commented Nov 14, 2013 at 16:35
8

Yes, use a phone with a video out, and use a video recorder to capture the stream

See this article http://graphics-geek.blogspot.com/2011/02/recording-animations-via-hdmi.html

2
  • That's what I could have done but my requirement is to do everything inside android. Making it work on the go is the intent.
    – Taranfx
    Commented Mar 22, 2011 at 5:20
  • 1
    I think you're out of luck - the requirements to handle that much video encoding, on the fly, on a mobile device, is outside the scope of what most are physically capable of, Android (AFAIK) has no interface to access a stream, and even if it did, it's a potentially enormous security hole as an app could spy on the user.
    – Ollie C
    Commented Mar 22, 2011 at 10:57
4

@taranfx, without more info I'm assuming since you are on StackOverFlow that you have the Android Developer Tools installed. If so you can run the emulator and then use one of the many desktop screen capture programs to capture your running application. Screenflow on the Mac works great for doing this. I am sure there are many good screen capture programs if you are on Windows or a Nix platform and I know there are some online services as well but I do not have any links nor have I used them. Here is a link for the reference document on setting up and running the emulator.The Android SDK includes a mobile device emulator...

3
  • 2
    Sorry? I asked for video capture in Android not on Mac or Emulator.
    – Taranfx
    Commented Mar 22, 2011 at 4:22
  • 2
    MWR is suggesting capture of the Android screen via the emulator
    – Ollie C
    Commented Mar 22, 2011 at 10:56
  • 3
    Not all aps can be run in emulator.
    – RajV
    Commented Jan 31, 2013 at 20:31
4

My suggestion is also to use a screen recorder, such as SMRecorder. Instead of using the emulator, which is slow - especially for games and things you would want a video of, I recommend using a VirtualBox VM, with Android installed. You can connect the Dalvik debugger to it and debug you app there. If the debugger slows down you app too much, disconnect it to record the video. There are many links out there explaining how to set up the Android VM for debugging. I find it far better than the emulator. Now this does not take care of capturing screens directly on the device, in case you app uses the accelerometer, or the camera that are not available on the PC. For that I would use the android market app mentioned above.

1
3

I guess screencast is no go cause of tegra 2 incompatibility, i already tried it,but no whey! So i tried using Z-ScreeNRecorder from market,installed it on my LG Optimus 2x, but it record's only blank screen,i tried for 5min. and there i get 5min. of blank screen file of 6mb size... so there is no point trying until they release some peace of software that is compatible with tegra2 chipset!

2

Android 4.3 has a new MediaCodec API that can be used to record from a surface. See: http://developer.android.com/about/versions/android-4.3.html (scroll down to the section "Video encoding from a Surface")

1

It is possible to record screen video directly from your phone or tablet if your device is rooted. I'm working on the SCR Screen Recorder app. To the best of my knowledge this is the only app supporting Tegra devices (including Nexus 7) and Android 4.2. At the moment the app records between 9-18fps depending on device but I'm working to improve that. SCR Screen Recorder is still in beta testing phase so feel free to test it and give feedback.

2
  • 1
    Share your research how it can be done programmatically in android to capture the viceo of the screen silently?
    – Ajay S
    Commented Sep 8, 2013 at 16:05
  • @Iwo Can you share your research on how to record screen video grammatically? Thank you. Commented Apr 9, 2014 at 18:40
1

AirPlay Mirroring and Screen Recording is now in CyanogenMod with Mirror APK (Beta).

1

If you developing video-camera applications, then it will be good to know the API to use for video capturing:

http://developer.android.com/training/camera/videobasics.html

(the above link only show how the video recording can be done via Intent submission, not how the actual recording is done)

https://www.linux.com/learn/tutorials/729988-android-app-development-how-to-capture-video

and if you want to write the "screenrecord" adb application yourself:

https://android.googlesource.com/platform/frameworks/av/+/android-cts-4.4_r1/cmds/screenrecord/screenrecord.cpp

And the key recording action is done here:

static status_t recordScreen(const char* fileName) {
    status_t err;

<...>

    // Configure, but do not start, muxer.
    sp<MediaMuxer> muxer = new MediaMuxer(fileName,
            MediaMuxer::OUTPUT_FORMAT_MPEG_4);
    if (gRotate) {
        muxer->setOrientationHint(90);
    }

    // Main encoder loop.
    err = runEncoder(encoder, muxer);
    if (err != NO_ERROR) {
        encoder->release();
        encoder.clear();

        return err;
    }

For Samsung phone there is additional settings ('cam_mode' hack):

CamcorderProfile.QUALITY_HIGH resolution produces green flickering video

More useful links:

How can I capture a video recording on Android?

1

I didn't implement it but still i am giving you an idea to do this.

First of all get the code to take a screenshot of Android device. And Call the same function for creating Images after an interval of times. Add then find the code to create video from frames/images.

Edit

see this link also and modify it according to your screen dimension .The main thing is to divide your work into several small tasks and then combine it as your need.

FFMPEG is the best way to do this. but once i have tried but it is a very long procedure. First you have to download cygwin and Native C++ library and lot of stuff and connect then you are able to work on FFMPEG (it is built in C++).

1
  • I did same as you suggested from taking images after an interval of time or without no interval, I have scrolling view in which i am doing scrolling and in another thread i am capturing screen area, but a same capturing is returns for 6-7 images and than another different area is captured. I need complete sequence of images. Commented Sep 19, 2014 at 11:34
1

Take a look at Remote Manager. But seems to me it doesn't work correctly with devices which have big screen. Although, you can try DEMO before.

4
  • Both links are dead :/ Commented Nov 4, 2014 at 6:02
  • @rahulserver, Google blocked them, because I used Android in name of the program. Soon I will publish them again without Android word.
    – Nolesh
    Commented Nov 5, 2014 at 0:27
  • thanks for responding. I'm desperately in need.So pls do notify here once u have published. Commented Nov 5, 2014 at 1:25
  • @rahulserver, I published them again and corrected links.
    – Nolesh
    Commented Nov 30, 2014 at 10:13
1

If you want to record the user navigation so you can test UI and other things, I recommend you to use TestFairy

It allows you to send the apk to some test users by email and see a video with all the sessions in the app and even the app crashes and device stats.

1

In Android Lollipop (5) a new feature has been added which allows screen capture which is explained here

Here is an example

Call startActivityForResult like this

startActivityForResult(mProjectionManager.getScreenCaptureIntent(), PERMISSION_CODE);

Then capture the result

@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
    if (requestCode != PERMISSION_CODE) {
        Log.e(TAG, "Unknown request code: " + requestCode);
        return;
    }
    if (resultCode != RESULT_OK) {
        Toast.makeText(this,
                "User denied screen sharing permission", Toast.LENGTH_SHORT).show();
        return;
    }
    mMediaProjection = mProjectionManager.getMediaProjection(resultCode, data);
    mVirtualDisplay = createVirtualDisplay();
}
0

This is old, but what about ASC?

2
  • Due to incompatibility with Tegra-powered devices? .. yeah.. i got a Asus Transformer :C Commented Apr 28, 2013 at 0:14
  • It requires running an 'activator' on the PC/Mac, but is unsigned and doesn't explain what it does nor how to do the 'activation' manually. It sounds like a security risk and threat vector.
    – Chloe
    Commented Sep 10, 2013 at 21:08
0

If you are on a PC then you can run My Phone Explorer on the PC, the MyPhoneExplorer Client on the phone, set the screen capture to refresh continuously, and use Wink to capture a custom rectangular area of your screen over the My Phone Explorer window with your own capture rate. Then convert to a FLV in Wink, then convert from Flash video to MPG with WinFF.

1
  • It should be added that "PC" here means some sort of Microsoft Windows.
    – rwst
    Commented Nov 30, 2013 at 13:27
0

I have not used the app, but I've seen Rec. referenced as a way to do this, but you need root the phone.

0

11 years later, I can offer a better answer. I can see that people still visit this answer.

scrcpy

It's available in the package manager of Ubuntu 22.04, at least, presumably also in Debian and other distros.

It requires that you have an adb connection. If you are connecting over tcp, you need to do an "adb connect <ip_address>:5555" first.

Not the answer you're looking for? Browse other questions tagged or ask your own question.