発音 "screen copy"
このアプリケーションは、を介して接続されたAndroidデバイスの表示と制御を提供します USB または TCP/IP 経由。ルートアクセスは必要ありません。 GNU/Linux、Windows、macOSで動作します。
それは焦点を当てています:
その機能は次のとおりです。
Android デバイスには、少なくとも API 21(Android 5.0)が必要です。
デバイスでadbデバッグを有効にしてください。
一部のデバイスでは、次の追加オプションも有効にする必要があります。 キーボードとマウスを使用して制御します。
apt install scrcpy
brew install scrcpy
ソースからビルド: BUILD (簡略化されたプロセス))
DebianとUbuntuの場合:
apt install scrcpy
Arch Linux の場合:
pacman -S scrcpy
Fedora の場合、COPR パッケージが利用可能です: scrcpy
。
Gentoo では、Ebuild が利用可能です: scrcpy/
です。
アプリを手動でビルドすることもできます (簡略化 プロセス)。
Windowsの場合、すべての依存関係(を含む)を含む事前構築済みアーカイブは 利用できる:
adb
scrcpy-win64-v1.25.zip
db65125e9c65acd00359efb7cea9c05f63cc7ccd5833000cd243cc92f5053028
チョコレートでもご利用いただけます:
choco install scrcpy
choco install adb # if you don't have it yet
そしてスクープで:
scoop install scrcpy
scoop install adb # if you don't have it yet
アプリを手動でビルドすることもできます。
アプリケーションは自作で利用可能です。インストールするだけです:
brew install scrcpy
あなたからアクセスできる必要があります。まだお持ちでない場合:
adb
PATH
brew install android-platform-tools
MacPorts でも利用できます。
adb
sudo port install scrcpy
アプリを手動でビルドすることもできます。
Android デバイスをコンピューターに接続し、次のコマンドを実行します。
scrcpy
コマンドライン引数を受け入れます。
scrcpy --help
場合によっては、Androidデバイスを低解像度でミラーリングすると便利です。 パフォーマンスを向上させます。
幅と高さの両方を何らかの値(例:1024)に制限するには:
scrcpy --max-size=1024
scrcpy -m 1024 # short version
もう一方のディメンションは、Android デバイスのアスペクト比が 保存。これにより、1920×1080 のデバイスは 1024×576 にミラーリングされます。
デフォルトのビットレートは 8 Mbps です。ビデオのビットレートを変更するには(例:2 Mbps):
scrcpy --bit-rate=2M
scrcpy -b 2M # short version
キャプチャフレームレートは制限できます。
scrcpy --max-fps=15
これはAndroid 10以降公式にサポートされていますが、以前のバージョンでも機能する可能性があります。
実際のキャプチャフレームレートは、コンソールに出力できます。
scrcpy --print-fps
また、+でいつでも有効または無効にすることができます。MODi
デバイスの画面は、画面の一部のみをミラーリングするようにトリミングされる場合があります。
これは、たとえば、Oculus Goの片目だけをミラーリングする場合に便利です。
scrcpy --crop=1224:1440:0:0 # 1224x1440 at offset (0,0)
も指定した場合、トリミング後にサイズ変更が適用されます。
--max-size
ミラーリングの方向をロックするには:
scrcpy --lock-video-orientation # initial (current) orientation
scrcpy --lock-video-orientation=0 # natural orientation
scrcpy --lock-video-orientation=1 # 90° counterclockwise
scrcpy --lock-video-orientation=2 # 180°
scrcpy --lock-video-orientation=3 # 90° clockwise
これは録音の向きに影響します。
ウィンドウは独立して回転させることもできます。
一部のデバイスには複数のエンコーダーがあり、一部のデバイスには問題が発生したり、問題が発生したりする可能性があります。 クラッシュ。別のエンコーダを選択することもできます。
scrcpy --encoder=OMX.qcom.video.encoder.avc
使用可能なエンコーダーを一覧表示するには、無効なエンコーダー名を渡すことができます。ザ エラーは利用可能なエンコーダーを与えます:
scrcpy --encoder=_
ミラーリング中に画面を記録することができます。
scrcpy --record=file.mp4
scrcpy -r file.mkv
録画中にミラーリングを無効にするには:
scrcpy --no-display --record=file.mp4
scrcpy -Nr file.mkv
# interrupt recording with Ctrl+C
「スキップされたフレーム」は、リアルタイムで表示されていなくても記録されます( パフォーマンス上の理由)。フレームはデバイス上でタイムスタンプされるため、パケット遅延 バリエーションは記録されたファイルには影響しません。
Linuxでは、ビデオストリームをv4l2ループバックデバイスに送信できるため、 Androidデバイスは、v4l2対応ツールでウェブカメラのように開くことができます。
モジュールをインストールする必要があります。
v4l2loopback
sudo apt install v4l2loopback-dkms
v4l2 デバイスを作成するには:
sudo modprobe v4l2loopback
これにより、 に新しいビデオ デバイスが作成されます。ここで、 は整数です。 (より多くのオプションが利用可能です を使用して、複数のデバイスまたは特定の ID を持つデバイスを作成します)。
/dev/videoN
N
有効なデバイスを一覧表示するには:
# requires v4l-utils package
v4l2-ctl --list-devices
# simple but might be sufficient
ls /dev/video*
v4l2 シンクの使用を開始するには:
scrcpy
scrcpy --v4l2-sink=/dev/videoN
scrcpy --v4l2-sink=/dev/videoN --no-display # disable mirroring window
scrcpy --v4l2-sink=/dev/videoN -N # short version
(デバイスIDに置き換え、
N
ls /dev/video*)
有効にすると、v4l2対応ツールを使用してビデオストリームを開くことができます。
ffplay -i /dev/videoN
vlc v4l2:///dev/videoN # VLC might add some buffering delay
たとえば、OBS内でビデオをキャプチャできます。
バッファリングを追加することが可能です。これによりレイテンシは増加しますが、ジッターは減少します(#2464を参照)。
このオプションは、ディスプレイバッファリングに使用できます。
scrcpy --display-buffer=50 # add 50 ms buffering for display
およびV4L2シンク:
scrcpy --v4l2-buffer=500 # add 500 ms buffering for v4l2 sink
Scrcpyはデバイスとの通信に使用し、 TCP/IP 経由のデバイス。デバイスは、と同じネットワークに接続されている必要があります。 コンピュータ。
adb
adb
オプションを使用すると、接続を自動的に構成できます。あります 2つのバリアント。
--tcpip
デバイス(この例では192.168.1.1でアクセス可能)がすでにリッスンしている場合 着信ADB接続用のポート(通常は5555)から、次のコマンドを実行します。
scrcpy --tcpip=192.168.1.1 # default port is 5555
scrcpy --tcpip=192.168.1.1:5555
デバイスで adb TCP/IP モードが無効になっている場合 (または IP が不明な場合) アドレス)、USB経由でデバイスを接続し、次のコマンドを実行します。
scrcpy --tcpip # without arguments
デバイスのIPアドレスとadbポートを自動的に見つけ、TCP / IPを有効にします 必要に応じてモードにしてから、開始する前にデバイスを接続します。
または、次を使用して TCP/IP 接続を手動で有効にすることもできます。
adb
デバイスをコンピューターの USB ポートに接続します。
デバイスをコンピューターと同じWi-Fiネットワークに接続します。
デバイスのIPアドレスは、[設定] → [電話→ステータスについて] で、または このコマンドの実行:
adb shell ip route | awk '{print $9}'
デバイスで TCP/IP 経由で有効にします: 。
adb
adb tcpip 5555
デバイスのプラグを抜きます。
デバイスに接続します:(DEVICE_IP見つけたデバイスのIPアドレスに置き換えます)。
adb connect DEVICE_IP:5555
通常どおりに実行します。
scrcpy
Android 11以降、ワイヤレスデバッグオプションを使用するとバイパスできます デバイスをコンピューターに物理的に直接接続する必要があります。
接続がランダムに切断された場合は、コマンドを実行して再接続します。もしそうなら デバイス/エミュレータが見つからない場合は、もう一度実行してから、通常どおり実行してみてください。それでもあると言われる場合は 何も見つかりませんでした。実行してみてから、これら 2 つのコマンドを再度実行します。
scrcpy
adb connect DEVICE_IP:5555
scrcpy
adb disconnect
ビットレートと解像度を下げると便利な場合があります。
scrcpy --bit-rate=2M --max-size=800
scrcpy -b2M -m800 # short version
に複数のデバイスが表示されている場合は、シリアルを指定できます。
adb devices
scrcpy --serial=0123456789abcdef
scrcpy -s 0123456789abcdef # short version
シリアルは、環境変数 ( によっても使用されます) を介して提供することもできます。
ANDROID_SERIAL
adb
デバイスが TCP/IP 経由で接続されている場合:
scrcpy --serial=192.168.0.1:5555
scrcpy -s 192.168.0.1:5555 # short version
USBまたはTCP/IP経由で接続されているデバイスが1つだけの場合は、次のことが可能になります。 自動的に選択します。
# Select the only device connected via USB
scrcpy -d # like adb -d
scrcpy --select-usb # long version
# Select the only device connected via TCP/IP
scrcpy -e # like adb -e
scrcpy --select-tcpip # long version
複数のデバイスに対して scrcpy の複数のインスタンスを開始できます。
あなたはAutoAdbを使うことができます:
autoadb scrcpy -s '{}'
リモートデバイスに接続するには、ローカルクライアントをに接続できます。 リモートサーバー(同じバージョンのadbプロトコルを使用している場合)。
adb
adb
リモート adb サーバーに接続するには、サーバーにすべてのインターフェイスでリッスンさせます。
adb kill-server
adb -a nodaemon server start
# keep this open
警告:クライアントとadbサーバー間のすべての通信は次のとおりです。 暗号化。
このサーバーが 192.168.1.2 でアクセス可能であるとします。それから、別の人から ターミナル、実行:
scrcpy
# in bash
export ADB_SERVER_SOCKET=tcp:192.168.1.2:5037
scrcpy --tunnel-host=192.168.1.2
:: in cmd
set ADB_SERVER_SOCKET=tcp:192.168.1.2:5037
scrcpy --tunnel-host=192.168.1.2
# in PowerShell
$env:ADB_SERVER_SOCKET = 'tcp:192.168.1.2:5037'
scrcpy --tunnel-host=192.168.1.2
デフォルトでは、トンネルに使用されるローカルポートを使用します 確立 (通常は、「」を参照してください)。を強制することも可能です 異なるトンネルポート(より複雑な状況で役立つ場合があります。 リダイレクトが関係しています):
scrcpy
adb forward
27183
--port
scrcpy --tunnel-port=1234
リモートadbサーバーと安全に通信するには、 SSH トンネル。
まず、adbサーバーがリモートコンピューターで実行されていることを確認します。
adb start-server
次に、SSH トンネルを確立します。
# local 5038 --> remote 5037
# local 27183 <-- remote 27183
ssh -CN -L5038:localhost:5037 -R27183:localhost:27183 your_remote_computer
# keep this open
別のターミナルから、次のコマンドを実行します。
scrcpy
# in bash
export ADB_SERVER_SOCKET=tcp:localhost:5038
scrcpy
:: in cmd
set ADB_SERVER_SOCKET=tcp:localhost:5038
scrcpy
# in PowerShell
$env:ADB_SERVER_SOCKET = 'tcp:localhost:5038'
scrcpy
リモートポート転送を有効にしないようにするには、転送接続を強制します 代わりに(の代わりに注意してください):
-L
-R
# local 5038 --> remote 5037
# local 27183 --> remote 27183
ssh -CN -L5038:localhost:5037 -L27183:localhost:27183 your_remote_computer
# keep this open
別のターミナルから、次のコマンドを実行します。
scrcpy
# in bash
export ADB_SERVER_SOCKET=tcp:localhost:5038
scrcpy --force-adb-forward
:: in cmd
set ADB_SERVER_SOCKET=tcp:localhost:5038
scrcpy --force-adb-forward
# in PowerShell
$env:ADB_SERVER_SOCKET = 'tcp:localhost:5038'
scrcpy --force-adb-forward
ワイヤレス接続の場合と同様に、品質を下げると便利な場合があります。
scrcpy -b2M -m800 --max-fps=15
既定では、ウィンドウのタイトルはデバイス モデルです。変更することができます:
scrcpy --window-title='My device'
初期ウィンドウの位置とサイズは次のように指定できます。
scrcpy --window-x=100 --window-y=100 --window-width=800 --window-height=600
ウィンドウの装飾を無効にするには:
scrcpy --window-borderless
scrcpyウィンドウを常に一番上に保つには:
scrcpy --always-on-top
アプリはフルスクリーンで直接起動できます。
scrcpy --fullscreen
scrcpy -f # short version
フルスクリーンは、+で動的に切り替えることができます。MODf
ウィンドウは回転できます。
scrcpy --rotation=1
可能な値:
0:回転なし
1:反時計回りに90度
2:180度
3:時計回りに90度
回転は+(左)と+(右)で動的に変更することもできます。MOD←MOD→
scrcpyは3つの異なるローテーションを管理することに注意してください。
ロック-ビデオ-向き
はミラーリングを変更します
向き(デバイスからに送信されるビデオの向き
コンピュータ)。これは録音に影響します。--rotation(または +/+) ウィンドウの内容のみを回転します。これはディスプレイにのみ影響し、 録音。MOD←MOD→
コントロールを無効にするには(デバイスと対話できるすべてのもの:入力キー、 マウスイベント、ファイルのドラッグアンドドロップ):
scrcpy --no-control
scrcpy -n
複数のディスプレイが使用可能な場合は、ディスプレイを選択して 鏡:
scrcpy --display=1
表示 ID のリストは、次の方法で取得できます。
adb shell dumpsys display # search "mDisplayId=" in the output
セカンダリディスプレイは、デバイスが少なくともAndroidを実行している場合にのみ制御できます 10 (それ以外の場合は読み取り専用としてミラー化されます)。
デバイスが接続されているときに遅延後にデバイスがスリープしないようにするには:
scrcpy --stay-awake
scrcpy -w
初期状態は、scrcpy を閉じると復元されます。
スタート時にミラーリングしている間、デバイスの画面をオフにすることができます コマンドラインオプション:
scrcpy --turn-screen-off
scrcpy -S
または、いつでも+を押します。MODo
オンに戻すには、++を押します。MODShifto
Androidでは、ボタンは常に画面をオンにします。便宜上、scrcpyを介して(右クリックまたは+を介して)送信された場合、 少し遅れて画面をオフにするように強制されます(ベストエフォートで 基礎)。物理的なボタンは引き続き画面を回転させます オン。
POWER
POWERMODp
POWER
デバイスがスリープ状態にならないようにすることも役立ちます。
scrcpy --turn-screen-off --stay-awake
scrcpy -Sw
scrcpyを閉じるときにデバイスの画面をオフにするには:
scrcpy --power-off-on-close
デフォルトでは、起動時にデバイスの電源がオンになります。
この動作を防ぐには:
scrcpy --no-power-on
プレゼンテーションの場合、物理的なタッチを示すと便利な場合があります(物理的な デバイス)。
Android では、この機能が [開発者向けオプション] で提供されています。
Scrcpy provides an option to enable this feature on start and restore the initial value on exit:
scrcpy --show-touches
scrcpy -t
Note that it only shows physical touches (by a finger on the device).
By default, scrcpy does not prevent the screensaver from running on the computer.
To disable it:
scrcpy --disable-screensaver
Press + to switch between portrait and landscape modes.MODr
Note that it rotates only if the application in foreground supports the requested orientation.
Any time the Android clipboard changes, it is automatically synchronized to the computer clipboard.
Any shortcut is forwarded to the device. In particular:Ctrl
This typically works as you expect.
The actual behavior depends on the active application though. For example, Termux sends SIGINT on + instead, and K-9 Mail composes a new message.Ctrlc
To copy, cut and paste in such cases (but only supported on Android >= 7):
COPY
CUT
PASTE
In addition, ++ injects the computer clipboard text as a sequence of key events. This is useful when the component does not accept text pasting (for example in Termux), but it can break non-ASCII content.MODShiftv
WARNING: Pasting the computer clipboard to the device (either via + or +) copies the content into the Android clipboard. As a consequence, any Android application could read its content. You should avoid pasting sensitive content (like passwords) that way.CtrlvMODv
Some Android devices do not behave as expected when setting the device clipboard programmatically. An option is provided to change the behavior of + and + so that they also inject the computer clipboard text as a sequence of key events (the same way as ++).
--legacy-pasteCtrlvMODvMODShiftv
To disable automatic clipboard synchronization, use .
--no-clipboard-autosync
To simulate "pinch-to-zoom": +click-and-move.Ctrl
More precisely, hold down while pressing the left-click button. Until the left-click button is released, all mouse movements scale and rotate the content (if supported by the app) relative to the center of the screen.Ctrl
Technically, scrcpy generates additional touch events from a "virtual finger" at a location inverted through the center of the screen.
By default, scrcpy uses Android key or text injection: it works everywhere, but is limited to ASCII.
Alternatively, can simulate a physical USB keyboard on Android to provide a better input experience (using USB HID over AOAv2): the virtual keyboard is disabled and it works for all characters and IME.
scrcpy
However, it only works if the device is connected via USB.
Note: On Windows, it may only work in OTG mode, not while mirroring (it is not possible to open a USB device if it is already open by another process like the adb daemon).
To enable this mode:
scrcpy --hid-keyboard
scrcpy -K # short version
If it fails for some reason (for example because the device is not connected via USB), it automatically fallbacks to the default mode (with a log in the console). This allows using the same command line options when connected over USB and TCP/IP.
In this mode, raw key events (scancodes) are sent to the device, independently of the host key mapping. Therefore, if your keyboard layout does not match, it must be configured on the Android device, in Settings → System → Languages and input → Physical keyboard.
This settings page can be started directly:
adb shell am start -a android.settings.HARD_KEYBOARD_SETTINGS
However, the option is only available when the HID keyboard is enabled (or when a physical keyboard is connected).
Similarly to the physical keyboard simulation, it is possible to simulate a physical mouse. Likewise, it only works if the device is connected by USB.
By default, scrcpy uses Android mouse events injection with absolute coordinates. By simulating a physical mouse, a mouse pointer appears on the Android device, and relative mouse motion, clicks and scrolls are injected.
To enable this mode:
scrcpy --hid-mouse
scrcpy -M # short version
You can also add to forward all mouse buttons.
--forward-all-clicks
When this mode is enabled, the computer mouse is "captured" (the mouse pointer disappears from the computer and appears on the Android device instead).
Special capture keys, either or , toggle (disable or enable) the mouse capture. Use one of them to give the control of the mouse back to the computer.AltSuper
It is possible to run scrcpy with only physical keyboard and mouse simulation (HID), as if the computer keyboard and mouse were plugged directly to the device via an OTG cable.
In this mode, (USB debugging) is not necessary, and mirroring is disabled.
adb
To enable OTG mode:
scrcpy --otg
# Pass the serial if several USB devices are available
scrcpy --otg -s 0123456789abcdef
It is possible to enable only HID keyboard or HID mouse:
scrcpy --otg --hid-keyboard # keyboard only
scrcpy --otg --hid-mouse # mouse only
scrcpy --otg --hid-keyboard --hid-mouse # keyboard and mouse
# for convenience, enable both by default
scrcpy --otg # keyboard and mouse
Like and , it only works if the device is connected by USB.
--hid-keyboard
--hid-mouse
Two kinds of events are generated when typing text:
By default, letters are injected using key events, so that the keyboard behaves as expected in games (typically for WASD keys).
But this may cause issues. If you encounter such a problem, you can avoid it by:
scrcpy --prefer-text
(but this will break keyboard behavior in games)
On the contrary, you could force to always inject raw key events:
scrcpy --raw-key-events
These options have no effect on HID keyboard (all key events are sent as scancodes in this mode).
By default, holding a key down generates repeated key events. This can cause performance problems in some games, where these events are useless anyway.
To avoid forwarding repeated key events:
scrcpy --no-key-repeat
This option has no effect on HID keyboard (key repeat is handled by Android directly in this mode).
By default, right-click triggers BACK (or POWER on) and middle-click triggers HOME. To disable these shortcuts and forward the clicks to the device instead:
scrcpy --forward-all-clicks
To install an APK, drag & drop an APK file (ending with ) to the scrcpy window.
.apk
There is no visual feedback, a log is printed to the console.
To push a file to on the device, drag & drop a (non-APK) file to the scrcpy window.
/sdcard/Download/
There is no visual feedback, a log is printed to the console.
The target directory can be changed on start:
scrcpy --push-target=/sdcard/Movies/
Audio is not forwarded by scrcpy. Use sndcpy.
Also see issue #14.
In the following list, is the shortcut modifier. By default, it's (left) or (left) .MODAltSuper
It can be changed using . Possible keys are , , , , and . For example:
--shortcut-mod
lctrl
rctrl
lalt
ralt
lsuper
rsuper
# use RCtrl for shortcuts
scrcpy --shortcut-mod=rctrl
# use either LCtrl+LAlt or LSuper for shortcuts
scrcpy --shortcut-mod=lctrl+lalt,lsuper
Super is typically the Windows or Cmd key.
Action | Shortcut |
---|---|
Switch fullscreen mode | MOD+f |
Rotate display left | MOD+← (left) |
Rotate display right | MOD+→ (right) |
Resize window to 1:1 (pixel-perfect) | MOD+g |
Resize window to remove black borders | MOD+w | Double-left-click¹ |
Click on HOME |
MOD+h | Middle-click |
Click on BACK |
MOD+b | Right-click² |
Click on APP_SWITCH |
MOD+s | 4th-click³ |
Click on (unlock screen)⁴MENU |
MOD+m |
Click on VOLUME_UP |
MOD+↑ (up) |
Click on VOLUME_DOWN |
MOD+↓ (down) |
Click on POWER |
MOD+p |
Power on | Right-click² |
Turn device screen off (keep mirroring) | MOD+o |
Turn device screen on | MOD+Shift+o |
Rotate device screen | MOD+r |
Expand notification panel | MOD+n | 5th-click³ |
Expand settings panel | MOD+n+n | Double-5th-click³ |
Collapse panels | MOD+Shift+n |
Copy to clipboard⁵ | MOD+c |
Cut to clipboard⁵ | MOD+x |
Synchronize clipboards and paste⁵ | MOD+v |
Inject computer clipboard text | MOD+Shift+v |
Enable/disable FPS counter (on stdout) | MOD+i |
Pinch-to-zoom | Ctrl+click-and-move |
Drag & drop APK file | Install APK from computer |
Drag & drop non-APK file | Push file to device |
¹Double-click on black borders to remove them.
²Right-click turns the screen on if it was off, presses BACK otherwise.
³4th and 5th mouse buttons, if your mouse has them.
⁴For react-native apps in development, MENU
triggers development menu.
⁵Only on Android >= 7.
Shortcuts with repeated keys are executed by releasing and pressing the key a second time. For example, to execute "Expand settings panel":
All +key shortcuts are forwarded to the device, so they are handled by the active application.Ctrl
To use a specific binary, configure its path in the environment variable :
adb
ADB
ADB=/path/to/adb scrcpy
To override the path of the file, configure its path in .
scrcpy-server
SCRCPY_SERVER_PATH
To override the icon, configure its path in .
SCRCPY_ICON_PATH
A colleague challenged me to find a name as unpronounceable as gnirehtet.
strcpy
copies a string; copies a screen.
scrcpy
See BUILD.
See the FAQ.
Read the developers page.
Copyright (C) 2018 Genymobile Copyright (C) 2018-2022 Romain Vimont 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.
バグに遭遇した場合は、まずFAQを読んでから、問題をオープンしてください。
一般的な質問やディスカッションでは、次のものも使用できます。
r/scrcpy
@scrcpy_app
この README の他の言語への翻訳は、ウィキで入手できます。
この README ファイルのみが最新であることが保証されます。