A while back the only way to mirror your android device's screen was if you had it rooted. But those days are now long gone and as long as you have an android version 5.0 or later you can easily mirror your android screen using these simple methods.
To do this, we will use an open source application called scrcpy. There are 2 ways to do this:
- via USB
- Over TCP/IP(wireless)
This application provides display and control of Android devices connected on USB (or over TCP/IP). It does not require any root access. It works on GNU/Linux, Windows and macOS.
It focuses on:
- lightness (native, displays only the device screen)
- performance (30~60fps)
- quality (1920×1080 or above)
- low latency (35~70ms)
- low startup time (~1 second to display the first image)
- non-intrusiveness (nothing is left installed on the device)
Requirements
The Android device requires at least API 21 (Android 5.0).
Make sure you enabled adb debugging on your device(s).
On some devices, you also need to enable an additional option to control it using keyboard and mouse.
Installation
Linux
On Debian (testing and sid for now) and Ubuntu (20.04):
sudo apt install scrcpy
A Snap package is available:
sudo snap install scrcpy
For Fedora, a COPR package is available: scrcpy
.
For Arch Linux, an AUR package is available: scrcpy
.
For Gentoo, an Ebuild is available: scrcpy/
.
You could also build the app manually (don't worry, it's not that hard).
Windows
For Windows, for simplicity, a prebuilt archive with all the dependencies
(including adb
) is available:
scrcpy-win64-v1.16.zip
(SHA-256: 3f30dc5db1a2f95c2b40a0f5de91ec1642d9f53799250a8c529bc882bc0918f0)
It is also available in Chocolatey:
choco install scrcpy
choco install adb #if you don't have it yet
And in Scoop:
You can also build the app manually.
scoop install scrcpy
scoop install adb #if you don't have it yet
macOS
The application is available in Homebrew. Just install it:
brew install scrcpy
You need adb
, accessible from your PATH
. If you don't have it yet:
brew cask install android-platform-tools
You can also build the app manually.
Run
Plug an Android device, and execute this command in your terminal:
scrcpy
It accepts command-line arguments, listed by:
scrcpy --help
Connection
Wireless
Scrcpy uses adb
to communicate with the device, and adb
can connect to a
device over TCP/IP:
- Connect the device to the same Wi-Fi as your computer.
- Get your device IP address (in Settings → About phone → Status).
- Enable adb over TCP/IP on your device:
adb tcpip 5555
. - Unplug your device.
- Connect to your device:
adb connect DEVICE_IP:5555
(replaceDEVICE_IP
). - 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
Multi-devices
If several devices are listed in adb devices
, you must specify the serial:
scrcpy --serial 0123456789abcdef
scrcpy -s 0123456789abcdef # short version
If the device is connected over TCP/IP:
scrcpy --serial 192.168.0.1:5555
scrcpy -s 192.168.0.1:5555 # short version
You can start several instances of scrcpy for several devices.
Autostart on device connection
You could use AutoAdb:
autoadb scrcpy -s '{}'
Window configuration
Title
By default, the window title is the device model. It can be changed:
scrcpy --window-title 'My device'
Position and size
The initial window position and size may be specified:
scrcpy --window-x 100 --window-y 100 --window-width 800 --window-height 600
Borderless
To disable window decorations:
scrcpy --window-borderless
Always on top
To keep the scrcpy window always on top:
scrcpy --always-on-top
Fullscreen
The app may be started directly in fullscreen:
scrcpy --fullscreen
scrcpy -f # short version
Fullscreen can then be toggled dynamically with MOD+f.
Rotation
The window may be rotated:
scrcpy --rotation 1
Possibles values are:
0
: no rotation1
: 90 degrees counterclockwise2
: 180 degrees3
: 90 degrees clockwise
The rotation can also be changed dynamically with MOD+← (left) and MOD+→ (right).
Note that scrcpy manages 3 different rotations:
- MOD+r requests the device to switch between portrait and landscape (the current running app may refuse, if it does support the requested orientation).
--lock-video-orientation
changes the mirroring orientation (the orientation of the video sent from the device to the computer). This affects the recording.--rotation
(or MOD+←/MOD+→) rotates only the window content. This affects only the display, not the recording.
There are a lot more features and configurations on their GitHub page which you can check out below.
SOURCE: GitHub
This has not worked for me how can you help me on this
ReplyDeleteIt worked for me. What exactly have you had a problem with
Delete