This guide will help you set up and run your first energy-efficient streaming tests.
- Docker (20.10+) and Docker Compose (2.0+)
- Python 3.11 or later
- FFmpeg installed on the host machine
- Intel CPU with RAPL support (for power monitoring)
- NVIDIA GPU with nvidia-container-toolkit (for GPU monitoring)
- Git for cloning the repository
git clone https://github.com/psantana5/ffmpeg-rtmp.git
cd ffmpeg-rtmppip install -r requirements.txtFor development:
pip install -r requirements-dev.txtThe setup script will verify all prerequisites:
./scripts/setup.shOr manually check:
# Check Docker
docker --version
docker compose version
# Check Python
python3 --version
# Check FFmpeg
ffmpeg -version
# Check RAPL access
cat /sys/class/powercap/intel-rapl:0/energy_ujmake up-buildThis command will:
- Create necessary directories (
test_results,streams) - Build all Docker images
- Start all services
- Wait for services to become healthy
docker compose up -d --buildmake nvidia-up-buildmake ps
# or
docker compose psAll containers should show status "Up" and "healthy".
-
Grafana: http://localhost:3000
- Username:
admin - Password:
admin - You'll be prompted to change the password on first login
- Username:
-
VictoriaMetrics: http://localhost:8428
- Check targets: http://localhost:8428/targets
- All targets should be "UP" (green)
-
Alertmanager: http://localhost:9093
# Quick health check
curl http://localhost:9500/health # RAPL exporter
curl http://localhost:9501/health # Docker stats
curl http://localhost:9502/health # Results exporter
# Or use the health checker script
python3 src/exporters/health_checker/check_exporters_health.py# Check RAPL metrics
curl http://localhost:9500/metrics | grep rapl_power_watts
# Check Docker metrics
curl http://localhost:9501/metrics | grep docker_cpu_percentagepython3 scripts/run_tests.py single \
--name "my_first_test" \
--bitrate 2000k \
--resolution 1280x720 \
--duration 60This will:
- Start an FFmpeg process streaming to nginx-rtmp
- Monitor power consumption during the test
- Save results to
test_results/test_results_YYYYMMDD_HHMMSS.json
# Analyze results
python3 scripts/analyze_results.py
# View in Grafana
# Open http://localhost:3000
# Navigate to "Power Monitoring Dashboard"python3 scripts/run_tests.py multi \
--count 4 \
--bitrate 2500k \
--duration 120python3 scripts/run_tests.py batch --file batch_stress_matrix.jsonThe test runner shows:
Starting test: my_first_test
Bitrate: 2000k
Resolution: 1280x720
Duration: 60s
[========================================] 60/60s
Test complete!
Results saved to: test_results/test_results_20231215_143022.json
python3 scripts/analyze_results.pyShows:
- Power consumption statistics
- Energy usage
- Efficiency rankings
- Recommendations for optimal settings
Power Monitoring Dashboard:
- Real-time power consumption
- CPU/Memory usage
- Network traffic
- Container metrics
Baseline vs Test Dashboard:
- Compares test scenarios against baseline
- Shows power deltas
- Highlights efficiency improvements
Energy Efficiency Dashboard:
- Efficiency scores per scenario
- Cost analysis
- Throughput per watt metrics
-
Test different bitrates:
python3 scripts/run_tests.py single --bitrate 5000k --duration 60
-
Test different resolutions:
python3 scripts/run_tests.py single --resolution 1920x1080 --duration 60
-
Stress test with multiple streams:
python3 scripts/run_tests.py multi --count 8 --duration 120
Train models on your hardware:
# Run several tests first
python3 scripts/run_tests.py batch --file batch_stress_matrix.json
# Train models
python3 scripts/retrain_models.py
# Analyze with predictions
python3 scripts/analyze_results.py --multivariate --predict-future 1,2,4,8,16Edit prometheus-alerts.yml to set power thresholds:
- alert: HighPowerConsumption
expr: rapl_power_watts > 200
for: 5m
annotations:
summary: "Power consumption above 200W"Then reload Prometheus:
make prom-reload- Open Grafana: http://localhost:3000
- Navigate to a dashboard
- Click the gear icon () to edit
- Add panels, modify queries, change visualizations
- Save your changes
# Check logs
make logs SERVICE=prometheus
make logs SERVICE=rapl-exporter
# Restart a specific service
docker compose restart rapl-exporter
# Rebuild and restart everything
make down
make up-buildRAPL requires Intel CPU and proper permissions:
# Check RAPL availability
ls -l /sys/class/powercap/intel-rapl:0/
# If permission denied, grant read access
sudo chmod -R a+r /sys/class/powercap/Ensure nginx-rtmp is running and healthy:
docker compose ps nginx-rtmp
curl http://localhost:8080/stat# Verify test_results directory exists
ls -la test_results/
# Check results-exporter logs
make logs SERVICE=results-exporter
# Restart results-exporter
docker compose restart results-exporterFor NVIDIA GPU support:
# Check nvidia-docker installation
docker run --rm --gpus all nvidia/cuda:11.0-base nvidia-smi
# Start with NVIDIA profile
make nvidia-up-build
# Check dcgm-exporter logs
make logs SERVICE=dcgm-exporterIf you see "port is already allocated" errors:
# Check what's using the port
sudo lsof -i :9090
# Either stop the conflicting service or change the port in docker-compose.ymlTest results and Prometheus data can grow:
# Check disk usage
du -sh test_results/
docker system df
# Clean up old results
rm test_results/test_results_2023*.json
# Clean up Docker volumes
docker volume pruneIf containers are slow:
# Check container resource usage
docker stats
# Increase Docker resources in Docker Desktop settings
# Recommended: 4+ CPU cores, 8+ GB RAM- Check the main documentation
- Review troubleshooting guide
- Check container logs:
make logs SERVICE=<service> - Verify VictoriaMetrics targets: http://localhost:8428/targets
- Ask in the project issues: https://github.com/psantana5/ffmpeg-rtmp/issues
Now that you have the basics working:
- Read the Architecture documentation
- Explore the Test Runner Guide
- Learn about Energy Advisor and ML models
- Understand the Exporters
- Set up production monitoring