Camera Media Route Configuration
Introduction
In devices using interfaces like MIPI or GMSL, configuring media routes is necessary to define the data flow between subdevices, including sensors, CSI receivers, and ISPs, within the media pipeline.
A media route defines how video or image data travels through these entities — specifying which source pad connects to which destination pad. Without a proper route setup, the device driver may not activate the pipeline correctly, and image streaming or capture could fail.
media-ctl to YAML Conversion Guide
This section explains how to convert traditional media-ctl route configuration commands into a YAML file format.
The YAML format provides a structured and human-readable way to define media routing configurations, making it easier to manage and setup across multiple devices with our SDK.
For more YAML file examples, see the Routes YAML
media-ctl command Overview
media-ctl is a command-line utility used to configure and inspect media controller devices in Linux.
Typical commands look like this:
media-ctl -R "'crossbar' [2/0 -> 5/0 [1]]"
media-ctl -l "'tevs 1-0048':0 -> 'csidev-4ad30000.csi':0 [1]"
The
-Roption sets internal routes between pads of entities within a device.
The-loption sets links between different entities in the media graph.
YAML Format Overview
The YAML format separates internal Routes and external MediaLinks into two distinct sections:
Routes:
- device: "crossbar"
links:
- {src: "2/0", dst: "5/0", enable: 1}
MediaLinks:
- {src: "tevs 1-0048:0", dst: "csidev-4ad30000.csi:0", enable: 1}
- Fields Explanation
Field Decription device Entity name of the media device links Lists the routing paths, similar to those defined in media-ctlsrc Source pad of the route(or media link) dst Destination pad of the route(or media link) enable 1means the route or link is enabled,0means disabled
When two cameras are connected to Raspberry Pi 5 with identical media entity names, a single YAML link entry is sufficient to configure both cameras.
[Raspberry Pi 5 YAML Template]
Activate the Media Routes
After setting the routes in YAML file, you can activate these routes by VizionSDK API or run the command from vizion-ctl directly.
-
Using VizionSDK API to load and activate the YAML file
- C++
- Python
- C#
- C
std::string yamlPath = "routes.yaml";
std::shared_ptr<VxRoute> yamlRoutes = VxLoadRouteYaml(yamlPath);
if(yamlRoutes != nullptr) {
VxActivateYamlRoutes(yamlRoutes);
}yamlPath = "routes.yaml"
routesYaml = pyvizionsdk.VxLoadRouteYaml(yamlPath)
if routesYaml:
pyvizionsdk.VxActivateYamlRoutes(routesYaml)string yamlPath = "routes.yaml";
VxRoute yamlRoutes = CSVizionSDK.VxLoadRouteYaml(yamlPath);
if(yamlRoutes != null) {
CSVizionSDK.VxActivateYamlRoutes(yamlRoutes);
}char* yaml_path = "route.yaml";
vx_route yaml_route = vx_load_route_yaml(yaml_path);
if(yaml_route != NULL){
vx_activate_yaml_routes(yaml_route);
}
vx_release_yaml_route(yaml_route); -
Using
vizion-ctlto activate the routevizion-ctl --setroute <YAML_FILE_PATH>
If the route fails to set successfully, verify that the YAML file is correctly formatted.
You can also use the VxResetActiveRoutes or vizion-ctl --reset-route to clear all active routes and then reapply the desired routes.