Create video streams
Publish a camera asset and start an RTSP, MPEG-TS or SRT ingress stream.
Publish a camera asset entity, start an ingress stream over RTSP, MPEG-TS or SRT, and attach the stream to the entity so operators can view the feed in the Lattice UI.
Before you begin
- To publish a camera asset and start a stream, set up your Lattice environment.
- See an overview of the Video Manager API and stream lifecycle in Lattice.
These gRPC examples authenticate with a static environment token attached as request metadata. If you are using OAuth 2.0 client credentials instead, set up the token refresh module before running the examples on this page.
Start a stream
Lattice supports the following video streaming protocols:
RTSP
MPEG-TS
SRT
If you don’t already have an RTSP source, stand one up with MediaMTX:
Install MediaMTX
Download a pre-built MediaMTX binary for your platform from the MediaMTX releases page and place it on the host that publishes the camera feed.
Configure the RTSP listener
In your mediamtx.yml, set the RTSP listener address and define a /cam or similar path that reads from the local camera.
Set source to match your camera; see the MediaMTX paths documentation for the available source types.
Before attaching a video to an asset, the asset must exist as a Lattice entity. Publish a camera entity with the
TEMPLATE_ASSET ontology and a PlatformType of CAMERA, then refresh it on a heartbeat so it does not expire:
Publish a camera
Construct an Entity with the components Lattice needs to render a friendly land-based camera asset on the common
operational picture (COP). ExpiryTime is set 60 seconds out and paired with a five-second publish loop, so the entity stays alive as long as the publisher runs. The camera’s module builds the entity:
To publish the entity on a heartbeat, run the publish_camera program from
Create an asset.
The heartbeat loop is the simplest pattern for keeping a transient asset alive. For long-running deployments,
consider publishing from a supervised service that resets ExpiryTime based on hardware health rather than a fixed interval.
MPEG-TS ingress is supported only at the edge, in closed networks. If you connect to Lattice over the public internet, you
can’t start an MPEG-TS stream, though you can still list or inspect an existing IngressStream that uses it.
Before attaching a video to an asset, the asset must exist as a Lattice entity. Publish a camera entity with the
TEMPLATE_ASSET ontology and a PlatformType of CAMERA, then refresh it on a heartbeat so it does not expire.
Publish a camera
Construct an Entity with the components Lattice needs to render a friendly land-based camera asset on the common
operational picture (COP). ExpiryTime is set 60 seconds out and paired with a five-second publish loop, so the entity stays alive as long as the publisher runs. The camera’s module builds the entity:
To publish the entity on a heartbeat, run the publish_camera program from
Create an asset.
The heartbeat loop is the simplest pattern for keeping a transient asset alive. For long-running deployments,
consider publishing from a supervised service that resets ExpiryTime based on hardware health rather than a fixed interval.
Allocate a stream endpoint
If your source can’t accept inbound RTSP connections, for example an encoder behind a NAT gateway or a push-only device, you can request Lattice to create an endpoint where you send transport stream packets over UDP.
Send an empty MpegTsSettings in the request. The response contains mpeg_ts.url, the endpoint your
video encoder pushes to. The example also calls OverrideEntity to attach the new video to the camera asset:
Push the stream
Encode and push the camera with ffmpeg.
The following captures from a macOS FaceTime camera using H.264. Replace <LATTICE-MPEG-TS-URL>:<PORT>
with the endpoint and port returned in mpeg_ts.url:
The pkt_size=1316 query batches seven 188-byte transport stream packets per UDP packet, keeping each one under a
standard 1500-byte Ethernet MTU and avoiding IP fragmentation.
Use SRT when your source pushes video and you want low-latency delivery with optional AES encryption. Lattice allocates the listener and returns the endpoint your producer pushes to.
Before attaching a video to an asset, the asset must exist as a Lattice entity. Publish a camera entity with the
TEMPLATE_ASSET ontology and a PlatformType of CAMERA, then refresh it on a heartbeat so it does not expire.
Publish a camera
Construct an Entity with the components Lattice needs to render a friendly land-based camera asset on the common
operational picture (COP). ExpiryTime is set 60 seconds out and paired with a five-second publish loop, so the entity stays alive as long as the publisher runs. The camera’s module builds the entity:
To publish the entity on a heartbeat, run the publish_camera program from
Create an asset.
The heartbeat loop is the simplest pattern for keeping a transient asset alive. For long-running deployments,
consider publishing from a supervised service that resets ExpiryTime based on hardware health rather than a fixed interval.
Allocate a stream endpoint
Send an SrtSettings in the request. To encrypt the stream, set an optional passphrase; leave it empty for an
unencrypted stream. The response contains an SrtIngress with a url and a session_id that the producer must
use on the connection. The example also calls OverrideEntity to attach the new video to the camera asset:
Once packets start arriving, operators select the camera asset in Lattice to view the live feed.

Re-publish a stream to a downstream consumer
An egress stream re-publishes a live stream out of Lattice so an external consumer, such as another C2 system, a recorder, or an analytics pipeline, can pull the feed. A single ingress stream can feed many egress consumers, each with its own transport and egress stream.
Creating an egress stream requires the ingress_id of a live stream. Use the ID returned when you
started the stream, or discover it with ListIngressStreams.
The source must be live: Lattice rejects a stream whose status is STREAM_STATUS_UNAVAILABLE as not-live.
CreateEgressStream returns an egress_id. Persist it to retrieve or
stop the egress stream later. Egress over both RTSP and SRT is pull-based:
Lattice hosts the endpoint and the downstream consumer connects to pull the feed.
RTSP
SRT
Lattice hosts an RTSP server for the egress stream and returns the URL to distribute to consumers. Send empty RTSP settings
to select the transport; no source URL is needed, because Lattice sources the frames from the ingress stream. The response
contains an RtspEgress with a url that downstream consumers pull from:
Lattice allocates an SRT listener for the egress stream and returns the endpoint consumers pull from. To encrypt the stream,
set an optional passphrase; leave it empty for an unencrypted stream. The response contains an SrtEgress with a url and
a session_id that the consumer must supply on the connection, along with the passphrase if you set one:
What’s next
- Learn how to manage existing streams.