My goal is to be able to type a one word command and get a screenshot from a rooted Nexus One attached by USB.
So far, I can get the framebuffer which I believe is a 32bit xRGB888
raw image by pulling it like this:
adb pull /dev/graphics/fb0 fb0
From there though, I'm having a hard time getting it converted to a png. I'm trying with ffmpeg like this:
ffmpeg -vframes 1 -vcodec rawvideo -f rawvideo -pix_fmt rgb8888 -s 480x800 -i fb0 -f image2 -vcodec png image.png
That creates a lovely purple image that has parts that vaguely resemble the screen, but it's by no means a clean screenshot.
A vastly easier solution for ICS is to use the following from the command line
This'll save the screenshot.png file in the current directory.
Tested on a Samsung Galaxy SII & SII running 4.0.3.
Using my HTC Hero (and hence adjusting from 480x800 to 320x480), this works if I use rgb565 instead of 8888:
Now we have got a single line command to take a screenshot. The command as follows:
Type the above command in your terminal and press enter. If you want the screenshot to be stored in any specific location, then give the path (or) directory before
screen.png
.Source.
On the MyTouch Slide 3G, I ended up with the red and blue channels swapped in my screenshots. Here's the correct ffmpeg incantation for anyone else in that situation: (the notable part: -pix_fmt bgr32)
Thanks to Patola for the handy shell script! At least for my phone, no mogrification is necessary to correctly orient for portrait mode (320x480), and so the end of his script becomes:
I think rgb32torgb888.py should be
A little elaborate/excessive but it handles both screencap and framebuffer scenarios (as well as figuring out the resolution too).