Linux系统中安卓投屏软件scrcpy

Scrcpy

安装:sudo apt install scrcpy

使用注意事项:

  • 首先安卓手机要开启USB调试功能
  • 使用数据线将手机和电脑连接
  • 在终端下运行scrcpy,即可投屏使用

快捷键:

Scrcpy 快捷键列表
切换全屏模式 Ctrl+F
将窗口调整为1:1(完美像素) Ctrl+G
调整窗口大小以删除黑色边框 Ctrl+X | 双击黑色背景
设备 HOME 键 Ctrl+H | 鼠标中键
设备 BACK 键 Ctrl+B | 鼠标右键
设备 任务管理 键 (切换APP) Ctrl+S
设备 菜单 键 Ctrl+M
设备音量+键 Ctrl+↑
设备音量-键 Ctrl+↓
设备电源键 Ctrl+P
点亮手机屏幕 鼠标右键
复制内容到设备 Ctrl+V
启用/禁用 FPS 计数器(stdout) Ctrl+i
安装APK 将 apk 文件拖入投屏
传输文件到设备 将文件拖入投屏(非apk)
版权声明:本文为CSDN博主「小周求你了」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_42747139/java/article/details/104163312

如需声音同步可借助USBaudio,详情如下

This tool forwards audio from an Android device to the computer over USB. It works on Linux with PulseAudio.

The purpose is to enable audio forwarding while mirroring with scrcpy. However, it can be used independently, and does not require USB debugging enabled.

Note that AOA audio, the feature used by USBaudio, is deprecated since Android 8.0. For Android 10, use sndcpy instead.

Build

Install the following packages (on Debian):

sudo apt install gcc git meson vlc libpulse-dev libusb-1.0-0-dev

Then build:

git clone https://github.com/rom1v/usbaudio
cd usbaudio
meson x --buildtype=release
cd x
ninja

To install it:

sudo ninja install

Run

Plug an Android device.

If USB debugging is enabled, just execute:

usbaudio

You can specify a device by serial or by vendor id and product id:

# the serial can be found via "adb device" or "lsusb -v"
usbaudio -s 0123456789abcdef

# the vid:pid is printed by "lsusb"
usbaudio -d 18d1:4ee2

To stop playing, press Ctrl+C.

To stop forwarding, unplug the device (and maybe restart your current audio application).

To only enable audio accessory without playing, use:

usbaudio -n

Blog post

  • Introducing USBaudio

作者: 洛水之滨

天行健,君子以自强不息; 地势坤,君子以厚德载物。

发表评论