3

安卓投屏神器:scrcpy

 3 years ago
source link: https://foofish.net/scrcpy.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

这款神器解决完美解决了手机投屏的问题

手机投屏之前我用的是 vysor,因为付费版必须通过 google play 进行支付,麻烦的一批

所以我一直用它的基础免费版。而且它需要在手机和电脑端同时都装有软件才能投屏到电脑桌面,但坑爹的是隔段时间就要升级,就会导致升级过程中会自动断开投屏,不得不人工干预才能恢复。

因为我的需求是希望24小时都可以将手机画面投到电脑桌面,随时随地方便远程操控,如果我哪天外出,刚好在这个时候投屏断开了就看不到手机画面,操作不了手机。

scrcpy

scrcpy 完美解决了我的痛点需求, 注意不要和那个爬虫框架 scrapy 搞混了。

scrcpy 有这么几个优点

  • 无侵入性,就是说不会在手机里面安装任何程序
  • 无需 root 权限。序支持 GNU/Linux, Windows 和 macOS
  • 延迟低, 35~70ms,几乎感觉不到卡顿的问题
  • 免费开源

更多功能可以在GitHub查看 https://github.com/Genymobile/scrcpy/blob/master/README.zh-Hans.md

先看下效果:

UbQ32a.png!mobile

按如下步骤操作你就可以轻松把手机投屏到电脑

电脑端安装

windows下载地址:https://github.com/Genymobile/scrcpy/releases/download/v1.17/scrcpy-win64-v1.17.zip

macOS 直接命令行安装

brew install scrcpy

解压后运行 scrcpy 如果报错找不到命令,要先配置环境变量,在【我的电脑】->右键【属性】->【高级系统设置】->【环境变量】->【系统变量】找到Path变量,编辑

Rnii6fr.png!mobile

将 scrcpy所在路径加入到 Path 变量中即可。

手机端配置

投屏前,手机要开启开发者模式并打开USB调试,不同手机的开发者模式开始方式可能不太一样,比如一加手机就是在【设置】中找到【关于手机】页面,连续点击【版本号】就会自动开启开发者模式。

yyEJRnv.png!mobile

用USB数据线将手机连接到电脑,在命令行执行 adb devices 查看是否连接成功, 比如我这里就连接了4台设备

r2eUnaJ.png!mobile

scrcpy

默认情况下,如果只连接了一台设备的话,直接运行命令 scrcpy 就可以投屏了,如果有多个设备,就需要用 -s 参数指定设备名字。

C:\Users\lzjun>scrcpy -s DMWWVCZHUOCIKBKR 
INFO: scrcpy 1.17 <https://github.com/Genymobile/scrcpy>
C:\Program Files\scrcpy-win64-v1.17\scrcpy-server: 1 f...e pushed, 0 skipped. 59.1 MB/s (34930 bytes in 0.001s)
[server] INFO: Device: OPPO OPPO A73 (Android 7.1.1)
INFO: Renderer: direct3d
INFO: Initial texture: 480x960

这就表示大功告成了。

另外,如果你觉得命令行麻烦,还有人为其开发了GUI工具,这大大的提供了便利性。

7viE3m7.png!mobile

scrcpy-gui下载地址:https://github.com/Tomotoes/scrcpy-gui/releases

有问题可以扫描二维码和我交流

关注公众号「Python之禅」,回复「1024」免费获取Python资源

vQremuy.jpg!mobile

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK