Using Scrcpy to Mirror and Control Android on Linux

Are you looking to mirror and control your Android device? Scrcpy is a powerful tool that can help you do just that with ease. Using Scrcpy to Mirror and Control Android on Linux. Whether you’re a developer testing apps or just someone wanting to access your phone from your computer, Scrcpy offers a seamless experience.


Scrcpy (pronounced Screen Copy) is an open-source app. It lets you control and mirror your Android device on Linux. You can connect your Android via USB cable or wirelessly.


Use your keyboard and mouse to control it. Here we show you how to control your Android device on Linux using Scrcpy.


Using Scrcpy to Mirror and Control Android on Linux




What is Scrcpy?

Scrcpy, short for Screen Copy, is a free and open-source app. It lets you mirror and control your Android device from your computer. It offers high performance and low latency, which developers and tech enthusiasts love. Scrcpy works on Linux, Windows, and macOS, making it useful on different platforms.



Why You Need Scrcpy on Linux

You might wonder why you need Scrcpy for your Linux system when there are many screen-sharing and Android mirroring apps available. The answer is simple: Scrcpy doesn’t need any app installed on your phone or root access.


It’s an open-source, lightweight, and high-performance command-line tool. This makes it perfect for mirroring and controlling your Android device on Linux, with the added benefit of scripting and customization freedom.


Additionally, Scrcpy lets you record your Android screen video and audio with various customization options like bitrate and resolution. This feature is great for creating tutorials or capturing gameplay.

Scrcpy stands out for several reasons:

Performance: It delivers high framerates and low latency.

Flexibility: Works with both USB and wireless connections.

Open Source: Free to use and continually updated by the community.

Lightweight: Minimal impact on system resources.

Whether you’re a developer testing apps or someone who wants to manage their Android device more efficiently, Scrcpy is an excellent tool to have.



Here are some of the best features of Scrcpy that make it stand out:

  • No internet connection or user account needed
  • Screen recording capability
  • High-quality mirroring (1920×1080 or higher) with low latency (35~70ms)
  • Supports audio forwarding (Android 11+)
  • Bi-directional clipboard support
  • OpenGL and OTG mode compatibility
  • Mirroring Android as a webcam
  • Camera mirroring (Android 12+)
  • Works on Linux, Windows, and macOS
  • Simulates physical keyboard and mouse input
  • Operates even when the device screen is off
  • Allows cropping of the mirrored Android screen
  • Supports simultaneous mirroring of multiple devices

Scrcpy also includes many other interesting features that you can discover by exploring this utility.




Prerequisites for Using Scrcpy

Before you can start using Scrcpy, ensure you have the following:

  • A Linux computer with administrative access.
  • An Android device running version 5.0 (Lollipop) or higher.
  • A USB cable for initial setup (wireless connections are also supported).
  • ADB (Android Debug Bridge) installed on your Linux system.



MUST READ:




Installing Scrcpy on Linux

STEP1: Before installing Scrcpy, ensure you have adb (Android Debug Bridge) installed on your system. Use the appropriate command based on your distribution:


For Debian-based systems (like Ubuntu):

sudo apt install adb

For Fedora-based systems:

sudo yum install adb

For Arch-based systems:

sudo pacman -S android-tools

Having adb installed is necessary to use Scrcpy for mirroring and controlling your Android device from your computer.



STEP2: After installing adb, proceed to install the stable version of Scrcpy using one of the following commands, depending on your Linux distribution:

For Debian-based systems (like Ubuntu):

sudo apt install scrcpy

For Fedora-based systems:

sudo dnf copr enable zeno/scrcpy && sudo dnf install scrcpy

For Arch-based systems:

sudo pacman -S scrcpy

These commands will install the stable version of Scrcpy, allowing you to mirror and control your Android device from your Linux computer.



STEP3: Once you’ve successfully installed Scrcpy, you can verify its version by running the following command:

scrcpy -v

This command will display the version of Scrcpy installed on your system.




To install the latest version of Scrcpy, which includes features like audio forwarding and camera mirroring, follow these steps using its source code:

STEP1: First, ensure your system has all the necessary dependencies installed. Use the following commands for Debian-based systems (like Ubuntu):

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


STEP2: Next, clone the Scrcpy repository from GitHub:

git clone https://github.com/Genymobile/scrcpy


STEP3: Navigate to the cloned directory:

cd scrcpy


STEP4: Run the installation script to build and install Scrcpy:

./install_release.sh


STEP5: This will install the latest version of Scrcpy on your Linux system. To verify the installation and check the version, use the following command:

scrcpy -v


Now you’re ready to connect and control your Android device via USB or wirelessly using the updated features of Scrcpy.




Connecting to Your Android via USB Cable


To connect your Android device to your Linux system via USB cable, follow these steps:

STEP1: Enable Developer Options and USB Debugging:

  • Go to your device Settings -> System.
  • Open the “About phone” section.
  • Tap on the “Build number” multiple times until you see a message saying “You are a developer”.
  • Go back to System settings, where you will now see “Developer options”.
  • Enter “Developer options” and enable the “USB debugging” option.
  • You will receive a prompt confirming your choice; tap “OK” to proceed.


STEP2: Connect Your Phone to Linux:

  • Now, connect your Android phone to your Linux system using a USB cable.
  • Upon connecting, you will see a notification on your Android device indicating that USB debugging mode is active.

By following these steps, you can successfully connect your Android device to your Linux computer via USB cable and begin using Scrcpy or other tools for mirroring and controlling your device.


STEP3: Mirror Your Phone:

Next, open the terminal on your Linux system and execute the following command to mirror your Android device:

scrcpy


This command will start the Scrcpy application, allowing you to mirror and control your Android device directly from your Linux computer. Make sure your Android device is connected via USB and USB debugging is enabled as previously instructed.



To disconnect your phone, simply press the Ctrl + C keys in the terminal where scrcpy is running. This will stop the mirroring session.



Connecting to Your Android via Wireless Connection

To connect your Android device to your Linux system wirelessly, follow these steps:

STEP1: Initial Setup via USB:

  • Connect your Android phone to Linux using a USB cable.
  • Open a terminal and execute the following command to ensure Linux recognizes your Android device:
    adb devices
  • Additionally, find out the IP address of your Android device using:
    adb shell ip route
  • Make a note of the IP address displayed.

STEP2: Prepare for Wireless Connection:

  • Both your Linux computer and Android device must be connected to the same Wi-Fi network.

STEP3: Configure TCP/IP Connection:

  • Set a TCP/IP port for the wireless connection. For example, configure it to port 5000:
    adb tcpip 5000
  • Note that you can choose any available port number.

STEP4: Disconnect USB and Connect Wirelessly:

  • Disconnect your phone from the USB cable.
  • Establish a wireless connection to your Android device from your Linux system using its IP address and the configured port (5000 in this example):
    sudo adb connect 192.168.1.121:5000
  • If you have multiple devices connected, specify the serial number of your Android device instead:
    scrcpy -S <serial-number>



STEP5: Mirror and Control Your Android:

  • Once connected wirelessly, open a terminal on Linux and execute the command:
    scrcpy
  • This will start mirroring your Android screen on your Linux system.



Using Scrcpy to Mirror and Control Android on Linux





STEP6: Disconnect the Wireless Connection:

  • To end the connection, simply press Ctrl + C in the terminal where scrcpy is running.

By following these steps, you can mirror and control your Android device from your Linux computer using a wireless connection.




Some Scrcpy Usage Examples

Here are various examples demonstrating how to use the Scrcpy command effectively:

1. Change Window Title:

Change the title of the window displaying your Android device:

   scrcpy --window-title='MyTeachWorld.Com'


2. Record Android Screen:

Record the screen of your Android device and save it to a file named “myteachworld.mp4”:

   scrcpy --record myteachworld.mp4


Record the screen without displaying it on Linux, saving to a file named “MTW.mp4”:

   scrcpy -Nr MTW.mp4


4. Customize Window Screen:

Set the maximum size (width and height) of the window:

   scrcpy -m 950



5. Read-Only Mode:

View your Android screen without controlling it:

   scrcpy --no-control


6. Limit Screen Capture Framerate:

Limit the framerate of screen capture to 50 frames per second:

   scrcpy --max-fps=50



7. Show Touches:

Display physical touches on the Android device in real-time on Linux:

   scrcpy --show-touches



8. Lock Device Screen:

Lock the Android device screen while still maintaining control:

   scrcpy -S



9. Set Initial Display Rotation:

Set the initial display rotation of the mirrored Android screen (0, 1, 2, or 3 for 0°, 90°, 180°, or 270° counterclockwise rotation):

   scrcpy --rotation=3



Scrcpy offers a wide range of options like these that you can explore and experiment with to suit your needs for mirroring and controlling your Android device on Linux.




Removing Scrcpy from Linux

Here are the commands to uninstall Scrcpy from your Linux system based on your installation method:

For Debian-based systems (like Ubuntu):

sudo apt remove scrcpy


For Fedora-based systems:

sudo dnf remove scrcpy


For Arch-based systems:

sudo pacman -R scrcpy


If installed via Snap:

sudo snap remove scrcpy


If you installed the latest version from source code using Ninja:

sudo ninja -Cbuild-auto uninstall


Executing these commands will successfully remove Scrcpy from your Linux system. If you prefer, you can explore other Android mirroring apps to control your device from Linux.





Troubleshooting Common Issues

Device Not Detected: Ensure USB debugging is enabled and the device is connected properly.


Connection Drops: Check your USB cable for faults or try a different one. For wireless connections, ensure a stable Wi-Fi signal.


Low Performance: Adjust the resolution and bitrate settings to find a balance between performance and quality.





Security Considerations

When using Scrcpy, particularly over wireless connections, it’s crucial to prioritize security. Ensure that your devices are connected to a secure network and avoid using public Wi-Fi for sensitive operations to prevent unauthorized access.


Alternatives to Scrcpy

While Scrcpy is a powerful tool, there are alternative options you can consider:


1. Vysor


Vysor is a tool that allows you to mirror and control your Android device from your computer. It offers a user-friendly interface and functionality similar to Scrcpy.

Vysor is a tool that allows you to mirror and control your Android device from your computer.




You can use Vysor to interact with your Android device directly on your computer screen, making it convenient for tasks like testing apps, managing files, and accessing notifications.



2. AirDroid

AirDroid is a versatile application that provides extensive features beyond basic Android mirroring. It allows users to manage their Android devices remotely from a computer or another mobile device.

AirDroid is a versatile application that provides extensive features beyond basic Android mirroring.





Some key features of AirDroid include file transfer between devices, remote access to messages, calls, and notifications, as well as the ability to locate a lost device and remotely wipe its data if necessary.


It offers a comprehensive solution for users who need more than just screen mirroring, enabling seamless integration and management of Android devices across different platforms.



Explore these alternatives based on your specific needs and preferences for controlling your Android device from your Linux system.




Wrap-Up On Using Scrcpy to Mirror and Control Android on Linux

Scrcpy is a powerful tool that bridges the gap between your Android device and Linux computer, offering a seamless experience for mirroring and controlling your device.


Whether you’re a developer or just looking to simplify your device management, Scrcpy provides a versatile and efficient solution.


It seamlessly integrates both USB and wireless connections, offering high-performance screen mirroring and device control with minimal latency.


Whether you’re a developer testing applications or a user looking to streamline device management, Scrcpy’s open-source nature and robust features, such as customizable resolutions, recording capabilities, and cross-platform compatibility, make it a standout choice.


While prioritizing security measures, such as using it on secure networks, Scrcpy enhances productivity and user experience.

I hope you’ve found the methods and information shared in this post to be helpful.




FAQs: Using Scrcpy to Mirror and Control Android on Linux

Q1. Can I use Scrcpy with a wireless connection?

Yes, Scrcpy supports wireless connections. You need to initially connect via USB to set up the wireless connection.

Q2. Is Scrcpy safe to use?

Yes, Scrcpy is an open-source project with a strong focus on security. However, always use it on secure networks to avoid potential risks.

Q3. What operating systems are compatible with Scrcpy?

Scrcpy works on Linux, Windows, and macOS.

Q4. Can I control multiple devices with Scrcpy?

Yes, you can run multiple instances of Scrcpy to control multiple devices simultaneously.



Q5. Does Scrcpy support audio transmission?

Currently, Scrcpy does not support audio transmission. It only mirrors the screen and allows control of the device.

Leave a Comment