Being able to mirror your Android screen on your computer can help make things easier in many ways. You can get immediately notified about incoming calls and messages even while working on your computer, so you don't miss important ones. On Linux, you can do so using the Scrcpy open-source tool, which is completely free.
What is Scrcpy? Called Screen-copy, Scrcpy lets you not only mirror but also control your device directly from your computer, and works with Linux, Windows, and macOS. The tool connects your phone with your computer using the Android Debug Bridge (ADB) and streams what is happening on your phone using the screen-casting capabilities built into Android. Once your device is connected, Scrcpy lets you interact with your phone using your computer's keyboard and mouse/touchpad.
While there are other Android screen-mirroring tools that offer similar functionality, usually they are not free to use. Additionally, there may be restrictions on the screen mirroring quality as well as some delay. All these issues are absent with Scrcpy, which is why it is the best option for this job. Plus, unlike many other similar tools, Scrcpy is non-intrusive, which means you do not need to install any apps on your phone or third-party extensions on your computer.
Step 1: Enable USB Debugging on your Android
Before you can install Scrcpy on your computer and start using it, you need to enable USB Debugging on your Android device.
- Open the Settings app on your Android device and tap on 'About Phone'. It may be present within the 'System' section, depending on your device.
- On the 'About Phone' page, look for the 'Build number' option. Once you find it, tap on it seven times. On Xiaomi devices, you will need to tap on the 'MIUI version' option and you will see the notification 'You are now a developer'. This means you can now access Developer Options on your device, which are required for enabling USB Debugging.
- After enabling the Developer Options on your device, go back and tap on 'System' or 'Additional Settings'.
- Then tap on 'Developer Options'.
- Within Developer Options, tap on 'USB Debugging' to turn it on. Your device should display a security warning when you do so.
Step 2. Install Scrcpy on your Linux computer
- On your Linux computer, open the terminal and type the command for your respective distro from the ones listed here.
- Arch and its derivatives:
pacman -S scrcpy
- Fedora:
dnf copr enable zeno/scrcpy && dnf install scrcpy
- Gentoo Linux:
emerge scrcpy
- Ubuntu/Debian distros:
snap install scrcpy
- If you do not wish to install Snap on your Ubuntu or Debian-based system, avoid using the official APT package as it is quite old. Instead, first, update your system using the
sudo apt update
command.
- Now, type the following commands one by one, pressing 'Enter' after each one to install the required dependencies:
sudo apt install ffmpeg libsdl2-2.0-0 adb wget \
gcc git pkg-config meson ninja-build libsdl2-dev \
libavcodec-dev libavdevice-dev libavformat-dev libavutil-dev \
libswresample-dev libusb-1.0-0 libusb-1.0-0-dev
- Next, use the following commands to clone the GitHub repo of the dependencies before running the installation script using the following commands:
git clone https://github.com/Genymobile/scrcpy
cd scrcpy
./install_release.sh
- After installing Scrcpy, check the version using the
scrcpy --version
.
git pull
followed by ./install_release.sh
.Step 3: Mirror your Android device on Linux
- Check that you have enabled USB debugging on your Android device as explained in the first step. Then connect it to your Linux computer using a USB cable. If you're running Linux in a virtual machine using a tool like VirtualBox, click on 'Devices' and then 'USB'. Click on the name of your device to enable it.
- Then type
adb devices
in the terminal to confirm that your Android device is connected. - When you see your device connect, type
scrcpy
in the terminal and press 'Enter' to start mirroring it on your Linux computer. You can control your Android device using your computer's mouse and keyboard. Clicking on an app icon will launch that app while right-clicking functions as the back button on Android. Similarly, to go to the home screen, use the middle-click.
When multiple Android devices are connected
You can also inform your system which Android device to mirror if you have connected more than one of them.
- Use the
scrcpy --serial=example_serial_number
command, replacing 'serial number' with the serial number of the Android device you want to mirror. - If you have multiple devices connected to your computer but only one connected via USB, use the
scrcpy --select-usb
to mirror the device connected via USB. - When several devices are connected but only one is connected via TCP/IP, use
scrcpy --select-tcpip
to mirror the one connected in this manner. - If your Android phone is listening on TCP/IP, you can use its IP address as an argument with the command
scrcpy --tcpip=192.168.1.1:5555
.
Mirroring your Android on Linux wirelessly
To mirror your Android phone wirelessly on your Linux machine, first, make sure both devices are connected to the same network.
- Connect your Android phone to your Linux computer using a USB cable and then run the command
adb devices
to confirm that it is being recognized.
- Type
adb tcpip 5555
in the terminal window and press Enter to turn on wireless debugging on your Android phone.
- Now, disconnect the USB cable from your Android device and look for the IP address of your Android device in the 'About Phone' section in the Settings app.
- Once you find the IP address, use the
adb connect ip.address.of.phone:5555
command, replacing the IP address section with the IP address of your device in the terminal before pressing Enter.
- Then type
scrcpy
in the terminal window and press Enter again to start mirroring your Android phone.
Things to know
- Scrcpy does not just let you mirror your phone screen on your Linux computer; you can even control the quality of the stream and change aspects like the frame rate, codec, bit rate, and screen size.
- You can also mirror your phone's camera instead of its screen using the
scrcpy --video-source=camera
command. When you mirror the camera, the audio from your phone's microphone will play from your desktop. - Similarly, when you mirror your Android device on your Linux computer, the audio from your phone will play from your computer by default. You can switch the audio source using the
scrcpy --audio-source=mic # or --audio-source=output
andscrcpy --video-source=camera --no-audio # audio isn't forwarded
commands. - Use
scrcpy --record=file.mp4
,scrcpy --no-audio --record=file.mp4 # to only record the video
, andscrcpy --no-video --audio-codec=raw --record=file.wav # to only record the audio
commands to record the audio and video that you are mirroring. - Scrcpy also lets you create multiple displays for showing different things, such as different apps as well as the home screen of your Android phone. For instance, if you are playing a video in VLC on your Android device, use the
scrcpy --new-display=1920x1080 --start-app=org.videolan.vlc
command to create a separate display for the player which will be distinct from the main display being mirrored. - Other third-party tools like AirDroid also let you mirror your Android phone on your Linux computer, but Scrcpy being completely free and open-source is the best option.
Member discussion