Scrcpy Open Source Software Let You Control an Android Phone via a Windows, Mac OS, or Linux PC

Have you ever wished you could control or mirror your Android smartphone using your computer? Scrcpy, a free and open source program by Genymotion may fit your needs, and works on Windows, Mac OS or Linux. You just need to install (or build) a program on your host computer, connect your phone via USB, switch to developer mode, enable USB debugging, and run the program which will automatically install the server (a jar file) on your phone, which does not need to be rooted.

The easiest way to try is with Windows since the developers already provide pre-built binaries, but I installed it on Ubuntu 16.04 instead since it is the operating system I use daily. Some of the packages in Ubuntu 16.04 are a bit old so it took me a couple of hours to successfully install it, and I’d recommend going with Ubuntu 17.10 or 18.04 daily build if you can.

First let’s create a working directory, and retrieve the source code


We also need to install some dependencies to run (first line) and build (second) the program:


The original instructions for Debian also list meson and libsdl2-dev, but Meson 0.29 is installed in Ubuntu 16.04, and we need version 0.37 or greater. So I used pip to install the most recent version (0.45):


libsdl2-dev refused to install too, and I had to enable xenial-proposed in /etc/apt/sources.list:


before installing it:


Those two problems should not occur in more recent versions of Ubuntu.

We are also supposed to install the Android SDK, but it’s only if you plan to build the server part, and it’s optional. I leave the steps I followed, but feel free to skip that part.

Download, install, and launch Android Studio:


Download the latest Android SDK in the Android Studio SDK, and accept the license agreement.
That’s the important bit, or the build will fail. However in my case, it still failed… as there’s a mismatch between the expect version (26.0.2) and my version (26.1.1).

You have not accepted the license agreements of the following SDK components:
[Android SDK Build-Tools 26.0.2, Android SDK Platform 27].

I have not looked into a fix that long, once I realized there was a prebuilt server (the binary that needs to be copied to the phone), and only built the Linux app:


scrcpy should be installed in your path now. Make sure your phone is connected over adb, and USB debugging is enabled in your phone in the Developer Options.

You may now optionally want to open a terminal to check your phone is detected:


Time to start the program, simply type:


Within a few second you should see your phone display appear on your desktop… 🙂

Click to Enlarge

You can control the display with your mouse and keyboard, and the window is fairly responsive, although not always extra smooth at all time. This may vary with the phone and computer used. It also a way to mirror your phone on a large screen using the touchscreen for control. Apart from applications or actions requiring multi-touch, I could do anything I want to the mouse and keyboard, send SMS, chat, browser the web, play games, etc…

Click to Enlarge

Landscape mode is also working, and the window will automatically switch following your phone’s orientation.

Click to Enlarge

The window can also be maximized. Not quite full size, but close to it… Audio is still going through the phone speakers.

There are no software button for Home, Back, and App Switch, so you may want to learn a few screenshot to fully utilize the capabilities of the program:

switch fullscreen mode Ctrl+f
resize window to 1:1 (pixel-perfect) Ctrl+g
resize window to remove black borders Ctrl+x
click on HOME Ctrl+h
click on BACK Ctrl+b
click on APP_SWITCH Ctrl+m
click on VOLUME_UP Ctrl++
click on VOLUME_DOWN Ctrl+-
click on POWER Ctrl+p
turn screen on Right-click
paste computer clipboard to device Ctrl+v
enable/disable FPS counter (on stdout) Ctrl+i

FPS Counter? Interesting. I enabled it while panning and zoom-in and out in MAPS.ME app.

Click to Enlarge

The frame rate dropped to around 30 fps with some frames skipped from time to time, so not perfectly, but still not too bad. Give it a try!

Via Liliputing and Reddit

8
Leave a Reply

avatar
8 Comment threads
0 Thread replies
4 Followers
 
Most reacted comment
Hottest comment thread
6 Comment authors
Josep Pujadas-JubanycnxsoftfossxplorerSfinxStane1983 Recent comment authors
  Subscribe  
newest oldest most voted
Notify of
frostwork
Guest
frostwork

wow, thanks for posting, didn’t know that program.
it’s currently segfaulting here after some seconds, but anyway very promising!

Stane1983
Member

If device is rooted, usb debugging enabled (that’s mandatory for Lollipop and newer I think) and you use some app like WiFi ADB (https://play.google.com/store/apps/details?id=com.ttxapps.wifiadb) I assume it could work over wifi/ethernet.

In that scenario it should work with:
adb connect
scrcpy

Sfinx
Guest
Sfinx

@Stane1983

No, it do not works over wifi-adb, prints: ‘error more than once device/emulator”, ERROR: “adb reverse” returned with value 1’. All is ok over cable even youtube.

Sfinx
Guest
Sfinx

And no UTF8 input – unusable for me because of this

fossxplorer
Guest
fossxplorer

@Sfinx
File an issue on their issue tracker or even better create a pull request (PR). Rebember it’s Open Source Software 🙂

fossxplorer
Guest
fossxplorer

@Sfinx
File an issue on their issue tracker or even better create a pull request (PR). Remember it’s Open Source Software 🙂

Josep Pujadas-Jubany
Guest

After installing scrcpy on two Ubuntu 16.04 (64 bit) I tried to simplify the (installation) process in order to deploy scrcpy on many machines at job.

Using the scrcpy and scrcpy-server.jar generated binaries I done:

sudo cp -p scrcpy /usr/local/bin/.
sudo chmod 755 /usr/local/bin/scrcpy
sudo chown root:root /usr/local/bin/scrcpy

sudo mkdir /usr/local/share/scrcpy
sudo chmod 755 /usr/local/share/scrcpy
sudo chown root:root /usr/local/share/scrcpy
sudo cp -p scrcpy-server.jar /usr/local/share/scrcpy/.
sudo chmod 644 /usr/local/share/scrcpy/scrcpy-server.jar
sudo chown root:root /usr/local/share/scrcpy/scrcpy-server.jar

And I installed also the adb (Android Device Bridge) Ubuntu package:

sudo apt-get update
sudo apt-get install adb

I put these steps on a script and that’s all!

It seems that our computers have the necessary dependencies and we don’t need more packages (using the generated binaries from a first installation on another computer):

objdump -p /usr/local/bin/scrcpy | grep NEEDED
NEEDED libc.so.6
NEEDED libavformat-ffmpeg.so.56
NEEDED libavcodec-ffmpeg.so.56
NEEDED libavutil-ffmpeg.so.54
NEEDED libSDL2-2.0.so.