Configure ONVIF Multi-Channel Support

Learn how to enable multiple channels on the Happytimesoft ONVIF Server by modifying the configuration file.

Introduction

The Happytimesoft ONVIF Server can simulate multi-channel devices (e.g., NVRs, multi-stream cameras) by configuring multiple <profile> entries in the onvif.cfg file.

This guide explains how to add channels and how resolution settings affect the device's behavior.

What is a Channel (Profile)?

In ONVIF, a Profile represents a media stream configuration, including video source, encoding, and resolution.

Each <profile> in onvif.cfg corresponds to one channel/stream that an ONVIF client can discover and connect to.

Step 1: Locate onvif.cfg

Find the onvif.cfg file in your ONVIF Server installation directory.

This file defines the server's configuration, including all available profiles (channels).

Step 2: Add Multiple Profiles

To add more channels, duplicate the <profile> block and modify the settings (e.g., resolution, bitrate).

Example: onvif.cfg with Two Channels
<profile>
    <video_source>
      <width>1280</width>
      <height>720</height>
    </video_source>
    <!-- Other settings... -->
</profile>

<profile>
    <video_source>
      <width>640</width>
      <height>480</height>
    </video_source>
    <!-- Other settings... -->
    </profile>
</profiles>

Each <profile> tag defines one channel.

Step 3: Understanding Resolution Impact

The video resolution in each profile determines how ONVIF clients (like Device Manager) interpret the channels.

Different Resolutions (Unique Channels)

If each profile has a different resolution (e.g., 1280x720 and 640x480), clients will display them as separate channels.

[ONVIF Device Manager View]
Channel 1: 1280x720 (Main Stream)
Channel 2: 640x480 (Sub Stream)

Same Resolution (Multiple Streams)

If multiple profiles have the same resolution (e.g., both 1280x720), clients may group them as multiple streams of the same channel.

[ONVIF Device Manager View]
Channel 1
├─ Stream 1: 1280x720
└─ Stream 2: 1280x720

Practical Applications

  • NVR Simulation: Simulate a 4/8/16-channel NVR by adding multiple profiles.
  • Multi-Stream Testing: Test how clients handle main and sub streams with different bitrates.
  • Compatibility Testing: Verify ONVIF client behavior with multi-channel devices.

Best Practices

  • Ensure each <profile> has a unique configuration (resolution, encoding) for clear channel separation.
  • Backup onvif.cfg before making changes.
  • If you modify the default configuration file onvif.cfg You should stop the onvif server first, then delete the runtime configuration onvifrun.cfg and run onvif server again to make the default configuration effective.