Media Routes Overview
Media routes enable processing of visual data including barcode scanning and video streaming. These routes bridge the gap between image/video sources and your MQTT infrastructure.Barcode
Encode and decode barcodes (QR, Code128, EAN, etc.)
Video Input
Capture from RTSP, webcams, and files
Video Output
Stream to HTTP, RTSP, UDP, TCP
Barcode Route
TheBARCODE route enables encoding and decoding of various barcode formats including QR codes, Code 128, EAN-13, and more.
Basic Syntax
Configuration Parameters
Comma-separated barcode formats to support (e.g.,
QR_CODE, CODE_128, EAN_13).Event Parameters
MQTT topic with barcode image (base64) or data to encode.
MQTT topic to publish barcode results.
Operation mode:
ENCODE (create barcode) or DECODE (read barcode).Annotate decoded barcode location on image. Default: false.
Topic to publish annotated image (for DECODE mode).
Supported Formats
| Format | Description |
|---|---|
QR_CODE | QR Code (2D) |
CODE_128 | Code 128 (1D) |
CODE_39 | Code 39 (1D) |
EAN_13 | EAN-13 (1D retail) |
EAN_8 | EAN-8 (1D retail) |
UPC_A | UPC-A (1D retail) |
UPC_E | UPC-E (1D retail) |
DATA_MATRIX | Data Matrix (2D) |
PDF_417 | PDF417 (2D stacked) |
Barcode Examples
- Decode Barcode
- Encode Barcode
- Production Line Scanner
Scan barcodes from images:Input: Base64-encoded image on
camera/frameOutput: JSON with decoded data on barcode/decoded:Video Input Route
TheVIDEO_INPUT route captures video frames from RTSP streams, webcams, or video files and publishes them to MQTT topics.
Basic Syntax
Configuration Parameters
Video source: RTSP URL, webcam identifier, or file path.
MQTT topic to publish video frames.
Output format:
JPEG, MJPEG, H264, H265, MP4, MPEGTS.Frame rate for capture (1-60 fps).
Frame width in pixels.
Frame height in pixels.
JPEG quality (1-100).
Event Parameters
MQTT topic to control video capture.
Control command:
START, STOP, or CAPTURE <duration>.Video Input Examples
- RTSP Stream
- Webcam
- Video File
- Motion Detection
Capture from IP camera:
Video Output Route
TheVIDEO_OUTPUT route streams video frames from MQTT to various output protocols.
Basic Syntax
Configuration Parameters
MQTT topic with video frames (base64).
Output protocol:
HTTP, RTSP, UDP, TCP.Output path or port for streaming.
Event Parameters
Control command:
START or STOP.Video Output Examples
- HTTP Stream
- RTSP Output
- UDP Multicast
Stream via HTTP (MJPEG):Access stream at:
http://broker-ip:8081/videoComplete Example: Vision System
A complete vision system with camera input, barcode scanning, and video streaming:Best Practices
Optimize Frame Rate
Optimize Frame Rate
Use lower frame rates for bandwidth efficiency:
- Monitoring: 1-5 fps
- Motion detection: 2-5 fps
- Barcode scanning: 5-10 fps
- Live viewing: 15-30 fps
Choose Appropriate Resolution
Choose Appropriate Resolution
Balance quality and performance:
- Barcode scanning: 640x480 to 1280x720
- Monitoring: 1280x720
- High detail: 1920x1080
Use JPEG for MQTT
Use JPEG for MQTT
JPEG format is ideal for MQTT transport:
- Reasonable file sizes
- Wide compatibility
- Adjustable quality (60-90 recommended)
Handle Network Interruptions
Handle Network Interruptions
Configure reconnection for RTSP streams and monitor connection status.
Troubleshooting
RTSP Connection Failed
RTSP Connection Failed
- Verify RTSP URL format and credentials
- Check camera is accessible on network
- Ensure port is not blocked by firewall
- Try alternative RTSP paths (check camera documentation)
No Barcode Detected
No Barcode Detected
- Ensure image quality is sufficient
- Check barcode format is in SUPPORTED_FORMATS
- Verify barcode is properly visible in image
- Try higher resolution capture
High CPU Usage
High CPU Usage
- Reduce frame rate
- Lower resolution
- Decrease JPEG quality
- Process fewer simultaneous streams
Stream Latency
Stream Latency
- Use UDP for lowest latency
- Reduce frame size and quality
- Check network bandwidth
- Use local network when possible

