Skip to main content
Pull JPEG frames from the camera’s live-view stream at a configurable rate. The server exposes GET /api/cameras/{id}/live-view/frame returning image/jpeg — binary data that sits outside the typed SDK surface. This recipe is the “get frames” pattern.

When to use

  • Showing a preview in your UI (a <canvas> or <img> that updates ~15fps)
  • Feeding frames to ML inference
  • Recording a timelapse from the live view feed
  • Any case where you want the camera’s viewfinder, not a captured photo

Prerequisites

The camera must be connected in remote or remote-transfer mode, and live view must be enabled + started:
Frames are ~70-80 KB each on the A7 IV. At 15fps that’s ~1.2 MB/s — tolerable over USB, not great over WiFi.

TypeScript

Complete recipe

Usage — write frames to disk

Usage — render to a <canvas> in the browser

Usage — render to an <img> (simpler, no ImageBitmap)


Python

Complete recipe

Usage — write frames to disk

Usage — stream to ML inference


Swift

Complete recipe

Usage — SwiftUI preview


Performance notes

  • Don’t go below ~50ms interval. The server encodes JPEGs on every request; hammering it harder than camera can produce frames wastes CPU.
  • 15fps (66ms) is a good default. The camera’s live view is typically capped around 15-30fps internally.
  • Back-pressure is free. Each recipe is a pull-based generator — if your consumer is slow, frames simply aren’t fetched, they don’t pile up in memory.
  • Keep-alive matters. All three recipes reuse a single HTTP client (fetch pool, httpx.AsyncClient, URLSession.shared) so TCP connections are reused — significantly faster than a fresh connection per frame.

Starting live view before polling

Live view must be enabled + started on the camera first. Easiest full flow:
start auto-enables live view if it’s off, but being explicit reads better.

Verified against

The same validation pattern was used during live-camera test runs — poll a few frames, verify JPEG magic bytes, and save one to disk. Confirmed working against the live ILCE-7M4 at ~70-80 KB/frame.