Scrcpy (pronounced “screen copy”) is a free and open source cross-platform application used to display and control an Android device from a Linux desktop. It works on Linux, Windows and macOS and allows you to control a device connected via USB or wirelessly (via TCP/IP).
It includes screen-off mirroring of an Android device, customizable screen display quality, recording, copying and pasting in both directions, using an Android device as a webcam (Linux only), physical keyboard and mouse simulation, OTG mode, and more.
To use scrcpy, your Android device must have at least API 21 (Android 5.0) installed and adb (Android Debug Bridge) debugging (USB debugging) must be enabled. But this does not require user root access in Linux.
Install Scrcpy on Linux Systems
On Debian based distributions such as Ubuntu and Linux Mint systems, you can install scrcpy from the default repository as shown below.
$ sudo apt install scrcpy
On Fedora, you can install it from the Cool Other Packages (COPR) repository like this:
$ sudo dnf copr enable zeno/scrcpy $ sudo dnf install scrcpy
On Arch Linux, enter the following command:
# pacman -S scrcpy
Scrcpy is also available as a snap, for example, to install it on RHEL-based distributions, run the following commands:
$ sudo yum install snapd $ sudo systemctl enable --now snapd.socket $ sudo ln -s /var/lib/snapd/snap /snap $ sudo snap install scrcpy
Connecting to an Android device via USB in Linux
Once the installation is complete, don’t forget to enable USB debugging on your Android device (go to Settings => Developer -> Options => USB Debugging) as mentioned earlier and then connect your device to your desktop computer with Linux via USB cable.
Then a pop-up window should open on the device asking you to authorize to allow USB debugging from your computer and select “Allow” to continue.
Then run the following command from a terminal to run scrcpy:
If the command is successful, a window with your device’s active screen should open, as shown in the following screenshot.
Connect to Android device via Wi-Fi on Linux desktop
First, install the adb command line tool on your computer as follows. If you already have the adb tool installed, skip the installation steps:
$ sudo apt install adb [On Debian, Ubuntu and Mint] $ sudo yum install adb [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux] $ sudo pacman -S adb [On Arch Linux]
After installing the adb tool on your computer, connect your Android device and computer to a shared Wi-Fi network. Then connect your Android device to your computer with a USB cable.
Then unplug the USB cable from the target device and find the IP address of the Android device (go to Settings -> Connections -> Wi-Fi -> Wi-Fi Name -> click on its settings) or do the following command to view the device’s IP address:
$ adb shell ip route
Then configure the target Android device to listen on a TCP/IP connection on port 5555 by running the following command (check any prompt on the device):
$ adb tcpip 5555
Then disconnect the USB cable and connect the target device using its IP address as shown below:
$ adb connect 192.168.1.4:5555
Last but not least, run the scrcpy command to mirror the screen of an Android device to a Linux desktop:
Scrcpy command examples with parameters
You can see from the previous screenshots that by default scrcpy displays the device model as the window title. You can set a custom window title using the –window-title command line option, as shown (don’t forget to replace “My Device” with the title you prefer):
$ scrcpy --window-title="My device"
To control the width and height of the Android mirror screen, use the –max-size or -m switch, as shown below:
$ scrcpy -m 1024OR$ scrcpy --max-size=1024
Scrcpy also allows screen recording during mirroring using the –record or -r flag, as shown below:
$ scrcpy -r filename.mp4
If you want to disable mirroring while writing, use the –no-display or -N flag as follows. Note that to stop the recording process, just press Ctrl+C:
$ scrcpy -Nr filename.mp4
To change the default baud rate of 8 Mbps, use the –bit-rate or -b option as shown below:
$ scrcpy -b 4M
There are several other command line options to control the behavior of scrcpy. Run the following command to see a list of them:
$ scrcpy --help
Last but not least, in order to control some Android devices using the keyboard and mouse, you need to enable additional options. For more information go to the repository scrcpy Github.
2580700cookie-checkScrcpy – Display and control your Android device through the Linux desktop
Comments: 0Publications: 74Registration: 22-11-2021
#Scrcpy #Display #control #Android #device #Linux #desktop
❤ XOXO ❤