Control your Android devices with scrcpy

1 minute read

scrcpy is an open source project developed by Genymobile, it can be used to display and control of your android devices over adb connection. The following features draw my attention:

  • low latency (35~70ms)
  • low startup time (~1 sec to display the first image)
  • copy text from host computer to device
  • drag and drop to install apk
  • screen recording

Installation

For macOS

It is easy to setup on macOS with just one command:

brew install scrcpy

This will install lots of dependencies, so you need to wait for a while, then issue scrcpy to connect to your android system.

For Ubuntu system

For ubuntu, build from source is required, a few packages needs to be installed before downloading source code:

sudo apt install ffmpeg libsdl2-2.0-0 -y
sudo apt install -y gcc git pkg-config meson ninja-build \
                 libavcodec-dev libavformat-dev libavutil-dev \
                 libsdl2-dev

sudo apt install python3-pip -y
pip3 install --user meson

Now, time for build scrcpy:

git clone --depth=1 https://github.com/Genymobile/scrcpy
cd scrcpy

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

Usage

See help for a full list of options and shortcut keys that supported by scrcpy.

Connect and Display

scrcpy
scrcpy -m 1024
scrcpy -m 1024 -s 192.168.123.182:5555
scrcpy -m 1024 --window-title pie

Shortcut Keys

Shortcuts Function
CMD + F switch fullscreen mode
CTRL + H HOME
CMD + ↑ VOLUME_UP
CMD + ↓ VOLUME_DOWN
CMD + p POWER

Recording

Another interesting feature is to record the screen, but I cannot get it working when playing video, it currently support mkv and mp4 format.

scrcpy -m 1024 -r test.mp4
scrcpy -m 1024 -r test.mp4 -N    # Do not display
scrcpy -m 1024 -r test.mkv
scrcpy -m 1024 -r test.mkv -N    # Do not display

Audio forward

If you need to forward audio to your computer, head to this project.