Skip to content

Instantly share code, notes, and snippets.

@opragel
Last active April 21, 2025 22:12
Show Gist options
  • Select an option

  • Save opragel/50a27b5bf8d00eeaa871189b15999fb2 to your computer and use it in GitHub Desktop.

Select an option

Save opragel/50a27b5bf8d00eeaa871189b15999fb2 to your computer and use it in GitHub Desktop.
scrpy notes for Android
#!/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"
# 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 (=1920x1080)
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
# Get available cameras
scrcpy -s "$serialNumber" --list-cameras
# Get available camera "sizes" / formats
scrcpy -s "$serialNumber" --list-cameras
# 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment