Cameras

View on GitHub

Documentation / Cameras

Cameras

A Camera node tells Looksee where frames come from. MediaMTX ingests every source, exposes it to the inference service as one RTSP path per camera, and serves the same stream to browsers over WebRTC for the live monitor.

Source types

Source typeFieldHow it is ingested
RTSPrtsp:// or rtsps:// URLMediaMTX pulls the stream on demand. Most IP cameras and NVRs.
RTMPrtmp:// or rtmps:// URLMediaMTX pulls the stream on demand.
SRTsrt:// URLMediaMTX pulls the stream on demand.
Browser webcamnonePublisher mode. Studio publishes the browser's camera over WebRTC (WHIP) to MediaMTX.
WHEPhttp://, https://, whep://, or wheps:// URLMediaMTX pulls a remote WebRTC endpoint.
Filean asset keyA video from the asset library is cached locally and looped as a live stream.

Pull sources connect on demand. MediaMTX connects when inference or a browser requests the path and disconnects ten seconds after the last reader leaves. Looksee stores the upstream URL in the workflow. Signed-in users who can view the workflow can also see any credentials in that URL.

RTSP, RTMP, and SRT

Enter the URL your camera or encoder publishes. Notes for common setups:

  • Use the camera's substream (720p or lower) rather than the main stream. Detection runs at a few frames per second and does not benefit from 4K, while decoding it costs CPU.
  • H.264 decodes everywhere. H.265 works for detection but browsers do not play it over WebRTC, so the live monitor stays black while alerts still arrive.
  • MediaMTX pulls RTSP over TCP. If a camera only offers UDP, put it behind a relay that speaks TCP.
  • A camera on another network needs to be reachable from the machine running Looksee; the browser never connects to the camera directly.

Browser webcam

A camera with source type Browser webcam has no URL. When the workflow runs and the editor or the monitor is open, Studio asks for permission to use the webcam and publishes it to MediaMTX from the browser. The monitor shows a Publish and Stop publish button for these cameras. Closing the tab stops the stream; the camera goes back to Pending until a browser publishes again.

Studio publishes to RUNTIME_MEDIAMTX_WEBRTC_URL. See Networking for the signalling and media ports.

Video files

A File camera plays an object from the asset library on a loop, which is useful for testing a workflow against a recording. The asset library is an S3-compatible bucket. The Compose stack bundles one, the storage service backed by RustFS with the storage_data volume, and creates the bucket on start; set the S3_* variables to use an external endpoint such as Cloudflare R2 or MinIO instead. Without a configured bucket the Assets picker and the /assets endpoints are disabled; when the bucket is configured but unreachable, they answer 503.

Files are uploaded through Studio or POST /assets. On start the API downloads the object into the media cache volume, which MediaMTX reads to loop the file with ffmpeg. Object keys are restricted to letters, digits, ., _, -, and / because they end up inside that ffmpeg command.

MediaMTX

MediaMTX runs as the mediamtx service with the configuration in docker/mediamtx/mediamtx.yml. Looksee manages its paths through the control API on port 9997; the file itself only sets protocols and authentication:

  • MediaMTX accepts RTSP over TCP and uses WebRTC for browser playback and publishing. The RTMP, HLS, and SRT listeners are disabled. MediaMTX can still pull from RTMP and SRT upstreams.
  • Authentication is delegated to the API: MediaMTX calls /internal/media/auth for every reader, publisher, and control API request. The inference service and the API use the service user, MTX_MEDIA_USER with MTX_MEDIA_PASSWORD; browsers present a short-lived, camera-scoped grant issued by the API. Security has the details.

Every camera has the path name of its camera id. The inference service reads rtsp://mediamtx:8554/<camera id> and browsers play ${RUNTIME_MEDIAMTX_WEBRTC_URL}/<camera id>/whep.

Networking

Live video reaches the browser over WebRTC, which needs more than an open web port:

Host port (default)ProtocolWho connects
MTX_WEBRTC_PORT (8889)TCPBrowsers, for WebRTC signalling and playback (WHEP) and webcam publishing (WHIP)
MTX_WEBRTC_ICE_PORT (8189)UDPBrowsers, for the WebRTC media (ICE)
MTX_RTSP_PORT (8554)TCPEncoders that push RTSP into the path of a Browser webcam camera (publisher mode); not needed for pull sources

WEBRTC_HOST_IP must be the address browsers can reach: 127.0.0.1 on a laptop, the LAN address on a server. MediaMTX advertises it in ICE candidates; a wrong value results in a monitor that connects and then shows Connection disconnected. Deployment covers reverse proxies and TLS.

Camera status

The monitor shows the status badge next to the camera name and the workflow list shows it per workflow.

  • Pending (Starting in the monitor): the worker is starting. For pull sources the first frame usually arrives within a few seconds; the inference service gives up after FIRST_FRAME_TIMEOUT_SECONDS (30 seconds) and reports an error.
  • Active (Live in the monitor): frames are flowing.
  • Error: the stream failed or stalled for 30 seconds. The API retries with a delay that doubles from 30 seconds up to 5 minutes. The reason is shown in the monitor and in the api and inference logs.
  • Off: the workflow is stopped.

Troubleshooting lists the common causes of Pending and Error.