的Nexus One的亚行截图?截图、Nexus、One

2023-09-12 10:44:16 作者:往笙

我的目标是能够从连接通过USB接口一个根深蒂固的Nexus One键入一个单词的命令,并得到一个截图。

My goal is to be able to type a one word command and get a screenshot from a rooted Nexus One attached by USB.

到目前为止,我可以得到我相信这是一个 32位xRGB888 原始图像向外拉,像这样的帧缓冲:

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

在那里,虽然,我有一个很难得到它转换为PNG。我试图用的ffmpeg是这样的:

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.

推荐答案

有关ICS一个大大简单的解决方案是使用命令行下面的

A vastly easier solution for ICS is to use the following from the command line

adb shell /system/bin/screencap -p /sdcard/screenshot.png
adb pull /sdcard/screenshot.png screenshot.png

这会保存screenshot.png文件在当前目录。

This'll save the screenshot.png file in the current directory.

测试上三星Galaxy SII和放大器; SII运行4.0.3。

Tested on a Samsung Galaxy SII & SII running 4.0.3.