mac android命令行工具,scrcpy: scrcpy 是一个在电脑上显示和控制 Android 设备的命令行工具,适用于 GNU/Linux、Windows 和 Mac OS,且无需 roo...

scrcpy (v1.6)

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.

6d9b6b810a6ad5b024f9f1c1150cff02.png

Requirements

The Android part 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.

Get the app

Linux

On Linux, you typically need to build the app manually. Don't worry,

it's not that hard.

For Arch Linux, two AUR packages have been created by users:

For Gentoo, an Ebuild is available: scrcpy/.

Windows

For Windows, for simplicity, prebuilt archives with all the dependencies

(including adb) are available:

scrcpy-win32-v1.6.zip

(SHA-256: 4ca0c5924ab2ebf19b70f6598b2e546f65ba469a72ded2d1b213df3380fb46b1)

scrcpy-win64-v1.6.zip

(SHA-256: f66b7eace8dd6537a9a27176fd824704a284d8e82077ccc903344396043f90c9)

Mac OS

The application is available in Homebrew. Just install it:

brew installscrcpy

You need adb, accessible from your PATH. If you don't have it yet:

brew cask installandroid-platform-tools

Run

Plug an Android device, and execute:

scrcpy

It accepts command-line arguments, listed by:

scrcpy --help

Features

Reduce size

Sometimes, it is useful to mirror an Android device at a lower definition to

increase performances.

To limit both width and height to some value (e.g. 1024):

scrcpy --max-size 1024

scrcpy -m 1024 # short version

The other dimension is computed to that the device aspect-ratio is preserved.

That way, a device in 1920×1080 will be mirrored at 1024×576.

Change bit-rate

The default bit-rate is 8Mbps. To change the video bitrate (e.g. to 2Mbps):

scrcpy --bit-rate 2M

scrcpy -b 2M # short version

Crop

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

This is useful for example to mirror only 1 eye of the Oculus Go:

scrcpy --crop 1224:1440:0:0 # 1224x1440 at offset (0,0)

scrcpy -c 1224:1440:0:0 # short version

If --max-size is also specified, resizing is applied after cropping.

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 (replace DEVICE_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

Record screen

It is possible to record the screen while mirroring:

scrcpy --record file.mp4

scrcpy -r file.mp4

"Skipped frames" are recorded, even if they are not displayed in real time (for

performance reasons). Frames are timestamped on the device, so packet delay

variation does not impact the recorded file.

Multi-devices

If several devices are listed in adb devices, you must specify the serial:

scrcpy --serial 0123456789abcdef

scrcpy -s 0123456789abcdef # short version

You can start several instances of scrcpy for several devices.

Fullscreen

The app may be started directly in fullscreen:

scrcpy --fullscreen

scrcpy -f # short version

Fullscreen can then be toggled dynamically with Ctrl+f.

Show touches

For presentations, it may be useful to show physical touches (on the physical

device).

Android provides this feature in Developers options.

Scrcpy provides an option to enable this feature on start and disable on exit:

scrcpy --show-touches

scrcpy -t

Note that it only shows physical touches (with the finger on the device).

Install APK

To install an APK, drag & drop an APK file (ending with .apk) to the scrcpy

window.

There is no visual feedback, a log is printed to the console.

Push file to device

To push a file to /sdcard/ on the device, drag & drop a (non-APK) file to the

scrcpy window.

There is no visual feedback, a log is printed to the console.

Forward audio

Audio is not forwarded by scrcpy.

There is a limited solution using AOA, implemented in the audio branch. If

you are interested, see issue 14.

Shortcuts

Action

Shortcut

switch fullscreen mode

Ctrl+f

resize window to 1:1 (pixel-perfect)

Ctrl+g

resize window to remove black borders

Ctrl+x | Double-click¹

click on HOME

Ctrl+h | Middle-click

click on BACK

Ctrl+b | Right-click²

click on APP_SWITCH

Ctrl+s

click on MENU

Ctrl+m

click on VOLUME_UP

Ctrl+↑ (up) (Cmd+↑ on MacOS)

click on VOLUME_DOWN

Ctrl+↓ (down) (Cmd+↓ on MacOS)

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

¹Double-click on black borders to remove them.

²Right-click turns the screen on if it was off, presses BACK otherwise.

Why scrcpy?

A colleague challenged me to find a name as unpronounceable as gnirehtet.

strcpy copies a string; scrcpy copies a screen.

How to build?

Common issues

See the FAQ.

Developers

Licence

Copyright (C) 2018 Genymobile

Licensed under the Apache License, Version 2.0 (the "License");

you may not use this file except in compliance with the License.

You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software

distributed under the License is distributed on an "AS IS" BASIS,

WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and

limitations under the License.

Articles

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值