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

pipeline = dai.Pipeline()
demux = pipeline.create(dai.node.MessageDemux)
dai::Pipeline pipeline;
auto demux = pipeline.create<dai::node::MessageDemux>();

Inputs and Outputs

               ┌───────────────────┐
input          │                   │
──────────────►│                   │
               │    MessageDemux   │        output1
               │                   ├───────────►
               │                   │        output2
               │                   ├───────────►
               │                   │        ...
               └───────────────────┘

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.

# Create sync node and set sync threshold
sync = pipeline.create(dai.node.Sync)
sync.setSyncThresholdMs(timedelta(milliseconds=100))

# Create demux node
demux = pipeline.create(dai.node.MessageDemux)

# Sync the outputs of multiple nodes
rgb.preview.link(sync.inputs["rgb"])
stereo.depth.link(sync.inputs["depth"])
script.outputs["out"].link(sync.inputs["script"])

sync.out.link(demux.input) # Sync output is a MessageGroup containing all the messages from the synchronized nodes

# Demux the MessageGroup into individual messages
demux.outputs["rgb"].link(xout1.input)
demux.outputs["depth"].link(xout2.input)
demux.outputs["script"].link(xout3.input)
// Create sync node and set sync threshold
auto sync = pipeline.create<dai::node::Sync>();
sync->setSyncThreshold(std::chrono::milliseconds(100));

// Create demux node
auto demux = pipeline.create<dai::node::MessageDemux>();

// Sync the outputs of multiple nodes
rgb.preview.link(sync->input["rgb"]);
stereo.depth.link(sync->input["depth"]);
script.outputs["out"].link(sync->input["script"]);

sync->out.link(demux->input); // Sync output is a MessageGroup containing all the messages from the synchronized nodes

// Demux the MessageGroup into individual messages
demux->outputs["rgb"].link(xout1.input);
demux->outputs["depth"].link(xout2.input);
demux->outputs["script"].link(xout3.input);

Examples of Functionality

Reference

class depthai.node.MessageDemux
class Id

Node identificator. Unique for every node on a single Pipeline

getAssetManager(*args, **kwargs)

Overloaded function.

  1. getAssetManager(self: depthai.Node) -> depthai.AssetManager

  2. getAssetManager(self: depthai.Node) -> depthai.AssetManager

getInputRefs(*args, **kwargs)

Overloaded function.

  1. getInputRefs(self: depthai.Node) -> list[depthai.Node.Input]

  2. getInputRefs(self: depthai.Node) -> list[depthai.Node.Input]

getInputs(self: depthai.Node)list[depthai.Node.Input]
getName(self: depthai.Node)str
getOutputRefs(*args, **kwargs)

Overloaded function.

  1. getOutputRefs(self: depthai.Node) -> list[depthai.Node.Output]

  2. getOutputRefs(self: depthai.Node) -> list[depthai.Node.Output]

getOutputs(self: depthai.Node)list[depthai.Node.Output]
getParentPipeline(*args, **kwargs)

Overloaded function.

  1. getParentPipeline(self: depthai.Node) -> depthai.Pipeline

  2. getParentPipeline(self: depthai.Node) -> depthai.Pipeline

class dai::node::MessageDemux : public dai::NodeCRTP<Node, MessageDemux, MessageDemuxProperties>

Public Functions

MessageDemux(const std::shared_ptr<PipelineImpl> &par, int64_t nodeId)
MessageDemux(const std::shared_ptr<PipelineImpl> &par, int64_t nodeId, std::unique_ptr<Properties> props)

Public Members

Input input = {*this, "input", Input::Type::SReceiver, {{DatatypeEnum::MessageGroup, false}}}

Input message of type MessageGroup

OutputMap outputs

A map of outputs, where keys are same as in the input MessageGroup

Public Static Attributes

static constexpr const char *NAME = "MessageDemux"

Got questions?

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