Linux tip 'n trick

Just another way to remember!

Capturing images in Android framebuffer

, , , , , ,

Grab the raw image from the Android frame buffer using ADB

$ adb shell
# cat /dev/graphics/fb0 > /sdcard/frame.raw
# exit


After capturing the RAW data from the frame buffer of Android, I want to see the result in a common image format so I convert it to PNG by using FFMPEG. Currently Android is using RGB565 format.

$ IMAGE_RES=320x480 $ RAW_IMAGE=frame.raw $ OUT_IMAGE=frame-%d.png $ #Download the raw data $ adb pull /sdcard/$RAW_IMAGE . $ ffmpeg -vcodec rawvideo -f rawvideo -pix_fmt rgb565 -s $IMAGE_RES \
-i $RAW_IMAGE -f image2 -vcodec png $OUT_IMAGE


Normally, you will get two frames (frame-1.png and frame-2.png), cuz' Android is using double buffering.

Build and run C application on AndroidA bit complaining

Comments

Unregistered user Friday, January 29, 2010 2:13:33 PM

Sonic1200 writes: I want to test the same thing, but how do you compile ffmpeg with Android NDK?

My Linux Blogotaku_2r Thursday, February 4, 2010 12:17:47 AM

Hi, I didn't compile FFMPEG with Android NDK but using my existing one on the PC. But it was a good suggestion. I would try it soon.

Unregistered user Monday, June 7, 2010 7:46:49 AM

Anonymous writes: did you compile FFMPEG with Android NDK?

My Linux Blogotaku_2r Monday, July 5, 2010 10:00:13 PM

No I didn't. It's a bit difficult since I didn't have time to try that.

Unregistered user Wednesday, December 15, 2010 11:46:01 PM

Anonymous 2 writes: The Android build environment is not a normal autotools environment, so it can be difficult to compile projects for it.

Unregistered user Sunday, March 27, 2011 2:16:26 PM

Pawan Sharma writes: I have created a blog based on Linux education check this :: http://linux-rhcsa-rhce.blogspot.com This blog is all about Red Hat Enterprise Linux 6.It contains details about RHCE, RHCSA, RHEL, etc. Please link it on your site/blog.

Unregistered user Tuesday, June 14, 2011 11:13:58 PM

Анонімний writes: People in every country get the home loans in various creditors, just because that is comfortable.

Unregistered user Friday, February 3, 2012 7:24:09 AM

Anonymous writes: Hi, I run command "cat /dev/graphics/fb0 > /sdcard/frame.raw", return err /dev/graphics/fb0: Device or resource busy can you help me?

Write a comment

New comments have been disabled for this post.