Skip to content

Instantly share code, notes, and snippets.

@sandeepansg
Last active December 9, 2025 08:38
Show Gist options
  • Select an option

  • Save sandeepansg/5c9a3644d3a09ee9827136601d29179e to your computer and use it in GitHub Desktop.

Select an option

Save sandeepansg/5c9a3644d3a09ee9827136601d29179e to your computer and use it in GitHub Desktop.
A practical guide for using scrcpy as a low-latency desktop monitor for selfie and talking-head recording with an Android smartphone.

Android Selfie Live Preview with scrcpy (Windows)

Use an Android smartphone as a camera and a Windows PC as a larger live preview screen using only open-source tools.

This document focuses on:

  • scrcpy as a live monitor (USB and Wi-Fi)
  • Multiple Android devices
  • Windows cmd.exe one-liners
  • Using ANDROID_ID as a stable logical device identifier

1. Overview

There are always two independent screens:

  • Phone screen
    Runs the camera app and performs the actual recording.

  • PC screen
    Shows a real-time mirror of the phone using scrcpy for framing and focus.

The PC never records video. Recording stays on the phone.


2. Requirements

Hardware

  • Android phone (Android 5.0+)
  • Windows PC (10 or 11)
  • USB cable (required at least once)
  • Optional: selfie stand or gimbal (example: DJI Osmo Mobile SE)

Software

  • scrcpy (includes adb)
  • Any camera app (stock, Open Camera, vendor app)
  • Optional: DJI Mimo if using a DJI gimbal

3. Install scrcpy

winget install scrcpy

Verify:

scrcpy --version

4. Phone Setup (Manual, Required)

On each phone:

  1. Enable Developer options
  2. Enable USB debugging
  3. Connect to the PC once via USB
  4. When prompted: “Allow USB debugging?” → Allow (preferably “Always allow”)

This confirmation cannot be automated from the PC.


5. Basic scrcpy (USB)

scrcpy --orientation=flip0

flip0 provides a mirrored preview, which is usually desirable for selfie framing.


6. Multiple Devices and ADB

List devices known to adb:

adb devices

When more than one device is present, always specify a target using -s.


7. Enable ADB over Wi-Fi (per device)

For a USB-connected device:

adb -s <USB_SERIAL> shell ip route

Identify the Wi‑Fi IP from the src field.

Enable TCP/IP:

adb -s <USB_SERIAL> tcpip 5555

Connect over Wi‑Fi:

adb connect <PHONE_IP>:5555

Verify:

adb devices

8. scrcpy over Wi-Fi

scrcpy -s <PHONE_IP>:5555 --orientation=flip0

Multiple scrcpy windows may be opened simultaneously, one per device.


9. Wireless Debugging Pairing (Android 11+)

adb pair <HOST>:<PAIR_PORT>
adb connect <HOST>:<ADB_PORT>

Pairing prompts must be accepted manually on the phone.


10. Stable Device Identification with ANDROID_ID

ADB serials change between USB and Wi-Fi.
ANDROID_ID can be used as a stable logical identifier.

Notes:

  • Usually stable for a given device and user
  • May reset after factory reset
  • May be unavailable on some devices

11. One-Line: List All ADB Devices with ANDROID_ID

for /f "skip=1 tokens=1,2" %A in ('adb devices') do @if "%B"=="device" (@echo %A ^& adb -s %A shell settings get secure android_id 2^>nul || echo [android_id unavailable])

12. One-Line: Prompt for ANDROID_ID and Connect to Wireless Device

set /p AID=Enter ANDROID_ID: & for /f "skip=1 tokens=1,2" %A in ('adb devices') do @if "%B"=="device" @echo %A|find ":" >nul && for /f "delims=" %I in ('adb -s %A shell settings get secure android_id 2^>nul') do @if "%I"=="%AID%" scrcpy -s %A --orientation=flip0

13. What Cannot Be Automated

  • Accepting “Allow USB debugging?”
  • Accepting Wireless debugging pairing dialogs

These must always be confirmed on the phone.


14. Orientation Reference (scrcpy 3.3+)

flip0     mirrored, no rotation
flip90    mirrored, 90° clockwise
flip180   mirrored, 180°
flip270   mirrored, 270°

15. Summary

  • scrcpy provides a dependable live monitor for Android cameras
  • USB is simplest; Wi-Fi works well after pairing
  • Multiple devices are supported simultaneously
  • ANDROID_ID allows transport-independent device identification
  • Phone-side security prompts always require manual acceptance
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment