1、 Introduction to scrcpy
Note: the spelling is scrcpy, a non Python crawler framework.
Scrcpy can be debugged through the way of ADB to put the phone screen on the computer, and can control your Android device through the computer. It can be connected via USB (required for the first time) or via WiFi (via TCP / IP, similar to airdrop screen), and does not require any root privileges and does not need to install any programs in the phone. Scrcpy is suitable for GNU / Linux, windows and MacOS.
It has some characteristics
- Brightness (native, display device screen only)
- Performance (30 ~ 60fps)
- Mass (1920 × 1080 or above)
- Low latency (35 ~ 70ms)
- Short startup time (display the first image for about 1 second)
- Non intrusive (nothing is installed on the device)
Scrcpy’s project website on GitHub: https://github.com/Genymobile/scrcpy |Client download address（ https://github.com/Genymobile/scrcpy/releases ）。
Genymobile is a French company specializing in Android simulation and developer services. Genymotion, as you know it, is one of its products.
2、 Requirements for using scrcpy
- Android devices require at least API 21 (Android version 5.0 or above)
- Make sure that ADB debugging is enabled on your device
On some devices, you also need to enable other options to control it using the keyboard and mouse.
3、 Connect using USB
This method is recommended and relatively more fluent.
When the mobile phone is connected to the PC via USB, the first connection will pop up whether to trust the computer. Click always trust.
adb usbCheck whether the connection is successful
D:\xushanxiang\scrcpy-win64-v1.10>adb usb restarting in USB mode
You can also add D: (xushanxiang) scrcpy-win64-v1.10 to the system environment variable.
If there are multiple devices, you need to specify the serial number, which can be obtained from the ADB devices, such as:
List of devices attached
* daemon not running; starting now at tcp:5037
* daemon started successfully
scrcpy -s 6a86de95
View the connected device command: ADB devices. If device is displayed, it means it is connected; if offline is displayed, it is offline.
If it is MacOS, execute
scrcpyAfter that, the following contents will appear, and the current real-time interface of the mobile phone (screen projection) will pop up, and you can also operate the mobile phone on the computer interface.
~ scrcpy * daemon not running; starting now at tcp:5037 * daemon started successfully /usr/local/Cellar/scrcpy/1.8/share/scrcpy/scrcpy-serv....jar: 1 file pushed. 1.0 MB/s (19850 bytes in 0.019s) 2019-11-28 10:31:45.315 scrcpy[4701:62681] INFO: Initial texture: 1080x1920
4、 Use wireless connection
Please refer to the official document: open source project – scrcpy now works wirelessly
This connection method is more convenient and fast. If the broadband speed is high, the use effect is better, and the use method is also very simple. The steps are as follows:
- Make sure your PC and phone are on the same WiFi
- The mobile phone is connected to PC through USB
- Run on PC
ADB TCPIP service portFor example, the port is 5555
- Unplug the USB connection from the phone
- Run on PC
Mobile phone IP: service port
- Run as usual
- To switch back to USB mode:
The mobile phone IP can be viewed through the status information of the mobile phone or by logging in to the router, generally starting with 192.168.
In this way, the screen of the mobile phone pops up, and the screen of the mobile phone is successful!
As expected, the performance is different from USB, and the default scrcpy bit rate is 8mbps, which may be too much for a Wi Fi connection.
Depending on the usage, reducing bit rate and resolution may be a good compromise.
scrcpy –bit-rate 2M –max-size 800
Scrcpy – B2M – M800
5、 Some scrcpy commands
1. Start scrcpy
2. If you have multiple devices, you need to specify the serial number, which can be obtained from the ADB devices
scrcpy -s 6a86de95
3. Set port
scrcpy -p 27184
4. View help
5. Set code rate (default 8m)
scrcpy -b 8M
6. Limited screen size
scrcpy -m 1024
7. Crop projection screen (length: width: offset X: offset y)
scrcpy -c 800:800:0:0
8. Screen casting and recording
scrcpy -r file.mp4
9. Record screen without screen projection
scrcpy -Nr file.mp4
10. The trackball is displayed when the finger touches it
11. Display version information
12. Close device screen
You can close the device screen when you start mirroring using the command line option:
scrcpy --turn-screen-off scrcpy -S
Or press at any time
Ctrl + o。 To reopen it, press
Ctrl + p）。
6、 Common shortcut keys of scrcpy
|Switch full screen mode||
|Adjust the window to 1:1 (perfect pixels)||
|Size the window to remove the black border||
|Return to home||
|Click on the menu||
|Adjust the volume||
|Adjust the volume||
|Click the phone power supply||
|Close device screen (keep mirror)||
|Expand notification panel||
|Collapse notification panel||
|Copy device clipboard to computer||
|Paste computer clipboard to device||
|Copy computer clipboard to device||
|Enable / disable FPS counter (on standard output)||
Dle double click the black border to delete it.
If it is turned off, right-click to open the screen, otherwise press back.
In this way, we use two ways (USB connection and WiFi connection) to use scrcpy. For other methods, please refer to readme（ https://github.com/Genymobile/scrcpy#features ）For example, you can drag and drop the APK directly to install, record the screen of mobile phone, etc.
Original text: https://xushanxiang.com/2019/11/android-scrcpy.html