Scrcpy is a neat little tool that enables users to mirror android screens and control them from Linux desktop. In this article, I will write about how you can mirror your android screen and control it with mouse and keyboard from your Linux desktop with faster response time and good resolution.
SCRCPY is short for Screen Copy. It’s a lightweight tool that helps you to mirror your android screen onto your desktop and control it with your mouse and keyboard. There are many reasons you want to use Scrcpy such as:
- Watching a mobile-only video streaming service in big screen (I have an app provided by my network carrier that has many good movies and TV channels but only available for mobiles)
- Playing games on the big screen
- Control screen without touching the phone
- Testing apps for developers faster without physically picking up the device
- Show your screen in front of the audience in a conference or class
- Use multiple screens with multiple Scrcpy instances
- Recover data from a partially broken device
And more. There are tons of other reasons you need screen mirroring.
Installing Scrcpy is very easy. Because It’s a very lightweight application, it does not require any extra things. And it is very easy to install. If you are on Ubuntu 20.04 and newer, you can install it with this command:
$ sudo apt install adb scrcpy
This will install ADB and scrcpy Debian packages. ADB is essential to run Scrcpy because it depends on it to discover, push controls, and fetch screen.
For any distributions, you can easily install Scrcpy using Snap. Just type in:
$ sudo snap install scrcpy
Scrcpy is a terminal tool. That means you have to use it via the command line. But, if you want an easy to use graphical interface, you can install Scrcpy-GUI. Its a good looking Electron-based GUI for Scrcpy. To install it, head over to this link and follow the instruction. While the GUI is pretty easy to use and you don’t need any tutorial, do mind that its not a complete working application. Also, it is Electron-based so its a heavy piece of software.
Now we want to mirror screens to our desktop with Scrcpy. But we don’t want low res stream, sluggish and late response time. So we want to configure some parameters while running Scrcpy from the terminal.
You can set the size of your mirror with
$ scrcpy --max-size 1024 $ scrcpy -m 1024 # short version
Lower resolution will increase performance in the cost of the viewing experience. If you want to watch a movie and videos, you should set the resolution to 1080 or 1024. Setting it to 720 will increase speed and reduce the control lag. So if you are trying to do stuff other than watching videos, you should use lower numbers.
You can set framerate using (only Android 10+)
$ scrcpy --max-fps 30 #max 60fps
You can set framerate up to 60 fps. If you are using movies and videos, 30 is good. But for gaming, you can set it to 60. For other uses, you can set it to 15 and reduce stress on the CPU.
You can set bitrate using
$ scrcpy --bit-rate 8M $ scrcpy -b 8M # short version
Lowering bitrate always helps by lowering latency and increasing speed. If your device uses low-speed USB connection or if you are using Scrcpy in wireless mode, you can lower bitrate in order to optimize your streaming performance and reducing latency. The maximum bitrate is 8M, you can use 2M for low-speed connections and low-end devices, and 5M for moderate connections. If you have a high-speed connection with better CPU, USB speed, and WIFI speed, you can use 8M. For other parameters, you can check here.
Record the screen while mirroring:
$ scrcpy --record file.mp4 $ scrcpy -r file.mkv
Disable mirroring while recording:
$ scrcpy --no-display --record file.mp4 $ scrcpy -Nr file.mkv # interrupt recording with Ctrl+C
Scrcpy is a minimal tool. All it provides as GUI is the window with a mirrored screen. So you need a keyboard and mouse to control all the stuff and navigate throughout the session. Here is a list of shortcuts you want to use in order to control your mirrored screen:
Click on HOME - Mouse Middle-click Click on BACK - Mouse Right-click Click on APP_SWITCH - Win+s Click on MENU (unlock screen) - Win+m Click on VOLUME_UP - Win+↑ (up) Click on VOLUME_DOWN - Win+↓ (down) Click on POWER - Win+p Power on - Mouse Right-click Turn the device screen off but keep mirroring - Win+o Turn device screen on - Win+Shift+o Rotate device screen - Win+r Expand notification panel - Win+n Collapse notification panel - Win+Shift+n Copy to clipboard - Win+c Cut to clipboard - Win+x Synchronize clipboards and paste - Win+v Inject computer clipboard text - Win+Shift+v Enable/disable FPS counter - Win+i Pinch-to-zoom - Ctrl+click-and-move
You can mirror multiple devices with Scrcpy. If you have multiple devices connected to the pc, you can specify which device to mirror in a single instance. Then you can open another instance of Scrcpy and then mirror another device. Look at this example.
Suppose you have two devices connected, so when you type
$ adb devices
It shows your device list. So you need to authorize the devices and remember the serious each device has. Then all you need to do is to open Scrcpy and set parameter like this
$ scrcpy –serial 0123456789abcdef
$ scrcpy -s 0123456789abcdef # short version
Replace the number with your device serial number from the ADB device list.
If you want to mirror the screen wirelessly:
- Connect the device to the same Wi-Fi as your computer.
- Get your device IP address (in Settings → About phone → Status).
- Enable ADB over TCP/IP on your device: adb tcpip 5555.
- Unplug your device.
- Connect to your device: adb connect DEVICE_IP:5555 (replace DEVICE_IP).
- Run scrcpy as usual.
You can also run multiple screens wirelessly using the mentioned way. If you want to forward audio from your device, you can check this script provided by Scrcpy devs. While it is made to work with Scrcpy, it can be used without it.
There could be many reasons why you need to project your screen to a bigger display, ideally your Linux desktop. If you want to do it, there is nothing hard. All you need to mirror your screen with no buffering and smoother streaming is Scrcpy. It’s a lightweight, no-fuss application that works flawlessly. In this article, I tried to show ways you can mirror your screen with this app faster and smoother. And I hope it helped you.