Android Things:截图 [英] Android Things: take a screenshot

查看:101
本文介绍了Android Things:截图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您如何通过ADB for Android Things截屏?我试过了:

How do you take a screenshot via ADB for Android Things? I have tried:

adb shell screencap -p /sdcard/screen.png
adb pull /sdcard/screen.png
adb shell rm /sdcard/screen.png

adb shell screencap -p | perl -pe 's/\x0D\x0A/\x0A/g' > screen.png


推荐答案

我不能赚 screepcap Android Things Developer Preview 中工作。该命令将导致文件大小为0。

I couldn't make screepcap work in Android Things Developer Preview. The command results in a 0-size file.

也就是说,我建议以下两个选项:使用帧缓冲区或录制视频( screenrecord 似乎可以正常工作),然后通过适当的工具将其转换为图像。我将考虑第一种选择,因此步骤将是:

That said, I recommend the following two options: either use the framebuffer or record a video (screenrecord seems to work) and convert it to an image later on by proper tool. I'll consider the first option, so the steps would be:


  • 将帧缓冲区拉到主机 。请注意,您需要以root用户身份启动 adbd 才能通过权限检查:

  • Pull the framebuffer to the host machine. Note that you need to start adbd as root in order to pass a permission check:

adb root
adb pull /dev/graphics/fb0 screenshot


  • 通过您喜欢的工具将原始二进制文件转换为图像。我正在使用 ffmpeg 的问题。由于屏幕分辨率或像素格式不同,以下命令可能对您不起作用。如果是这样,请进行适当的更改。

  • Convert the raw binary to image by the tool you prefer. I'm using ffmpeg. The command below might not work for you due to different screen resolution or pixel format. If so, make proper changes.

    ffmpeg -f rawvideo -pix_fmt rgb565 -s 800x480 -i screenshot screenshot.png
    


  • 这篇关于Android Things:截图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆