Android device screen sharing and control from your desktop

Fun with scrcpy

The notes on the scrcpy page are good so the info below is some of my notes and info from the official scrcpy page

There are 2 components: the client and the server. On Linux you need to build the client on most distro's. The server (a jar file) can be downloaded. There is also a package for Windows.

Build the client

First install the prerequisites (not java since we don't want to build the server) Install the runtime dependencies:

sudo apt install ffmpeg libsdl2-2.0.0

Install the client build dependencies:

sudo apt install make gcc pkg-config meson ninja-build \
         libavcodec-dev libavformat-dev libavutil-dev libsdl2-dev

The tool uses the adb tool from the Android SDK. No need to install the full Android SDK to build the client. Install the android tools:

apt-get install android-tools-adb android-tools-fastboot

Since we don't build the server, download the server:


Now create a folder and get the code. If you don't have git, install it.:

git clone
cd scrcpy

Build the client. Use the full path to the server jar we downloaded previously:

meson x --buildtype release --strip -Db_lto=true \
cd x
sudo ninja install

If you specify the wrong path to the server jar, you will get a warning.


Configuring config.h using configuration
WARNING: Custom target input '/home/user/projects/scrcpy/scrcpy-server-v1.8.jar' can't be converted to File object(s).
This will become a hard error in the future.

If you get an error during the install, check if the files (the client and the server) are copied to the locations below. If not, copy them there manually.

If you want to build your server, look at the bottom part and then try to build the client again as you will need to specify the path to the server you built.

If build fails, remove the x folder and start from the meson line again.

The client is installed at /usr/local/bin/scrcpy The server is installed at /usr/local/share/scrcpy/scrcpy-server.jar

Build the server

I haven't tried this yet, but here are the short instructions. You should first try to download it before trying to build it.

Install the build tools:

# server build dependencies
sudo apt install openjdk-8-jdk

Install the android sdk.

Set the android home:

export ANDROID_HOME=~/android/sdk

Build the server:

git clone
cd scrcpy

meson x --buildtype release --strip -Db_lto=true
cd x

Run Forrest scrcpy

Connect your phone to the computer via USB.

Set the developer mode active on your phone. Also, activate USB error detection. I have set the USB configuration to MTP. Not sure that's needed but it seemed like the charge mode didn't give me the authentication message. Run adb first to check the device. You can run the scrcpy command also to see if it starts, if not, check this part.:

adb devices

List of devices attached
ZY1312PV42S no permissions (verify udev rules);

The warning links to Make sure you are in the plugdev group:

sudo usermod -aG plugdev <username>

I had to set the usb mode to MTP and reset the adb server to authorize the connection on the device:

adb kill-server
adb devices

List of devices attached
ZY1312PV42S device

If you find your device, and you don't get warnings, run scrcpy:


It accepts command-line arguments, listed by:

scrcpy --help

This is what it looks on my computer:

Phone image

Wireless connection

scrcpy uses adb to communicate with the device, and adb can connect to a device over TCP/IP. You first need to connect your phone and computer to the same wireless netwerk. Then, get your device IP address: in Settings > About phone > Status or something similar.

Enable adb over TCP/IP on your device. You will receive an authentication message on the phone. Do this while the phone is still connected via USB cable.:

adb tcpip 5555

Now you can unplug your device and connect to your device. Replace <phone ip> with the ip of your phone.:

adb connect <phone ip>:5555

Run scrcpy as usual. It may be useful to decrease the bit-rate and the definition:

scrcpy --bit-rate 2M --max-size 800
scrcpy -b2M -m800  # short version

In my test, I saw a slight performance drop when running over a wireless connection. With the above adjustments, performance was way better.

Record the screen

It is possible to record the screen while mirroring:

scrcpy --record file.mp4
scrcpy -r file.mkv

To disable mirroring while recording:

scrcpy --no-display --record file.mp4
scrcpy -Nr file.mkv

# interrupt recording with Ctrl+C
# Ctrl+C does not terminate properly on Windows, so disconnect the device

Other niceties

To show the touches on the screen:

scrcpy --show-touches

To start scrcpy always on top:

scrcpy --always-on-top


scrcpy --fullscreen

Change bitrate:

scrcpy --bit-rate 2M

The device screen may be cropped to mirror only part of the screen.:

scrcpy --crop 1224:1440:0:0

To copy a file to the device, drag a file onto the scrcpy window. You should see the console for the information on that. On my device, the file was pushed to the internal storage root /sdcard.

To install an APK file, also just drag and drop it on the scrcpy window.


scrcpy is a very nice piece of software with a lot of great options.

Thanks to the author!