Last active
April 21, 2025 22:12
-
-
Save opragel/50a27b5bf8d00eeaa871189b15999fb2 to your computer and use it in GitHub Desktop.
scrpy notes for Android
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| # Note: this is given as a shell script intended for use on macOS, but it works perfectly fine on Windows in Powershell too! | |
| # Note: I usually specify serial for ADB/scrcpy, because I typically run with | |
| # both USB and wireless debugging enabled. If you only have one available | |
| # device for ADB debugging, you can skip that!] | |
| # Unix (sh/bash/zsh etc) | |
| # serialNumber="your_device_serial_here" | |
| # Windowz | |
| # $serialNumber = "your_device_serial_here" | |
| # Info gathering | |
| # Get available cameras | |
| scrcpy -s "$serialNumber" --list-cameras | |
| # Get available camera "sizes" / formats | |
| scrcpy -s "$serialNumber" --list-camera-sizes | |
| # Get device displays | |
| scrcpy -s "$serialNumber" --list-displays | |
| # Get available audio/video encoders | |
| scrcpy -s "$serialNumber" --list-encoders | |
| # Get available apps | |
| scrcpy -s "$serialNumber" --list-apps | |
| # General mirroring | |
| # Generic mirroring. Sets the max FPS to 165, which is my desktop monitor's | |
| # refresh rate. Also slightly ups video bitrate from default to 10M, and | |
| # significantly ups audio bitrate from default to 365k. | |
| scrcpy -s "$serialNumber" --stay-awake --max-fps=165 --audio-bit-rate=365000 --video-bit-rate=10M --video-codec=h264 --video-encoder=c2.qti.avc.encoder | |
| # Use a virtual display. You can optionally specify resolution & DPI (eg: =1920x1080/240) | |
| scrcpy -s "$serialNumber" --stay-awake --max-fps=165 --audio-bit-rate=365000 --video-bit-rate=10M --video-codec=h264 --video-encoder=c2.qti.avc.encoder --new-display | |
| # Use a virtual/"external" display and launch a specific app only | |
| scrcpy -s "$serialNumber" --stay-awake --max-fps=165 --audio-bit-rate=365000 --video-bit-rate=10M --video-codec=h264 --video-encoder=c2.qti.avc.encoder --new-display --start-app=org.wikipedia | |
| # Camera stuff | |
| # Camera mirroring | |
| # I disable the audio because I'm not interested in the phone microphone | |
| # audio ususally, I have better mics. And if you are using speakers for output | |
| # watch out for audio feedback! | |
| # Camera mirroring only (30 FPS -> more FPS, lighting is harder/darker) | |
| scrcpy -s "$serialNumber" --video-source=camera --camera-id=0 --camera-high-speed --camera-fps 30 --no-audio | |
| # Camera mirroring, high-speed [120(?), definitely above 60] FPS) | |
| scrcpy -s "$serialNumber" --video-source=camera --camera-id=0 --camera-high-speed --camera-fps 120 --no-audio | |
| # other flags I find personally useful: | |
| # -t / --show-touches: shows PHYSICAL touches on screen | |
| # --window-borderless: borderless window (no title bar, no close/minimize buttons) | |
| # --no-audio-playback: Disable audio playback on the computer | |
| # --no-audio: Disable audio forwarding | |
| # -n / --no-control: Disable device control (mirror the device in read-only). |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment