来自 adb 的 Nexus One 的屏幕截图? [英] Screenshot of the Nexus One from adb?
问题描述
我的目标是能够输入一个单词命令并从 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.
到目前为止,我可以通过像这样拉动它来获得我认为是 32bit 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.
这篇关于来自 adb 的 Nexus One 的屏幕截图?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!