Mobile Development 16 min read

Mirror Your Android Phone to Ubuntu with Scrcpy – Complete Step‑by‑Step Guide

This article explains how to use the open‑source Scrcpy tool to mirror an Android device onto an Ubuntu system, covering installation, required Android version, USB and wireless connections, screen configuration, recording, window options, input control, and file transfer commands.

Open Source Linux
Open Source Linux
Open Source Linux
Mirror Your Android Phone to Ubuntu with Scrcpy – Complete Step‑by‑Step Guide

Scrcpy Overview

Scrcpy is a free, open‑source command‑line utility that lets you control an Android device from a computer via ADB or a USB cable, supporting mouse, keyboard, and clipboard synchronization without requiring root access.

Main Features

Free and open source

No root required

Runs on Linux, Windows, and macOS

Clipboard sharing

Lightweight (native display only)

30‑60 fps performance

Up to 1920×1080 resolution or higher

35‑70 ms latency

Fast start‑up (seconds)

Non‑intrusive (no app needed on the device)

Requirements

Android 5.0 (API 21) or newer

ADB debugging enabled on the device

Optional: additional options for mouse/keyboard control on some devices

Installing Scrcpy on Ubuntu

From the default repository: sudo apt-get install scrcpy Or compile from source (install dependencies first):

# runtime dependencies
sudo apt install ffmpeg libsdl2-2.0-0 adb

# client build dependencies
sudo apt install gcc git pkg-config meson ninja-build \
    libavcodec-dev libavformat-dev libavutil-dev \
    libsdl2-dev

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

Running Scrcpy

Connect the device via USB and execute: scrcpy Show all command‑line options:

scrcpy --help

Screen Settings

1. Resolution

Limit the displayed size (e.g., max 1024 px):

scrcpy --max-size 1024
scrcpy -m 1024  # short version

2. Bit‑rate

Default is 8 Mbps; change to 2 Mbps:

scrcpy --bit-rate 2M
scrcpy -b 2M  # short version

3. Frame Rate

Cap FPS (e.g., 15 fps):

scrcpy --max-fps 15

4. Cropping

Show only a portion of the screen:

scrcpy --crop 1224:1440:0:0

5. Lock Video Orientation

scrcpy --lock-video-orientation 0   # natural
scrcpy --lock-video-orientation 1   # 90° CCW
scrcpy --lock-video-orientation 2   # 180°
scrcpy --lock-video-orientation 3   # 90° CW

Screen Recording

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

Record without displaying:

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

Connection Methods

Wireless (TCP/IP)

Connect device and PC to the same Wi‑Fi network.

Find the device IP (Settings → About phone → Status).

Enable TCP/IP on the device: adb tcpip 5555 Disconnect USB.

Connect from PC: adb connect DEVICE_IP:5555 Run scrcpy.

Multiple Devices

Specify the serial number:

scrcpy --serial 0123456789abcdef
scrcpy -s 0123456789abcdef

For TCP/IP devices, use the IP address in the same way.

Auto‑start on Device Connection

autoadb scrcpy -s '{}'

SSH Forwarding

adb kill-server
ssh -CN -L5037:localhost:5037 -R27183:localhost:27183 your_remote_computer
# keep this window open
scrcpy

Window Settings

Title: scrcpy --window-title 'My device' Position & size:

scrcpy --window-x 100 --window-y 100 --window-width 800 --window-height 600

Borderless: scrcpy --window-borderless Always on top: scrcpy --always-on-top Fullscreen: scrcpy --fullscreen or scrcpy -f Rotate window: scrcpy --rotation 1 (values 0‑3)

Other Display Options

Read‑only (disable control): scrcpy --no-control or scrcpy -n Select display (for multiple monitors): scrcpy --display 1 Keep device awake: scrcpy --stay-awake or scrcpy -w Turn device screen off: scrcpy --turn-screen-off or scrcpy -S Render expired frames (disable frame skipping): scrcpy --render-expired-frames Show touches: scrcpy --show-touches or scrcpy -t Disable screensaver:

scrcpy --disable-screensaver

Input Control

Rotate device screen with MOD+r.

Clipboard sync works automatically; standard Ctrl+C/X/V are forwarded.

Inject copy/paste via MOD keys: MOD+c, MOD+x, MOD+v.

Pinch‑zoom: hold Ctrl and drag mouse.

Prefer text input (use text events): scrcpy --prefer-text.

Disable key repeat: scrcpy --no-key-repeat.

File Transfer

Install an APK by dragging the .apk file onto the Scrcpy window.

Push other files to /sdcard/ by dragging them onto the window.

Change target directory:

scrcpy --push-target /sdcard/foo/bar/

Hotkeys

Default modifier is left Alt or left Super (Windows/Cmd). Change with --shortcut-mod (e.g., scrcpy --shortcut-mod=rctrl).

Custom ADB Path

Set the ADB executable via environment variable: ADB=/path/to/adb scrcpy Override the Scrcpy server path with SCRCPY_SERVER_PATH if needed.

Source

Source: 一口Linux
Scrcpy control example
Scrcpy control example
AndroidADBscrcpyScreen mirroring
Open Source Linux
Written by

Open Source Linux

Focused on sharing Linux/Unix content, covering fundamentals, system development, network programming, automation/operations, cloud computing, and related professional knowledge.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.