Super practical tool Scrcpy operation sharing on the mobile terminal (Part 1)

scrcpy  is a free and open source screencasting software that supports casting the screen of an Android phone on Windows, macOS, GNU/Linux, and can directly use the mouse to interact and record in the screencasting window.

The mainstream multi-screen collaboration software on the market is all developed based on scrcpy, which is layered and has almost no bugs. It is recommended to use the official scrcpy directly.

This article takes Window mirroring as an example, which is compatible with Win10 and Win11. scrcpy official download  scrcpy-win64-v1.25.zip , or use the domestic transfer link: https://wwz.lanzouf.com/iezWX03zx4de .

The full name of Scrcpy is the abbreviation of Screen copy.

This application provides display and control of Android devices connected via USB or TCP/IP. It does not require any root access. It is available for GNU/Linux , Windows and macOS .

It focuses on:

  • Brightness : Native, only displays the device screen
  • Performance : 30~120fps, depends on the device
  • Quality : 1920×1080 or above
  • Low latency : 35~70ms
  • Low startup time : about 1 second to display the first image
  • Non-intrusive : nothing is installed on the Android device
  • User Benefits : No Accounts, No Ads, No Internet Required
  • Liberty : Free and Open Source Software

Its features include:

Operating conditions:

1) Android devices require at least API 21 (Android 5.0).

2) Make sure adb debugging is enabled on your device .

3) On some devices, you will also need to enable an additional option to use the keyboard and mouse to control it.

One, run.

1. Turn on USB debugging in the mobile phone developer options

2. Download Scrcpy, unzip and install. The new version of Scrcpy has its own adb environment, so you don't need to install adb deliberately.

  • Linux:apt install scrcpy
  • Apple system:brew install scrcpy

3. Add the installation path directly to the environment variable.

4. Connect the mobile phone to the USB port of the computer through the USB factory data cable.

5. Double-click the scrcpy.exe file in the picture above. After waiting for a few seconds, check whether an interface pops up.

The second operation mode: under Dos environment,

1. Through the windows key + R key, enter CMD and press Enter.

2. Then enter adb version to check whether the environment variable is set normally, and it will appear:

 When connecting for the first time, the mobile phone will pop up a confirmation window. If there is no pop-up window, you need to open the mobile phone developer option. Click on each mobile phone developer option, refer to Baidu.

3. The above prompt appears, indicating that the environment is OK. Then enter scrcpy to open the customized mobile phone interface through the command parameters.

Note: You need to enter the command under the installation path of scrcpy.

The third mode of operation: run in a wireless, network-free, and account-free environment.

The premise of wireless screen projection is that the computer and mobile phone are in the same local area network .

After completion, open PowerShell (~ cmd), and operate in sequence.

1)进入scrcpy安装目录,地址栏输入cmd并回车
​
2)在手机端开启「开发者选项」及「USB 调试」,然后使用数据线将手机和电脑连接并允许 USB 调试,开启手机端口
# 如果输入adb devices显示 no device 或未启动 adb,需检查「USB 调试」是否开启,或更换数据线。
# 此外,一些手机需选择「文件传输」模式方能使用 adb。

3)cmd下输入如下指令
scrcpy --tcpip=192.168.1.1       # default port is 5555
scrcpy --tcpip=192.168.1.1:5555
​
4)断开手机数据线,开始无线投屏。(192.168.2.15 为手机端的 WIFI 局域网 ip,需更改)

5)输入如下指令,ip需对应手机IP,端口为前置步骤所设置tcp端口
adb connect 192.168.2.xx:5555
​
6)启动 scrcpy.exe,输入如下指令scrcpy
scrcpy

7)连接多个设备,报错提示`failed to get feature set: more than one device/emulator`,则指定连接 tcpip 设备
scrcpy --serial=0123456789abcdef
scrcpy -s 0123456789abcdef  # short version

 If there are other abnormalities, please change the Chinese in the middle of the installation directory to English without leaving spaces.

Second, run the command.

Capture mobile configuration:

1) Reduced size

将宽度和高度都限制为某个值(例如 1024):

scrcpy --max-size=1024
scrcpy -m 1024  # short version

2) Change the bitrate

默认比特率是 8 Mbps。要更改视频比特率(例如更改为 2 Mbps):

scrcpy --bit-rate=2M
scrcpy -b 2M  # short version

3) Limit the frame rate

可以限制捕获帧速率:

scrcpy --max-fps=15

这从 Android 10 开始得到官方支持,但可能适用于更早的版本。

实际的捕获帧率可能会打印到控制台:

scrcpy --print-fps

4) Cropping

设备屏幕可能会被裁剪为仅镜像屏幕的一部分。

这很有用,例如,仅镜像 Oculus Go 的一只眼睛:

scrcpy --crop=1224:1440:0:0   # 1224x1440 at offset (0,0)

如果--max-size还指定,则在裁剪后应用调整大小。

5) Lock video orientation

scrcpy --lock-video-orientation     # initial (current) orientation
scrcpy --lock-video-orientation=0   # natural orientation
scrcpy --lock-video-orientation=1   # 90° counterclockwise
scrcpy --lock-video-orientation=2   # 180°
scrcpy --lock-video-orientation=3   # 90° clockwise

这会影响录制方向。
窗口也可以独立旋转。

capture:

6) record

可以在镜像时录制屏幕:

scrcpy --record=file.mp4
scrcpy -r file.mkv

要在录制时禁用镜像:

scrcpy --no-display --record=file.mp4
scrcpy -Nr file.mkv
# interrupt recording with Ctrl+C

“跳帧”会被记录下来,即使它们没有实时显示(出于性能原因)。帧在设备上带有时间戳,因此数据包延迟变化不会影响记录的文件。

Guess you like

Origin blog.csdn.net/qq_17195161/article/details/128476364