[Feature][ROM][4.4] Screen Recorder w/ Audio

Search This thread

0xD34D

Senior Member
Feb 7, 2009
460
2,041
San Diego
As most of you probably already know, Android 4.4 comes with a binary that allows you to record the display. It's nice to have this feature available but it's not the most convenient method to use. It would be a whole lot nicer if it were exposed to the user through the framework. I did just that and am here today to share it with the masses. I took the original screenrecord code and turned it into a native library with JNI bindings to allow using it in Java.

I've added hooks into PhoneWindowManager which allows the user to press power + volume up start/stop screen recording. Once recording is started there is an ongoing notification that can be pressed to stop recording as well. For those that don't have volume rockers or don't like pressing those two buttons together, I have a couple commits for you to pick which will add an option to the global actions menu that is displayed when you hold down the power button.

Now for the stuff you'll need to get this up and running in your own ROM.

For the core functionality you'll need one commit from frameworks/base and one from Settings as well as the ScreenRecorder app which contains the service that does the majority of the work.
frameworks/base
9a994be91c0cd262b7a28d19e8c2beaa48ba2bd9
Settings
671e2b98bd835e799003a3d13949e407f189b1a1
Screen Recorder app
https://github.com/ChameleonOS/android_packages_apps_ScreenRecorder

To get these built into your ROM you will need to add a couple products to PRODUCT_PACKAGES, you can decide where you want to add this.
Code:
# Screen recorder
PRODUCT_PACKAGES += \
    ScreenRecorder \
    libscreenrecorder

If you want to add the option to the global actions menu, here are the two commits you will need.
frameworks/base
10cb81031549d33f2103fe5bc15d883c9aee50c9
Settings
a72dc8451cd21e133f9235297cb114ef2fc3d503

NEW - Audio recording
I currently have 3 patches up for code review on github which add audio recording via the microphone. One for frameworks/base, one for Settings, and one for ScreenRecorder app. For those interested in trying out audio recording here are the links to the patches:
frameworks/base
f109bce6102931719e7baf778005da8748fa8d6b
Settings
64299a3556307354c6b4448cdcb8350d7ff2815b
ScreenRecorder
10866dcd8fc161cca55e6b3bc0470722722a2dc9
And if you want to test it out in the screenrecord binary, you can check out this patch.

And now I leave you with a couple of screenshots and a short video that was taken using this feature.

ige6arrfY6WIY.png
igCjGVyxZ2RFY.png

ibb2CbfkChUxSM.png



And a video showing off audio recording!
Note: I have no interest in working on back porting this to older versions of Android. If you want to give it a shot, knock yourself out but please don't reply to this thread or in PM about how to do it or how to overcome any obstacles you may face.
 
Last edited:

Gokh

Senior Member
Jan 14, 2012
769
167
Very nice! Is it possible to have an Xposed mod ?

Envoyé de mon Nexus 4 en utilisant Tapatalk
 

daavvis

Senior Member
Feb 19, 2012
962
2,120
Nice work man I'm gonna try to port this to mokee :)

Sent from my One using XDA Premium 4 mobile app
 

jitendragarg

Senior Member
Oct 9, 2011
238
59
Wow, this is extremely useful. It can be extremely useful. Does it also record audio from mic along with screen's data?
 

Top Liked Posts

  • There are no posts matching your filters.
  • 100
    As most of you probably already know, Android 4.4 comes with a binary that allows you to record the display. It's nice to have this feature available but it's not the most convenient method to use. It would be a whole lot nicer if it were exposed to the user through the framework. I did just that and am here today to share it with the masses. I took the original screenrecord code and turned it into a native library with JNI bindings to allow using it in Java.

    I've added hooks into PhoneWindowManager which allows the user to press power + volume up start/stop screen recording. Once recording is started there is an ongoing notification that can be pressed to stop recording as well. For those that don't have volume rockers or don't like pressing those two buttons together, I have a couple commits for you to pick which will add an option to the global actions menu that is displayed when you hold down the power button.

    Now for the stuff you'll need to get this up and running in your own ROM.

    For the core functionality you'll need one commit from frameworks/base and one from Settings as well as the ScreenRecorder app which contains the service that does the majority of the work.
    frameworks/base
    9a994be91c0cd262b7a28d19e8c2beaa48ba2bd9
    Settings
    671e2b98bd835e799003a3d13949e407f189b1a1
    Screen Recorder app
    https://github.com/ChameleonOS/android_packages_apps_ScreenRecorder

    To get these built into your ROM you will need to add a couple products to PRODUCT_PACKAGES, you can decide where you want to add this.
    Code:
    # Screen recorder
    PRODUCT_PACKAGES += \
        ScreenRecorder \
        libscreenrecorder

    If you want to add the option to the global actions menu, here are the two commits you will need.
    frameworks/base
    10cb81031549d33f2103fe5bc15d883c9aee50c9
    Settings
    a72dc8451cd21e133f9235297cb114ef2fc3d503

    NEW - Audio recording
    I currently have 3 patches up for code review on github which add audio recording via the microphone. One for frameworks/base, one for Settings, and one for ScreenRecorder app. For those interested in trying out audio recording here are the links to the patches:
    frameworks/base
    f109bce6102931719e7baf778005da8748fa8d6b
    Settings
    64299a3556307354c6b4448cdcb8350d7ff2815b
    ScreenRecorder
    10866dcd8fc161cca55e6b3bc0470722722a2dc9
    And if you want to test it out in the screenrecord binary, you can check out this patch.

    And now I leave you with a couple of screenshots and a short video that was taken using this feature.

    ige6arrfY6WIY.png
    igCjGVyxZ2RFY.png

    ibb2CbfkChUxSM.png



    And a video showing off audio recording!
    Note: I have no interest in working on back porting this to older versions of Android. If you want to give it a shot, knock yourself out but please don't reply to this thread or in PM about how to do it or how to overcome any obstacles you may face.
    5
    Is there a way we can have this on 4.2 or 4.3 devices?

    No





    No

    Seems that both of you cant read the OP. Have a look at the red text!


    Gesendet von meinem Nexus 5 mit Tapatalk
    3
    This is doupe. Lol
    Is this open source so I can added to my ROM?

    That's why I posted it here. I provided the links to the various commits you would want to cherry pick plus the ScreenRecorder app which is open source as well. If you are working on a 4.4 based ROM, then feel free to incorporate it.
    3
    Nice work here. Would it be possible to also integrate audio recording via the mic?

    It is indeed possible and I have added it into the screenrecord binary for testing at the moment. I spent the last couple nights getting the audio stuff integrated and muxed in with the video being recorded and so far it is working well on the Nexus 4. If others want to give it a test run and let me know how it works that would be great. The patch is currently available at http://review.chameleonos.org/#/c/2745/

    And here's a little demo of the recording with the audio option enabled.
    2
    Lol not for noobs is an understatement... Had to modify everything by hand for mokee... All the files are different and vol up + power button is already used by screencast... Been a real b@#$% so far and im not done, bit many thanks for this.. Totally lays the groundwork for some amazing stuff !!!!!@!@!@

    Sent from my One using XDA Premium 4 mobile app