Capture Video of Android's Screen

AndroidVideo Capture

Android Problem Overview


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.

Android Solutions


Solution 1 - Android

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

Solution 2 - Android

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

Solution 3 - Android

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

Solution 4 - Android

@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...

Solution 5 - Android

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.

Solution 6 - Android

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!

Solution 7 - Android

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")

Solution 8 - Android

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.

Solution 9 - Android

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.

Solution 10 - Android

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

Solution 11 - Android

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):

https://stackoverflow.com/questions/7225571/camcorderprofile-quality-high-resolution-produces-green-flickering-video

More useful links:

https://stackoverflow.com/questions/1817742/how-can-i-capture-a-video-recording-on-android

Solution 12 - Android

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++).

Solution 13 - Android

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.

Solution 14 - Android

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();
}

Solution 15 - Android

This is old, but what about ASC?

Solution 16 - Android

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.

Solution 17 - Android

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionTaranfxView Question on Stackoverflow
Solution 1 - AndroidJoe FernandezView Answer on Stackoverflow
Solution 2 - AndroidZaphoidView Answer on Stackoverflow
Solution 3 - AndroidOllie CView Answer on Stackoverflow
Solution 4 - AndroidMWRView Answer on Stackoverflow
Solution 5 - AndroidjdbertronView Answer on Stackoverflow
Solution 6 - AndroidNenadView Answer on Stackoverflow
Solution 7 - AndroidAOSP_junkieView Answer on Stackoverflow
Solution 8 - AndroidIwo BanasView Answer on Stackoverflow
Solution 9 - AndroidNoleshView Answer on Stackoverflow
Solution 10 - AndroidOliView Answer on Stackoverflow
Solution 11 - AndroidPeter TeohView Answer on Stackoverflow
Solution 12 - AndroidZar E AhmerView Answer on Stackoverflow
Solution 13 - Androidred_alertView Answer on Stackoverflow
Solution 14 - AndroidrogermushroomView Answer on Stackoverflow
Solution 15 - AndroidRichard CotrinaView Answer on Stackoverflow
Solution 16 - AndroidChloeView Answer on Stackoverflow
Solution 17 - AndroidRich ElswickView Answer on Stackoverflow