Grab the raw image from the Android frame buffer using ADB
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.
$ 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.
具体请参照http://my.opera.com/otaku_2r/blog/grab-a-frame-in-android-frame-buffer