Connection TCP/IP (wireless) Scrcpy uses adb to communicate with the device, and adb can connect to a device over TCP/IP. The device must be connected on the same network as the computer.
Automatic An option --tcpip allows to configure the connection automatically. There are two variants. If the device (accessible at 192.168.1.1 in this example) already listens on a port (typically 5555) for incoming adb connections, then run: scrcpy --tcpip=192.168.1.1 # default port is 5555 scrcpy --tcpip=192.168.1.1:5555 If adb TCP/IP mode is disabled on the device (or if you don't know the IP address), connect the device over USB, then run: scrcpy --tcpip # without arguments It will automatically find the device IP address, enable TCP/IP mode, then connect to the device before starting.
Manual Alternatively, it is possible to enable the TCP/IP connection manually using adb: Plug the device into a USB port on your computer.Connect the device to the same Wi-Fi network as your computer.Get your device IP address, in Settings → About phone → Status, or by executing this command:adb shell ip route | awk '{print $9}'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 with the device IP address you found).Run scrcpy as usual. Since Android 11, a Wireless debugging option allows to bypass having to physically connect your device directly to your computer. If the connection randomly drops, run your scrcpy command to reconnect. If it says there are no devices/emulators found, try running adb connect DEVICE_IP:5555 again, and then scrcpy as usual. If it still says there are none found, try running adb disconnect, and then run those two commands again. It may be useful to decrease the bit-rate and the resolution: scrcpy --bit-rate 2M --max-size 800 scrcpy -b2M -m800 # short version
Multi-devices If several devices are listed in adb devices, you can specify the serial: scrcpy --serial 0123456789abcdef scrcpy -s 0123456789abcdef # short version The serial may also be provided via the environment variable ANDROID_SERIAL (also used by adb). If the device is connected over TCP/IP: scrcpy --serial 192.168.0.1:5555 scrcpy -s 192.168.0.1:5555 # short version If only one device is connected via either USB or TCP/IP, it is possible to select it automatically: # 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 You can start several instances of scrcpy for several devices. Autostart on device connection You could use AutoAdb: autoadb scrcpy -s '{}'
Tunnels To connect to a remote device, it is possible to connect a local adb client to a remote adb server (provided they use the same version of the adb protocol).
Remote ADB server To connect to a remote adb server, make the server listen on all interfaces: adb kill-server adb -a nodaemon server start # keep this open Warning: all communications between clients and the adb server are unencrypted. Suppose that this server is accessible at 192.168.1.2. Then, from another terminal, run 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 By default, scrcpy uses the local port used for adb forward tunnel establishment (typically 27183, see --port). It is also possible to force a different tunnel port (it may be useful in more complex situations, when more redirections are involved): scrcpy --tunnel-port=1234
SSH tunnel To communicate with a remote adb server securely, it is preferable to use an SSH tunnel. First, make sure the adb server is running on the remote computer: adb start-server Then, establish an SSH tunnel: # local 5038 --> remote 5037 # local 27183 <-- remote 27183 ssh -CN -L5038:localhost:5037 -R27183:localhost:27183 your_remote_computer # keep this open From another terminal, run 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 To avoid enabling remote port forwarding, you could force a forward connection instead (notice the -L instead of -R): # local 5038 --> remote 5037 # local 27183 --> remote 27183 ssh -CN -L5038:localhost:5037 -L27183:localhost:27183 your_remote_computer # keep this open From another terminal, run 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 Like for wireless connections, it may be useful to reduce quality: scrcpy -b2M -m800 --max-fps 15