scrcpy Camera Sources and Configurations: Complete Command Reference
scrcpy supports streaming from any Android camera (front, back, or external) with configurable resolution, frame rate up to 240fps high-speed capture, aspect ratio constraints, rotation, and cropping via the --video-source=camera flag and associated camera-specific options.
scrcpy, the popular Android screen mirroring tool from Genymobile, extends beyond display mirroring to support direct camera streaming through the Android Camera2 API. When you select the camera video source, scrcpy exposes a comprehensive configuration API that lets you enumerate available cameras, constrain capture parameters, and apply real-time transformations. This guide covers every camera source and configuration option implemented in the scrcpy server codebase.
Selecting the Camera Video Source
The foundation of camera streaming starts with the video source selector. In server/src/main/java/com/genymobile/scrcpy/video/VideoSource.java, scrcpy defines two video source types: display (default) and camera.
To switch from screen mirroring to camera streaming, use the --video-source flag:
scrcpy --video-source=camera
When camera mode is active, the server initializes CameraCapture instead of SurfaceCapture, routing video frames from the Android Camera2 API rather than the display buffer.
Enumerating Available Cameras
Before selecting a specific camera, you can list all available devices and their capabilities. The LogUtils.buildCameraListMessage() method in server/src/main/java/com/genymobile/scrcpy/util/LogUtils.java generates formatted output showing camera IDs, facing direction, and supported resolutions.
Run these commands to inspect your device:
# List all cameras with facing and basic capabilities
scrcpy --list-cameras
# List valid resolutions and frame rates for each camera
scrcpy --list-camera-sizes
Camera Selection Methods
scrcpy provides two primary methods for selecting which physical camera to use: explicit ID selection or facing-based automatic selection.
Explicit Camera ID Selection
For precise control, specify the camera hardware ID directly using the --camera-id option. The value is stored in Options.java (lines 43-51) as the cameraId field:
scrcpy --video-source=camera --camera-id=1
If no ID is specified, scrcpy defaults to the first available camera (typically ID 0).
Facing-Based Selection
Alternatively, use --camera-facing to select by lens orientation. The CameraFacing.java enum defines three values: front, back, and external. The CameraCapture.selectCamera() method queries CameraManager to locate a camera matching the requested facing:
# Use the front-facing (selfie) camera
scrcpy --video-source=camera --camera-facing=front
# Use the back-facing camera
scrcpy --video-source=camera --camera-facing=back
Resolution and Frame Rate Configuration
Camera capture resolution follows a hierarchical selection process implemented in CameraCapture.selectSize(), considering explicit size requests, maximum size constraints, and high-speed mode requirements.
Explicit Size and Maximum Size Constraints
Set a specific resolution using --camera-size, defined in Options.java (lines 44-53) as cameraSize:
scrcpy --video-source=camera --camera-size=1920x1080
If you omit an explicit size, the --max-size (or -m) parameter acts as a bounding box, selecting the largest supported resolution that fits within the specified dimension while maintaining the requested aspect ratio.
Frame Rate Control
Control capture frame rate with --camera-fps, stored in Options.java as cameraFps (lines 47-48). By default, scrcpy uses the device's default frame rate (typically 30 fps):
# Force 60fps capture
scrcpy --video-source=camera --camera-fps=60
High-Speed Capture Mode
For supported devices, enable high-speed recording via the --camera-high-speed flag. This activates the constrained high-speed capture API in CameraCapture.java (lines 60-63), allowing frame rates up to 240fps on compatible hardware. Note that high-speed mode only works with specific resolution and frame rate combinations supported by the camera hardware:
# 240fps high-speed capture (device-dependent)
scrcpy --video-source=camera --camera-size=1280x720 --camera-fps=240 --camera-high-speed
Aspect Ratio and Orientation Controls
scrcpy provides fine-grained control over the camera stream's geometric properties through aspect ratio constraints and rotation parameters.
Aspect Ratio Constraints
The --camera-ar flag accepts either a ratio (16:9), a floating-point value (1.77), or the keyword sensor to use the sensor's native ratio. The CameraAspectRatio.java class handles parsing and validation:
# Force 16:9 aspect ratio
scrcpy --video-source=camera --camera-ar=16:9
# Use sensor native aspect ratio
scrcpy --video-source=camera --camera-ar=sensor
Orientation and Rotation
The --orientation flag (shared with display mirroring) rotates the captured video in 90-degree increments. For additional rotation, use --angle to specify arbitrary degrees in float format. In CameraCapture.java (lines 32-35), these values are combined to build the capture transformation matrix:
# Rotate 90 degrees clockwise
scrcpy --video-source=camera --orientation=90
# Add 15 degrees of extra rotation
scrcpy --video-source=camera --orientation=90 --angle=15.0
Advanced Camera Configuration
Beyond basic capture parameters, scrcpy supports region cropping and audio source management when streaming from the camera.
Region Cropping
The --crop flag selects a rectangular sub-region of the camera image using the format width:height:x:y. This is stored in Options.java (lines 39-42) and applied through the OpenGL pipeline:
# Crop a 1280x720 region starting at origin
scrcpy --video-source=camera --crop=1280:720:0:0
Audio Source Management
When --video-source=camera is active, scrcpy defaults the audio source to the microphone (--audio-source=mic). You can override this or disable audio entirely:
# Camera video with device audio output (mixed sources)
scrcpy --video-source=camera --audio-source=output
# Camera video without audio
scrcpy --video-source=camera --no-audio
Configuration Pipeline Implementation
Understanding the internal flow helps diagnose configuration issues. The scrcpy server processes camera options through a specific pipeline:
-
Option Parsing –
Options.parse()inOptions.javareads all--camera-*arguments into corresponding fields (cameraId,cameraSize,cameraFps, etc.). -
Camera Selection –
CameraCapture.selectCamera()usesCameraManagerto resolve the requested camera by ID or facing direction. -
Resolution Selection –
CameraCapture.selectSize()evaluates the explicit size request,--max-sizelimits, aspect ratio constraints, and high-speed requirements to choose the optimalSizeobject. -
Capture Initialization –
CameraCapture.init()opens the camera device, creates aCameraCaptureSession(regular or high-speed depending on the flag), and builds aCaptureRequestthat setsCONTROL_AE_TARGET_FPS_RANGEwhen a specific frame rate is requested. -
Post-Processing – If orientation, angle, or crop are configured, the server instantiates a
VideoFilterthat builds an OpenGL transform matrix. Frames pass through anOpenGLRunnerbefore reaching the encoder, applying the geometric transformations in real-time.
Summary
- scrcpy supports camera streaming via
--video-source=camera, selecting from front, back, or external cameras using--camera-idor--camera-facingas defined inCameraFacing.java. - Resolution configuration cascades through explicit
--camera-size,--max-sizelimits, and--camera-araspect ratio constraints, processed byCameraCapture.selectSize(). - Frame rates are controlled with
--camera-fps, with high-speed modes up to 240fps available via--camera-high-speedinCameraCapture.java. - Geometric transformations including
--orientation,--angle, and--cropare applied through the OpenGL pipeline inVideoFilterandOpenGLRunner. - Audio defaults to microphone when using camera video but can be overridden to capture device output or disabled entirely.
- Available cameras and their capabilities can be enumerated using
--list-camerasand--list-camera-sizes, which callLogUtils.buildCameraListMessage().
Frequently Asked Questions
Can scrcpy stream from multiple cameras simultaneously?
No, scrcpy currently supports only a single video source per session. You must choose either the display (--video-source=display) or one specific camera (--video-source=camera with --camera-id or --camera-facing). However, you can combine a single camera video stream with any audio source, such as --audio-source=output to capture device audio while streaming from the camera.
Why does high-speed camera mode fail on my device?
High-speed capture requires specific hardware support and only works with certain resolution and frame rate combinations, typically lower resolutions like 1280x720 at 120fps or 240fps. The --camera-high-speed flag in CameraCapture.java activates the Android Camera2 constrained high-speed session, which throws an error if the requested configuration isn't in the camera's supported high-speed size list. Use --list-camera-sizes to verify compatible high-speed configurations for your specific device.
How do I rotate the camera feed independently from the device orientation?
Camera orientation is controlled independently of device rotation using the --orientation flag (accepting 0, 90, 180, or 270 degrees) and the --angle flag for arbitrary float values. These parameters are processed in CameraCapture.java and applied through the OpenGL transformation matrix in the video filter pipeline, allowing you to stream the camera in portrait mode while the device remains in landscape, for example.
Does scrcpy support external USB cameras on Android?
Yes, scrcpy supports external cameras connected to Android devices, provided the Android Camera2 API enumerates them. Use --list-cameras to see if your external camera appears with an ID and facing direction (usually external). Then select it using --camera-id=<id> or --camera-facing=external as implemented in CameraFacing.java and processed by CameraCapture.selectCamera().
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →