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 (script compatability): this is given as a shell script intended for use on macOS, but it works perfectly fine on Windows in Powershell too! | |
# Note (specifying device): 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!] | |
# Note: (web conferencing): Last I recall, Zoom/Meet cap out at 30FPS. So if you're intending to share stuff there, going beyond 30 FPS won't really provide value. | |
# Set device identifer | |
# 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 | |
# Intended for wireless ADB specifically - lowered bitrate/audio quality/FPS. | |
# Play with bitrates and framerates, your exact results will heavily depend | |
# on your current network conditions (both host and client device) | |
# Mirrors entire screen | |
scrcpy --max-fps=165 --audio-bit-rate=128000 --video-bit-rate=8M --video-codec=h264 --video-encoder=c2.qti.avc.encoder | |
# Mirrors just camera at 30 FPS | |
scrcpy --max-fps=165 --audio-bit-rate=128000 --video-bit-rate=8M --video-codec=h264 --video-encoder=c2.qti.avc.encoder --video-source=camera --camera-id=0 --camera-fps 30 --no-audio | |
# high bandwidth/framerate! network-intensive. | |
scrcpy --max-fps=165 --video-bit-rate=8M --video-codec=h264 --video-encoder=c2.qti.avc.encoder --video-source=camera --camera-id=0 --camera-high-speed --camera-fps 120 --no-audio | |
# 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-fps 30 --no-audio | |
# Camera mirroring, landscape | |
scrcpy -s "$serialNumber" --max-fps=165 --video-bit-rate=8M --video-codec=h264 --video-encoder=c2.qti.avc.encoder --video-source=camera --camera-id=0 --camera-fps 30 --no-audio --capture-orientation=270 --orientation=270 | |
# Camera mirroring, high-speed [120(?), definitely above 60] FPS) | |
scrcpy --max-fps=165 --video-bit-rate=20M --video-codec=h264 --video-encoder=c2.qti.avc.encoder --video-source=camera --camera-id=0 --camera-high-speed --camera-fps 120 --no-audio | |
# other flags I find personall 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