genymobile/scrcpy
Display and control your Android device
How scrcpy is put together
scrcpy is a desktop application that mirrors and controls an Android device over USB or TCP/IP. It has two halves built by different toolchains: a C client (built with Meson) that renders the device screen via SDL/OpenGL, decodes media via FFmpeg, sends input/control messages, and records streams; and a Java 'scrcpy-server' APK-like artifact (built with Gradle) pushed to the device and run via app_process, which captures display/camera/audio through hidden Android APIs and executes injected input events. The client launches the server over an adb tunnel; raw H.264/H.265/AV1/OPUS/AAC frames flow device-to-client while control/device messages flow client-to-device over plain sockets established by adb forward/reverse. There is no web layer, no datastore, and no authentication mechanism.
Languages
Frameworks
Infrastructure
Major components
Client core (app/src/scrcpy.c, main.c)
Orchestrates startup: parses CLI options, connects adb tunnel, starts the on-device server, and wires together demuxer, decoder, controller, recorder, and screen.
Media pipeline (demuxer.c, decoder.c, packet_merger.c, audio_player.c, frame_buffer.c)
Receives encoded video/audio packets from the device socket, merges fragmented packets, feeds FFmpeg decoders, and renders/plays them with clock/regulator-based synchronization.
Screen rendering (screen.c, opengl.c, texture.c, icon.c)
Manages the SDL window and OpenGL textures that display mirrored frames, including rotation, fullscreen, and resize handling.
Control/input (controller.c, input_manager.c, control_msg.c, receiver.c)
Serializes mouse/keyboard/gamepad/clipboard actions into control messages sent to the device and processes device-to-client messages.
USB/HID subsystem (usb/, hid/, uhid/, aoa_hid.c, scrcpy_otg.c)
Implements physical keyboard/mouse/gamepad simulation over USB HID/AOA/UHID and OTG-mode control without USB debugging.
ADB integration (app/src/adb/)
Locates the adb binary, lists devices, parses device state, and establishes forward/reverse socket tunnels to reach the on-device server.
scrcpy-server (server/src/main/java/com/genymobile/scrcpy)
Java process executed on the Android device via app_process that captures display/camera/audio using hidden APIs, encodes with MediaCodec/MediaRecorder, injects input events, and manages lifecycle/cleanup.
Device-side wrappers & workarounds (wrappers/, Workarounds, FakeContext, CleanUp)
Reflectively accesses hidden Android system services (WindowManager, ActivityManager, etc.), fakes a shell-UID context, applies OEM workarounds, and restores modified device settings after exit.
No digest this week
1 weeksWeek of
Dependencies and code review
Dependency advisories
Security Watch
No known advisories across 0 scanned dependencies.
No known advisories in the scanned dependencies.
Code review
No concrete code-level issues confirmed.
Get this report every week for your repos.
GitZoid learns each repo, reports what changed, and flags what needs attention. One flat price for the whole team.
$19 a month, flat · First 10 outputs free · No card required