A comprehensive, high-level Python client for controlling Sony cameras (like the ZV-E10, A7RIII, etc.) via the legacy Camera Remote API (JSON-RPC over HTTP).
This package is designed to be the "best ever" implementation for Sony's legacy API, focusing on:
- Capability-First Architecture: Always probe what the camera supports before calling.
- Dynamic Method Surface: Use
cam.do("methodName", ...)for any method not explicitly wrapped. - Robust Liveview: High-performance binary stream parser for JPEG frames.
- Comprehensive Actions: Full catalog of Sony API methods as constants.
- Auto-Discovery: Discover cameras on the network using SSDP.
- Full Exposure Control: Aperture, Shutter Speed, ISO, Exposure Compensation, etc.
- Advanced Focus: Focus modes, Touch AF position, Tracking Focus.
- Live View: Frame-by-frame JPEG extraction from the binary stream.
- Event Monitoring: Long-polling support to track battery, status, and settings changes.
To use this library, your camera must be configured to accept remote connections over Wi-Fi using the Legacy Camera Remote API.
This is the easiest setup but your PC will lose internet access.
- Menu -> Network -> Smartphone Connect -> On.
- Connection -> Connect PC to the displayed Wi-Fi.
Use this if you need internet access while controlling the camera.
- Connect Camera to Hotspot:
- Menu -> Network -> Wi-Fi -> Access Point Set..
- Select your hotspot and connect.
- Connect PC to Hotspot:
- Ensure your PC is on the same hotspot.
- Enable Remote:
- Menu -> Network -> Smartphone Connect -> On.
- The camera should now use the hotspot's network rather than creating its own.
- Operation State: The camera must be in a shooting mode (Still, Movie, or S&Q).
- Menu Lock: If you are inside the camera's internal menu, the API will return errors for most commands. Stay on the live shooting screen.
- Discovery: SSDP (auto-discovery) can be blocked by certain hotspots/routers. If the camera is not found, you will need to find the IP address from your hotspot's client list (usually
192.168.x.x).
pip install sony-camera-manager
# For developers
pip install sony-camera-manager[dev]from sony_camera_manager import SonyCameraClient
# Auto-discovery
host = SonyCameraClient.discover()
if not host:
host = "192.168.122.1" # Fallback
cam = SonyCameraClient(host=host)Sony cameras change their available APIs based on their current mode (e.g., Movie vs Still).
# Check what's supported by the hardware
print(cam.get_api_list())
# Check what's available in the current mode
print(cam.get_available_api_list())
# Generic capability helpers
supported_iso = cam.get_supported("IsoSpeedRate")
available_f_numbers = cam.get_available("FNumber")from sony_camera_manager.models import ExposureMode
# Set Manual Mode
cam.set_shoot_mode(ExposureMode.MANUAL)
# Adjust Exposure
cam.set_f_number("5.6")
cam.set_shutter_speed("1/100")
cam.set_iso_speed_rate("400")
# Focus tracking
cam.act_tracking_focus(0.5, 0.5) # Center
# Take a photo and wait for result
image_urls = cam.await_take_picture()import cv2
import numpy as np
for jpeg in cam.get_liveview_stream():
img = cv2.imdecode(np.frombuffer(jpeg, np.uint8), cv2.IMREAD_COLOR)
cv2.imshow('Sony Liveview', img)
if cv2.waitKey(1) == ord('q'): break
cv2.destroyAllWindows()
cam.stop_liveview()SonyCameraClient: Main interface for controlling the camera.transport: Low-level JSON-RPC communication handler (internal).models: Dataclasses and Enums for Camera state and settings.exceptions: Custom exception hierarchy (CameraError, ConnectionError, etc.).
- Sony Camera Remote API Documentation
- libsonyapi (Method catalog inspiration)
- pysony (Protocol reference)