Skip to main content

Developer's notes IV. Presets for screen recording in Android 4.4 KitKat

One of the most useful Android 4.4 features for me is screen recording. This allows us to record videos of live wallpapers and upload them to YouTube. Before this we had to record videos either with camcorder (looks quite blurry) or from emulator (low-res and a bit laggy). So right after updating my Nexus 7 (1st gen) and Nexus 10 to Android KitKat I've decided to try this feature out.



Basically, everybody making app reviews will find this feature extremely useful

To record videos in Android 4.4 you should use adb shell screenrecord command. You can read Android documentation on this here: http://developer.android.com/tools/help/adb.html#screenrecord.  After reading docs, first thing you would like to do is to launch utility with --help option:
c:\Program Files (x86)\Android\android-sdk\platform-tools>adb shell screenrecord --help
Usage: screenrecord [options] <filename>

Records the device's display to a .mp4 file.

Options:
--size WIDTHxHEIGHT
    Set the video size, e.g. "1280x720".  Default is the device's main
    display resolution (if supported), 1280x720 if not.  For best results,
    use a size supported by the AVC encoder.
--bit-rate RATE
    Set the video bit rate, in megabits per second.  Default 4Mbps.
--time-limit TIME
    Set the maximum recording time, in seconds.  Default / maximum is 180.
--rotate
    Rotate the output 90 degrees.
--verbose
    Display interesting information on stdout.
--help
    Show this message.

Recording continues until Ctrl-C is hit or the time limit is reached.

Recording on default settings will result in skipped frames and quality will be worse than you'd expect. On N7 you will get laggy video and on N10 you will get ugly compression artifacts - default 4Mbps bit rate is simply not enough for its enormous 2560x1600 resolution. So I've picked presets which I believe are optimal for my needs and don't cause UI lag when recording. When playing around with options, please note that you need to specify bit rate in bps, not Mbps, but yes, it reads "in megabits per second" :)

Here are command line parameters for screen recording which I believe are the most optimal:

Nexus 4:
adb shell screenrecord /sdcard/video.mp4 --bit-rate 8000000 --size 1280x768
Nexus 10:
adb shell screenrecord /sdcard/video.mp4 --bit-rate 8000000 --size 1280x720
Nexus 7 1st gen:
adb shell screenrecord /sdcard/video.mp4 --size 960x540 --bit-rate 5000000
I don't use --time-limit option but just hit Ctrl+C after I finished recording.
Because adb shell command simply executes any shell commands on device you can call screenrecord command directly on your device in Android Terminal Emulator app. But you need to run it with root permissions to be able to actually record videos so if device is not rooted you have to use adb shell from your PC. Example:
screenrecord /sdcard/video.mp4 --bit-rate 8000000 --size 1280x720

Also note that if you rotate device when recording you will get cropped video - you will have to record landscape and portrait videos separately.

So Nexus 10 is capable of recording quite good 720p videos with little to no frameskip (it is barely noticeable when recording usual apps like browser or GMail but becomes a little bit laggy recording full-screen animations like app drawer transitions). To my liking, videos recorded from Nexus 7 have more even framerate but on Nexus10 you can achieve more sharp image because of higher resolution. Nexus4 with its powerful Snapdragon S4 is capable of capturing full-size 1280x720 frame, and I haven't noticed a single sign of lag during recording (however, there were a few negligible frame-skips in recorded video) - device operated as smooth as always.

Here is a sample video recorded from 1st-gen Nexus 7. Android doesn't record audio - I've added some free audio track in Youtube Video Manager.



Two more samples from Nexus 4: https://www.youtube.com/watch?v=4MGSHE8mZFQ and https://www.youtube.com/watch?v=v7NYbVyJRdg for vertical videos fans :)

Feel free to post your presets for your devices in comments - may be you will achieve better quality than me :)

Comments

  1. Great advice for those of us who use the screen recording capabilities, I use it for playing and have done 1 video, thx for the tip on the N10

    ReplyDelete
  2. What do you suppose the max bitrate would be for the Nexus 4? Not sure of the flash memory speed but the screen is 768x1280.

    ReplyDelete
    Replies
    1. Here you go - I've updated article with parameters for Nexus 4. So far it's the best device to record video - it captures full 1280x768 video with no lag. Incredibly powerful device :)
      And here is a sample video: https://www.youtube.com/watch?v=4MGSHE8mZFQ You can see a cropped image in the last few seconds of video - as I mentioned, Android won't rotate screen automagically for you so you will need to record vertical and horizontal videos separately.

      Delete

Post a Comment

Popular posts from this blog

Voxel Airplanes 3D Live Wallpaper

Today we've released a Voxel Airplanes 3D Wallpaper . This live wallpaper brings a fully 3D scene with cute cartoonish airplanes flying above various landscapes to the home screen of your phone. Scene has a distinct old-skool pixelated look. All objects are deliberately of a low fidelity - ground and clouds have these crunchy, unfiltered textures. Yet they are full of small eye-catching details like occasional stylized anime-like glass reflections and planes moving around ever so slightly, struggling in the strong wind. Make sure to enable a fully randomized mode to see all varieties of planes and terrains!

Spring Flowers 3D Live Wallpaper

Today we've released a Spring Flowers 3D Live Wallpaper . With this Android app you can decorate your phone’s screen with a view of blooming spring field. This app brings you to the field of fresh green grass, bright young flowers and sunny spring weather. Butterflies fly over the blooming dandelions, and grass blades wave under the gentle wind. You can notice small details in flower petals, and even ants doing their business on the ground under the vegetation. This live wallpaper can represent different times of day - either bright sunny afternoon, sunset and sunrise lit in warm colors, or starry night. Scene is represented in a true 3D - everything can be viewed from any different angles as the camera slowly moves. Customization options of Spring Flowers 3D Live Wallpaper: Smooth, detailed graphics and 4K image quality Different camera settings Different time of day settings Customizable color modes View can rotate interactively with the swipe of screen

3D Castle Live Wallpaper

We're glad to announce the release of new Android live wallpaper app - "3D Castle Live Wallpaper". Immerse yourself in a dynamic, enchanting 3D scene featuring a charming and stylized castle nestled within a lush forest. This animated live wallpaper is designed to breathe life into your device, offering a rich and captivating visual experience. Step into a whimsical world where a beautifully designed castle stands amidst a serene forest. The cartoon-style graphics exude charm and character, making your screen come alive with vivid colors and engaging details. Get app on Google Play - https://play.google.com/store/apps/details?id=org.androidworks.livewallpaper.cartooncastle3d