Video Encoding

Video encoding is configured per-camera in camera_server_config.json by adding a venc_config entry to the camera’s config. When specified, the camera server instantiates a video encoder for that camera and outputs VideoEncodedPackets in shared memory. These packets can be consumed directly in user applications the same way raw images are.

Sol3 provides two built-in ways to access encoded video:

  • sol3_rtsp_server — Runs on the Sol3 device and creates RTSP endpoints for each camera with venc_config. Any RTSP client (VLC, GStreamer, etc.) on the network can connect. See RTSP Streaming.

  • sol3src GStreamer plugin — A GStreamer source element that reads VideoEncodedPackets from shared memory directly into a GStreamer pipeline. Must run on the Sol3 device. Supports recording to disk, local display, and streaming over TCP or UDP. See GStreamer Plugin.

Important

At most two cameras in a single sol3_camera_server configuration may use "pixel_format": "PIX_NV12". The HAL-side Spectra ISP debayer used by NV12 only has two debayer contexts; configuring a third NV12 camera causes the HAL to deadlock at startup. The camera server enforces this cap and refuses to start if it is exceeded. PIX_RAW cameras are unaffected (debayering happens later in the pipeline).

Camera Server Setup

Add venc_config to the target camera’s config in /opt/sol3/etc/camera_server/camera_server_config.json:

{
  "camera_configs": [
    {
      "cam_num": "GMSL_CAMERA_02",
      "camera_type": "IMX565_COLOR",
      "bit_depth": "SENSOR_BIT_DEPTH_10",
      "gmsl_link_speed": "GMSL_LINK_6_GBS_MIPI_HIGHSPEED",
      "width": 0,
      "height": 0,
      "pixel_format": "PIX_RAW",
      "venc_config": {
        "width": 1920,
        "height": 1080,
        "codec": "CODEC_H265",
        "target_bitrate_bps": 20000000,
        "gop": 30
      },
      "max_isp_ring_buffers": 10,
      "external_trigger": false
    }
  ]
}

The camera’s top-level width and height set the capture resolution; values of 0 select the sensor’s native resolution. venc_config.width and venc_config.height set the encoder output resolution; values of 0 match the input resolution. codec accepts CODEC_H264 or CODEC_H265.