#!/usr/bin/env bash # Enable ADB over TCP (run once usually) adb tcpip 5555 sleep 1 adb connect 10.0.0.30:5555 || { echo "Connection failed - check IP/Wi-Fi"; exit 1; } read -p "Disconnect USB now if desired, then press Enter..." set -e trap 'kill 0' EXIT INT TERM stream_play() { ffplay \ -fflags nobuffer+discardcorrupt+flush_packets \ -flags low_delay \ -framedrop \ -probesize 32 \ -analyzeduration 0 \ -sync ext \ -vf "setpts=PTS-STARTPTS" \ - } # Optional audio (low buffer, background) # scrcpy --no-video --audio-buffer=80 --audio-bit-rate=128K & echo "Starting low-latency Quest mirror (Wi-Fi). Ctrl+C to stop." echo "Expect 150–500 ms latency depending on network." while true; do echo "[$(date '+%H:%M:%S')] (Re)starting screenrecord segment..." adb exec-out screenrecord \ --bit-rate=8M \ --output-format=h264 \ --size 1280x720 \ --time-limit 120 \ - | stream_play # Small delay to let ffplay drain & avoid rapid respawn spam on error sleep 0.5 done