How to Configure RTSP Streaming Streams in AtomCam Tools: Codecs and Setup Guide

AtomCam Tools provides a built-in v4l2rtspserver supporting up to three simultaneous RTSP streams with AVC (H.264) and HEVC (H.265) video codecs, configurable via the web UI or the atomhack.ver INI file.

The mnakada/atomcam_tools repository enhances ATOM Cam and WyzeCam V3 devices with a full-featured RTSP server implementation. This guide explains how to configure RTSP streaming streams, select video codecs, and manage the underlying configuration files based on the actual source code implementation.

Supported RTSP Streaming Streams and Video Codecs

AtomCam Tools exposes up to three independent video channels through the RTSP server, each with specific codec capabilities determined by hardware capabilities.

Main Stream (video0)

The primary high-definition stream outputs 1080p resolution and always supports AVC (H.264) encoding. On ATOM Cam hardware, this same channel can alternatively output HEVC (H.265) when the Main HEVC option is enabled.

Main HEVC Stream (video2)

Available exclusively on ATOM Cam devices, this dedicated channel provides 1080p streaming using HEVC (H.265) compression. It utilizes camera channel 2, distinct from the main AVC stream.

Sub Stream (video1)

The secondary stream provides lower resolution for bandwidth-constrained scenarios: 360p on ATOM Cam or 320p on WyzeCam V3. Codec support varies by hardware: HEVC (H.265) on ATOM Cam and AVC (H.264) on WyzeCam V3.

How to Configure RTSP Streams in the Web UI

The Vue-based web interface provides direct control over stream enablement and codec selection through the Streaming tab.

Enabling Video Streams

The interface uses toggle switches bound to configuration keys in web/source/vue/Setting.vue:

<SettingSwitch i18n="RTSP.main" v-model="config.RTSP_VIDEO0" />
<SettingSwitch i18n="RTSP.mainHEVC" v-model="config.RTSP_VIDEO2" />
<SettingSwitch i18n="RTSP.sub" v-model="config.RTSP_VIDEO1" />

Setting these values to on enables the respective streams.

Configuring Audio Codecs

For each enabled video stream, you can attach audio using the corresponding RTSP_AUDIO* configuration keys. Available options include:

  • off – No audio
  • S16_BE – PCM 16-bit big-endian
  • AAC – Advanced Audio Coding
  • OPUS – Required for HomeKit and WebRTC integration

The Vue template implements this as:

<SettingSelect v-if="config.RTSP_VIDEO0 === 'on'" i18n="RTSP.main.audio"
               v-model="config.RTSP_AUDIO0"
               :label="['off', 'S16_BE', 'AAC', 'OPUS']" />

Network and Security Options

The UI provides additional toggles for transport and authentication:

  • RTSP over HTTP – Changes the transport port from 8554 to 8080
  • RTSP auth – Enables username/password protection

These settings modify how clients connect to the stream endpoints.

Manual Configuration via INI File and Scripts

Advanced users can configure streams directly through the atomhack.ver INI file and shell scripts without using the web interface.

Configuration File Location

The system stores RTSP settings in the atomhack.ver file, typically located at /etc/atomhack.ver. The initialization script overlay_rootfs/scripts/rtspserver.sh parses this file using awk:

HACK_INI=/etc/atomhack.ver

RTSP_VIDEO0=$(awk -F "=" '/^RTSP_VIDEO0 *=/ {print $2}' $HACK_INI)
RTSP_AUDIO0=$(awk -F "=" '/^RTSP_AUDIO0 *=/ {print $2}' $HACK_INI)
RTSP_VIDEO2=$(awk -F "=" '/^RTSP_VIDEO2 *=/ {print $2}' $HACK_INI)
RTSP_VIDEO1=$(awk -F "=" '/^RTSP_VIDEO1 *=/ {print $2}' $HACK_INI)

Service Control

The init script /etc/init.d/S58rtspserver (generated from rtspserver.sh) manages the server lifecycle. It uses the /scripts/cmd helper to start or stop individual channels:

/scripts/cmd video 0 $RTSP_VIDEO0   # Controls Main stream (AVC)

/scripts/cmd video 2 $RTSP_VIDEO2   # Controls Main HEVC stream

/scripts/cmd video 1 $RTSP_VIDEO1   # Controls Sub stream

Manual Configuration Example

To manually enable the Main stream with OPUS audio via shell commands:


# Write configuration to INI file

echo "RTSP_VIDEO0=on" > /etc/atomhack.ver
echo "RTSP_AUDIO0=OPUS" >> /etc/atomhack.ver

# Restart the RTSP service to apply changes

/etc/init.d/S58rtspserver restart

RTSP URL Format and Client Access

Once configured, streams are accessible via standard RTSP URLs that vary based on transport and authentication settings.

URL Construction Logic

The web interface constructs accessible URLs in web/source/vue/Setting.vue using the following logic:

const port = (config.RTSP_OVER_HTTP === 'on') ? 8080 : 8554
const auth = (config.RTSP_AUTH === 'on' && config.RTSP_USER && config.RTSP_PASSWD)
           ? `${config.RTSP_USER}:${config.RTSP_PASSWD}@` : ''
const url = `rtsp://${auth}${location.hostname}:${port}/ch0`

Standard Endpoint Mapping

Stream Channel Path Default Port
Main (AVC) /ch0 8554
Sub /ch1 8554
Main HEVC /ch2 8554

When RTSP over HTTP is enabled, the server listens on port 8080 instead of 8554.

Client Connection Examples

Connect using VLC or ffplay with the constructed URL:


# Standard RTSP connection to Main stream

ffplay rtsp://192.168.1.100:8554/ch0

# With authentication enabled

ffplay rtsp://admin:password@192.168.1.100:8554/ch0

# RTSP over HTTP (port 8080)

ffplay rtsp://192.168.1.100:8080/ch0

Technical Implementation and Dependencies

The RTSP functionality relies on a custom buildroot package that integrates the v4l2rtspserver with hardware-specific kernel support.

Server Package Configuration

The v4l2rtspserver package is defined in custompackages/package/v4l2rtspserver/Config.in with the following dependencies:

config BR2_PACKAGE_V4L2RTSPSERVER
    bool "v4l2rtspserver"
    select BR2_PACKAGE_V4L2CPP
    select BR2_PACKAGE_LIVE555
    select BR2_PACKAGE_LOG4CPP
    select BR2_PACKAGE_OPUS

This configuration ensures the server supports AVC through standard V4L2 interfaces, AAC via faad2/faac libraries, and OPUS via libopus for WebRTC compatibility.

HEVC Hardware Support

HEVC encoding requires kernel-level support provided by the patch file patches/kernel/linux-v4l2-hevc.patch. This patch enables the V4L2 HEVC driver that exposes the hardware encoder present on ATOM Cam devices. WyzeCam V3 hardware lacks this encoder, which is why HEVC streams are restricted to ATOM Cam models.

Bitrate Configuration

The web interface exposes bitrate controls for each codec variant through web/source/vue/Setting.vue:

<SettingInputNumber i18n="videoSpec.bitrateMain" v-model="config.BITRATE_MAIN_AVC" />
<SettingInputNumber v-if="distributor === 'ATOM'" i18n="videoSpec.bitrateMainHEVC"
                    v-model="config.BITRATE_MAIN_HEVC" />
<SettingInputNumber i18n="videoSpec.bitrateSub"
                    v-model="config.BITRATE_SUB_HEVC" />

These settings map to configuration keys that control the encoder bitrate for each stream independently.

Summary

  • AtomCam Tools provides a built-in v4l2rtspserver supporting up to three simultaneous RTSP streams via the Web UI or atomhack.ver configuration file.
  • Video codec support includes AVC (H.264) on all devices and HEVC (H.265) exclusively on ATOM Cam hardware through kernel patches.
  • Stream configuration is managed through keys RTSP_VIDEO0, RTSP_VIDEO1, and RTSP_VIDEO2 in the INI file, parsed by overlay_rootfs/scripts/rtspserver.sh.
  • Audio options range from PCM (S16_BE) to AAC and OPUS, with OPUS being mandatory for HomeKit and WebRTC integration.
  • Client access uses standard RTSP URLs on port 8554 (or 8080 for HTTP transport) with endpoints /ch0, /ch1, and /ch2.

Frequently Asked Questions

What video codecs does AtomCam Tools support for RTSP?

AtomCam Tools supports AVC (H.264) on both ATOM Cam and WyzeCam V3 devices for the main stream. HEVC (H.265) is available exclusively on ATOM Cam hardware for the Main HEVC and Sub streams, enabled through specific kernel patches (linux-v4l2-hevc.patch) that expose the hardware encoder via V4L2 interfaces.

How do I enable HEVC/H.265 streaming?

To enable HEVC streaming, access the Streaming tab in the web UI and toggle the RTSP Main HEVC switch (ATOM Cam only). This sets RTSP_VIDEO2=on in the atomhack.ver configuration file. Alternatively, manually edit /etc/atomhack.ver to include RTSP_VIDEO2=on and restart the service with /etc/init.d/S58rtspserver restart.

Can I run all three RTSP streams simultaneously?

Yes, the v4l2rtspserver supports publishing all three streams concurrently. Enable RTSP Main (video0), RTSP Sub (video1), and RTSP Main HEVC (video2 - ATOM only) simultaneously through the web UI switches or by setting RTSP_VIDEO0=on, RTSP_VIDEO1=on, and RTSP_VIDEO2=on in the configuration file. Each stream operates independently with its own codec and bitrate settings.

How do I secure my RTSP streams with password protection?

Enable authentication by toggling RTSP auth in the web UI, which sets RTSP_AUTH=on in the configuration. Define credentials using RTSP_USER and RTSP_PASSWD keys in atomhack.ver. When authentication is active, clients must include credentials in the URL (e.g., rtsp://username:password@192.168.1.100:8554/ch0) as implemented in the URL construction logic within web/source/vue/Setting.vue.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →