分享一个好用的Android投屏工具-scrcpy
16lz
2022-05-10
远程办公,但android设备不在身边,怎么办?
别急,scrcpy来解决!
目录
简单介绍
效果视频
使用步骤
命令行操作
简单介绍
scrcpy可通过adb调试的方式来将手机屏幕投到电脑上,并可以通过电脑控制您的Android设备。它可以通过USB连接,也可以通过网络连接,重要的是,使用这个工具,不需要root权限,不需要在手机里安装任何程序,免费开源。
Github:https://github.com/Genymobile/scrcpy
下载地址:https://github.com/Genymobile/scrcpy/releases
软件安装和使用平台(Linux Windows MacOs)在开源地址上有介绍,这里不做过多介绍。
Windows上使用的工具包可以我网盘下载:
链接:https://pan.baidu.com/s/18D83zM2MCRDAuxezkFiXvw
提取码:5vz8
效果视频
scrcpy投屏演示效果
使用步骤
android设备打开adb调式模式,使用usb数据线连接设备和PC。
鼠标点击解压目录下的scrcpy.exe或者scrcpy-noconsole.exe既可以运行启动投屏界面。
当然直接点击,工具很多功能就无法使用。
如果想使用工具的一些其他功能,建议使用命令行方式加相关参数运行。
命令行操作
scrcpy --help 可以看到工具的命令行用法及界面操作快捷键:
Usage: scrcpy [options]Options: --always-on-top Make scrcpy window always on top (above other windows). -b, --bit-rate value Encode the video at the given bit-rate, expressed in bits/s. Unit suffixes are supported: 'K' (x1000) and 'M' (x1000000). Default is 8000000. --crop width:height:x:y Crop the device screen on the server. The values are expressed in the device natural orientation (typically, portrait for a phone, landscape for a tablet). Any --max-size value is computed on the cropped size. -f, --fullscreen Start in fullscreen. -h, --help Print this help. --max-fps value Limit the frame rate of screen capture (only supported on devices with Android >= 10). -m, --max-size value Limit both the width and height of the video to value. The other dimension is computed so that the device aspect-ratio is preserved. Default is 0 (unlimited). -n, --no-control Disable device control (mirror the device in read-only). -N, --no-display Do not display device (only when screen recording is enabled). -p, --port port Set the TCP port the client listens on. Default is 27183. --prefer-text Inject alpha characters and space as text events instead of key events. This avoids issues when combining multiple keys to enter a special character, but breaks the expected behavior of alpha keys in games (typically WASD). --push-target path Set the target directory for pushing files to the device by drag & drop. It is passed as-is to "adb push". Default is "/sdcard/". -r, --record file.mp4 Record screen to file. The format is determined by the --record-format option if set, or by the file extension (.mp4 or .mkv). --record-format format Force recording format (either mp4 or mkv). --render-expired-frames By default, to minimize latency, scrcpy always renders the last available decoded frame, and drops any previous ones. This flag forces to render all frames, at a cost of a possible increased latency. -s, --serial serial The device serial number. Mandatory only if several devices are connected to adb. -S, --turn-screen-off Turn the device screen off immediately. -t, --show-touches Enable "show touches" on start, disable on quit. It only shows physical touches (not clicks from scrcpy). -v, --version Print the version of scrcpy. --window-borderless Disable window decorations (display borderless window). --window-title text Set a custom window title. --window-x value Set the initial window horizontal position. Default is -1 (automatic). --window-y value Set the initial window vertical position. Default is -1 (automatic). --window-width value Set the initial window width. Default is 0 (automatic). --window-height value Set the initial window width. Default is 0 (automatic).Shortcuts: Ctrl+f switch fullscreen mode Ctrl+g resize window to 1:1 (pixel-perfect) Ctrl+x Double-click on black borders resize window to remove black borders Ctrl+h Middle-click click on HOME Ctrl+b Ctrl+Backspace Right-click (when screen is on) click on BACK Ctrl+s click on APP_SWITCH Ctrl+m click on MENU Ctrl+Up click on VOLUME_UP Ctrl+Down click on VOLUME_DOWN Ctrl+p click on POWER (turn screen on/off) Right-click (when screen is off) power on Ctrl+o turn device screen off (keep mirroring) Ctrl+r rotate device screen Ctrl+n expand notification panel Ctrl+Shift+n collapse notification panel Ctrl+c copy device clipboard to computer Ctrl+v paste computer clipboard to device Ctrl+Shift+v copy computer clipboard to device Ctrl+i enable/disable FPS counter (print frames/second in logs) Drag & drop APK file install APK from computer
提几个常用的指令:
启动scrcpy:scrcpy如果有多个设备,需要指定序列号:scrcpy -s 设备序列号置顶显示投屏窗口scrcpy --always-on-top以全屏方式启动:scrcpy -f设置端口:scrcpy -p 27184查看帮助:scrcpy -h设置码率(默认8M):scrcpy -b 8M设置最大fps值:scrcpy --max-fps value限制投屏尺寸:scrcpy -m 1024裁剪投屏屏幕(长:宽:偏移x:偏移y):scrcpy -c 800:800:0:0投屏并录屏:scrcpy -r file.mp4不投屏只录屏:scrcpy -Nr file.mp4手指触摸的时候显示轨迹:scrcpy -t显示版本信息:scrcpy -v
工具的快捷键
动作 | 快捷键 |
全屏/非全屏切换 | Ctrl+f |
将窗口调整为1:1(完美像素) | Ctrl+g |
调整窗口大小以删除黑色边框 | Ctrl+x |
设备Home键 | Ctrl+h|鼠标中间键 |
设备Back键 | Ctrl+b | 鼠标右键| Ctrl+Backspace |
设备最近任务键 | Ctrl+s |
设备Menu键 | Ctrl+m |
设备音量↑ | Ctrl+↑ |
设备音量↓ | Ctrl+↓ |
设备电源键 | Ctrl+p |
亮屏(屏幕灭屏状态) | 鼠标右键 |
灭屏 | Ctrl+o |
旋转屏幕 | Ctrl+r |
展开通知栏 | Ctrl+n |
收缩通知栏 | Ctrl+Shift+n |
将设备粘贴板的内容粘贴到PC | Ctrl+c |
将PC粘贴板内容粘贴到设备 | Ctrl+v|Ctrl+Shift+v |
打开关闭FPS计数器(命令行中显示) | Ctrl+i |
安装apk | Drag & drop APK file |
更多相关文章
- 使用Maven管理Android项目(一)
- Android使用TextView实现无下划线超链接
- [Android] 使用Matrix矩阵类对图像进行缩放、旋转、对比度、亮度
- Android技能之-setSupportActionBar(toolbar)的那点事
- Android实现图表绘制和展示
- Retrofit的简单使用
- 箭头函数的基础使用
- NPM 和webpack 的基础使用
- Python list sort方法的具体使用