Professional CLI application for receiving NDI video streams and displaying them on LED screens.
- Installation
- Quick Start
- Command Line Options
- Configuration File
- Usage Examples
- Architecture
- Future: Server Integration
# Install dependencies
pip3 install -r requirements.txt
# Make executable
chmod +x ndi_receiver.py# Automatically finds sources ending with '_led'
python3 ndi_receiver.pypython3 ndi_receiver.py --list-sources# Enable CPU performance mode and run
python3 ndi_receiver.py --cpu-performance| Option | Default | Description |
|---|---|---|
-s, --source SOURCE |
Auto-detect | Specific NDI source name |
--source-suffix SUFFIX |
_led |
Auto-detect sources ending with suffix |
--scan-timeout N |
2 |
Seconds to wait for source discovery |
--color-format FORMAT |
bgra |
Color format (bgra, uyvy, rgba) |
Note: bgra format provides best performance (60 FPS) as it requires no conversion.
| Option | Default | Description |
|---|---|---|
-r, --resolution WxH |
320x320 |
Display resolution |
-f, --fullscreen |
Off | Run in fullscreen mode |
--rotation ANGLE |
180 |
Screen rotation (0, 90, 180, 270) |
--position POS |
center |
Screen position (center, top-left, etc.) |
--show-fps |
Off | Show FPS counter on screen |
--video-driver DRIVER |
auto |
SDL video driver |
| Option | Description |
|---|---|
--cpu-performance |
Set CPU to performance mode (requires sudo) |
--priority N |
Process priority (-20 to 19, negative = higher) |
| Option | Description |
|---|---|
--test-pattern |
Run test pattern mode (no NDI) |
--list-sources |
List available NDI sources and exit |
--debug |
Enable debug logging |
--config FILE |
Load configuration from JSON file |
-v, --version |
Show version and exit |
Create a config.json file for persistent settings:
{
"ndi": {
"source_suffix": "_led",
"scan_timeout": 2,
"color_format": "bgra"
},
"display": {
"resolution": "320x320",
"fullscreen": false,
"rotation": 180,
"position": "center",
"show_fps": false
},
"performance": {
"cpu_performance_mode": true,
"priority": -10
}
}Load configuration:
python3 ndi_receiver.py --config config.jsonNote: Command line arguments override config file settings.
# Auto-detect source ending with '_led'
python3 ndi_receiver.py
# Connect to specific source
python3 ndi_receiver.py --source "MACBOOKAIR (catatumbo_led)"
# Different suffix for source detection
python3 ndi_receiver.py --source-suffix "_display"# Full screen with FPS counter
python3 ndi_receiver.py --fullscreen --show-fps
# Different resolution and rotation
python3 ndi_receiver.py --resolution 640x480 --rotation 90
# Position in top-right corner
python3 ndi_receiver.py --position top-right# Maximum performance
python3 ndi_receiver.py --cpu-performance --priority -10
# Or use sudo to run with high priority
sudo python3 ndi_receiver.py --priority -10# List all NDI sources on network
python3 ndi_receiver.py --list-sources
# Run test patterns (no NDI required)
python3 ndi_receiver.py --test-pattern
# Debug mode for troubleshooting
python3 ndi_receiver.py --debug# Recommended studio configuration
python3 ndi_receiver.py \
--source-suffix "_led" \
--resolution 320x320 \
--rotation 180 \
--position center \
--cpu-performanceled_test/
├── ndi_receiver.py # Main CLI application
├── src/
│ ├── __init__.py
│ ├── ndi_handler.py # NDI source management
│ ├── display_handler.py # Display and rendering
│ ├── config.py # Configuration management
│ ├── server_handler.py # WebSocket (future)
│ └── test_patterns.py # Test pattern mode
├── config.example.json # Example configuration
├── led_test_pattern.py # Original test patterns
├── ndi_receiver_native_display.py # Legacy receiver (60 FPS)
└── docs/
ndi_handler.py
- NDI source discovery
- Auto-detection with suffix matching
- Frame reception with configurable format
- Connection management
display_handler.py
- Pygame display initialization
- Frame rendering with rotation/positioning
- FPS tracking and display
- Event handling (ESC to exit)
config.py
- JSON configuration loading
- YAML support (optional, requires PyYAML)
- Hierarchical configuration merging
server_handler.py
- WebSocket communication (to be implemented)
- Command/control protocol
- Status reporting
- See Future: Server Integration
- Modular: Each component is independent and testable
- Extensible: Easy to add new features (WebSocket, plugins, etc.)
- CLI-first: All functionality accessible via command line
- Configuration: Support both CLI args and config files
- Logging: Comprehensive logging for debugging
The architecture supports future WebSocket server integration:
- Remote Control: Change NDI source, resolution, rotation via WebSocket
- Status Monitoring: Real-time FPS, connection status, errors
- Multi-device Management: Control multiple LED receivers from one server
- Configuration Sync: Push config updates to all receivers
Commands from Server:
{"cmd": "set_source", "source": "name"}
{"cmd": "set_resolution", "width": 320, "height": 320}
{"cmd": "set_rotation", "angle": 180}
{"cmd": "reconnect"}
{"cmd": "shutdown"}Status Updates to Server:
{"type": "status", "fps": 60.0, "source": "name", "frames": 1000}
{"type": "heartbeat", "timestamp": 1234567890}
{"type": "error", "message": "Connection lost"}- Use
websocketsorpython-socketiolibrary - Async event loop for non-blocking communication
- Thread-safe command queue for main loop
- Authentication via token
- Automatic reconnection with exponential backoff
Logs are written to:
- Console: INFO and above
- File:
ndi_receiver.log- all messages
Enable debug logging:
python3 ndi_receiver.py --debugLog format:
2025-10-10 01:36:18,837 - ndi_receiver - INFO - LED Receiver v1.0.0 starting...
2025-10-10 01:36:19,032 - ndi_receiver.ndi - INFO - NDI initialized (format: bgra)
# List sources with debug info
python3 ndi_receiver.py --list-sources --debug
# Check network connectivity
ping <ndi-sender-ip>
# Verify NDI SDK is installed
ldconfig -p | grep ndi# Try different video drivers
python3 ndi_receiver.py --video-driver kmsdrm
python3 ndi_receiver.py --video-driver directfb
python3 ndi_receiver.py --video-driver x11
# Run test patterns (no NDI)
python3 ndi_receiver.py --test-pattern# Enable performance mode
python3 ndi_receiver.py --cpu-performance
# Use BGRA format (fastest)
python3 ndi_receiver.py --color-format bgra
# Check actual source FPS
python3 ndi_receiver.py --show-fps --debug# Add user to video group
sudo usermod -a -G video $USER
# Then logout and login againPress ESC or Ctrl+C to exit the application gracefully.
Version: 1.0.0
Last Updated: October 10, 2025
Performance: 60 FPS with BGRA format