ON THIS PAGE

  • MessageDemux
  • How to Place It
  • Inputs and Outputs
  • Usage
  • Examples of Functionality
  • Reference

MessageDemux

The MessageDemux (Demultiplexer) node is used to separate a MessageGroup into individual outputs. It currently serves as way to demultiplex the output of Sync node.

How to Place It

Python
C++
Python
1pipeline = dai.Pipeline()
2demux = pipeline.create(dai.node.MessageDemux)

Inputs and Outputs

Command Line
1/
2                 ┌───────────────────┐
3  input          │                   │
4  ──────────────►│                   │
5                 │    MessageDemux   │        output1
6                 │                   ├───────────►
7                 │                   │        output2
8                 │                   ├───────────►
9                 │                   │        ...
10                 └───────────────────┘
Message types
  • input - MessageGroup
  • output1, output2, ... - Individual output messages

Usage

The MessageDemux node is particularly useful for handling different types of data coming from a single source. For example, when the Sync node is used to synchronize the outputs of multiple nodes, the output of the Sync node is a MessageGroup containing all the messages from the synchronized nodes. The Demux node can be used to separate the messages into individual streams.
Python
C++
Python
1# Create sync node and set sync threshold
2sync = pipeline.create(dai.node.Sync)
3sync.setSyncThresholdMs(timedelta(milliseconds=100))
4
5# Create demux node
6demux = pipeline.create(dai.node.MessageDemux)
7
8# Sync the outputs of multiple nodes
9rgb.preview.link(sync.inputs["rgb"])
10stereo.depth.link(sync.inputs["depth"])
11script.outputs["out"].link(sync.inputs["script"])
12
13sync.out.link(demux.input) # Sync output is a MessageGroup containing all the messages from the synchronized nodes
14
15# Demux the MessageGroup into individual messages
16demux.outputs["rgb"].link(xout1.input)
17demux.outputs["depth"].link(xout2.input)
18demux.outputs["script"].link(xout3.input)

Examples of Functionality

Reference

class

depthai.node.MessageDemux(depthai.Node)

property
input
Input message of type MessageGroup
property
outputs
A map of outputs, where keys are same as in the input MessageGroup

Need assistance?

Head over to Discussion Forum for technical support or any other questions you might have.