scrcpy is a free and open-source Android screen mirroring application. It is a very lightweight application that provides display and control of Android devices connected over USB or TCP. It doesn’t require any root access. In this article, we are going to see how can we mirror the android device’s screen using it.
- Android 5.0 or later.
- A USB cable.
- Enable USB debugging.
A zip file with all dependencies is available for windows. You can download it here. adb tool is also included in this package, so, you don’t have to download it separately. Extract this folder in the current working directory.
On Linux, it can be installed directly using the standard package manager.
For example, on Debian based OS, run the following command to install it:
$ sudo apt-get install scrcpy
It can also be downloaded using snap.
This application is also available in Homebrew. Run the following command to install it.
brew install scrcpy
How to run?
Note: USB Debugging mode needs to be turned on before connecting the android device in any mode.
To communicate with the android devices, scrcpy uses the Android debugging tool (adb). adb can connect to the device over TCP/IP. To connect wirelessly, connect the android device with the PC using USB first. Then, run the following command to enable TCP/IP on your device. The port 5555 is used here. You can use any port number you want.
adb tcpip 5555
Now, disconnect the android device from the PC and run the following command to connect with the device over TCP/IP. Replace IP_ADDR with the IP Address of your device.
adb connect IP_ADDR:5555
Now, run scrcpy as usual and it will start displaying your device’s screen wirelessly.
To connect the device using a USB Cable, You just need to connect the device to the PC and run scrcpy on command prompt:
After you run it, it will start displaying the device’s screen.
Real-time manipulations on mobile
There are many manipulations that can be done on mobile using scrcpy. Some of them are listed below with an example. Type the following commands in the command prompt.
Connect multiple devices
This tool allows users to connect multiple devices simultaneously. You just need to follow these simple steps to make it work. First, turn USB debugging on for all the devices and connect them to the PC. Then, list all the devices which are recognized by adb by running the following command.
Now, for each device listed in the output, copy its serial number and run the following command. Replace SERIAL_NUM with the serial number of the device.
scrcpy --serial SERIAL_NUM
It will display all the devices on the screen.
You can also mirror the device’s screen at a lower resolution to increase performance.
scrcpy --max-size 720
It preserves the aspect ratio of the screen.
Limit frame rate
You can also change the frame rate of the captured screen.
scrcpy --max-fps 10
Sometimes, you only need to display a part of the screen, so, you can so that with this feature.
scrcpy --crop 1224:1440:0:0
You can also record the screen while mirroring.
scrcpy --record myrecording.mp4
You can start the app directly in full-screen mode.
Sometimes, you need to show the physical touches. This feature will help you in that case.
Prevent the device from sleeping after some delay.
- How to Increase/Decrease Screen Brightness using Volume Keys Programmatically in Android?
- How to Change the Screen Orientation Programmatically using a Button in Android?
- How to Create a Splash Screen in Android using Kotlin?
- Locking Screen Orientation in Android
- How to Keep the Device Screen On in Android?
- How to Increase/Decrease Screen Brightness in Steps Programmatically in Android?
- How to Detect Touch Event on Screen Programmatically in Android?
- How to Find the Screen Resolution of a Device Programmatically in Android?
- How to Align Navigation Drawer and its Elements towards the Left or Right of the Screen in Android?
- How to Maximize/Minimize Screen Brightness Programmatically in Android?
- How to Create an Animated Splash Screen in Android?
- How to install Android Applications in Mobile Phone without USB Cables using Android Studio
- How to Add OpenCV library into Android Application using Android Studio?
- Android | AdMob Interstitial Ads for Android Studio
- 8 Best Android Libraries That Every Android Developer Should Know
- How to Clone Android Project from GitHub in Android Studio?
- Android | AdMob Banner Ads for Android Studio
- How to Add Audio Files to Android App in Android Studio?
- How to change login screen background in Ubuntu
- Sending a Text Message Over the Phone Using SmsManager in Android
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.