A TypeScript/Node.js service to monitor DASH/MPEG-DASH live streams for errors and inconsistencies. Provides REST API and Prometheus metrics for integration with monitoring dashboards.
- π― DASH/MPEG-DASH Monitoring - Monitor one or more DASH streams continuously
- π Prometheus Metrics - OpenMetrics endpoint for Grafana dashboards
- π Error Detection - Validates MPD structure, periods, timing, and staleness
- π REST API - Full API for programmatic control
- π³ Docker Ready - Includes Dockerfile and docker-compose setup
- π¦ Library & CLI - Use as a library or standalone service
The monitor performs comprehensive validation:
- β Manifest Availability - HTTP fetch success with proper error codes
- β XML Parsing - Valid MPD XML structure
- β MPD Structure - Required attributes and proper schema
- β Period Continuity - No gaps or overlaps in periods
- β Publish Time - Progressive updates for live streams
- β Staleness Detection - Configurable threshold for manifest updates
- β Segment Timeline - Timeline gaps, overlaps, and duration validation
- β Codec & Bitrate - Validates codec formats and bitrate ranges
- β Resolution & Aspect Ratio - Quality metadata validation
- β±οΈ Time Shift Buffer - Ensures proper DVR window configuration
- π― Presentation Delay - Validates suggested presentation delay settings
- π Multi-Period Transitions - Detects gaps and overlaps at period boundaries
- π‘ Segment Availability - Optional HTTP checks for actual segment availability
npm install @eyevinn/dash-monitorOr clone and build:
git clone https://github.com/Eyevinn/dash-monitor.git
cd dash-monitor
npm install
npm run build# Start the service
npm start
# Or with custom port
npm start -- -p 3000
# Using Docker
docker-compose upconst { DASHMonitor } = require('@eyevinn/dash-monitor');
const monitor = new DASHMonitor([
'https://example.com/stream.mpd'
], {
staleLimit: 6000, // 6 seconds
monitorInterval: 3000 // Check every 3 seconds
});
// Start monitoring
await monitor.start();
// Get errors
const errors = monitor.getErrors();
console.log(errors);
// Stop monitoring
monitor.stop();POST /monitor
Content-Type: application/json
{
"urls": [
"https://example.com/stream.mpd",
{ "url": "https://example.com/stream2.mpd", "id": "custom-id" }
],
"options": {
"staleLimit": 6000,
"monitorInterval": 3000,
"errorLimit": 10
}
}
Response: { "monitorId": "uuid", "streamCount": 2 }GET /monitor
Response: {
"monitors": [
{
"monitorId": "uuid",
"state": "active",
"createdAt": 1234567890,
"streamCount": 2
}
]
}GET /monitor/:monitorId/status
Response: {
"monitorId": "uuid",
"state": "active",
"lastChecked": 1234567890,
"streamCount": 2,
"errorCount": 5,
"errors": [...],
"manifestFetchErrors": {...}
}PUT /monitor/:monitorId/streams
Content-Type: application/json
{
"urls": ["https://example.com/new-stream.mpd"]
}
Response: { "monitorId": "uuid", "streamCount": 3 }DELETE /monitor/:monitorId/stream
Content-Type: application/json
{
"streamId": "stream-id"
}
Response: { "monitorId": "uuid", "removed": true, "streamCount": 2 }DELETE /monitor/:monitorId/status
Response: { "monitorId": "uuid", "cleared": true }DELETE /monitor/:monitorId
Response: { "deleted": true }Access metrics at /metrics:
# Monitor info
dash_monitor_info{monitor_id, stream_count, created_at}
# Monitor state
dash_monitor_state{monitor_id, state}
# Total errors per stream
dash_monitor_stream_total_errors{monitor_id, stream_id}
# Time since last error
dash_monitor_stream_time_since_last_error_seconds{monitor_id, stream_id}
# Manifest fetch errors
dash_monitor_manifest_fetch_errors{monitor_id, url, status_code}
# Current error count
dash_monitor_error_count{monitor_id}
| Option | Type | Default | Description |
|---|---|---|---|
staleLimit |
number | 6000 | Milliseconds before manifest considered stale |
monitorInterval |
number | 3000 | Milliseconds between checks |
errorLimit |
number | 10 | Maximum errors to store (FIFO) |
logConsole |
boolean | true | Enable console logging |
| Option | Type | Default | Description |
|---|---|---|---|
enableSegmentAvailabilityCheck |
boolean | false | Enable HTTP segment availability checks (use cautiously) |
segmentCheckSampleSize |
number | 3 | Number of segments to check when availability checking is enabled |
| Variable | Description | Default |
|---|---|---|
PORT |
Service port | 8080 |
NODE_ENV |
Environment | development |
# Build image
docker build -t dash-monitor .
# Run container
docker run -p 8080:8080 dash-monitordocker-compose up -dAccess:
- DASH Monitor: http://localhost:8080
- Prometheus: http://localhost:9090
- Grafana: http://localhost:3000 (admin/admin)
Deploy to Eyevinn Open Source Cloud:
- Push to GitHub
git init
git add .
git commit -m "Initial commit"
git remote add origin https://github.com/your-org/dash-monitor.git
git push -u origin main- Deploy with Web Runner
osc create eyevinn-web-runner dash-monitor \
-o GitHubUrl=https://github.com/your-org/dash-monitor \
-o GitHubToken="{{secrets.ghtoken}}" \
-o OscAccessToken="{{secrets.osctoken}}"- Create Monitor Manager (Optional)
Similar to the HLS monitor setup, you can create a manager service that reads from CouchDB and automatically adds/removes streams.
| Error Type | Description |
|---|---|
MANIFEST_FETCH_ERROR |
Failed to fetch MPD manifest |
XML_PARSE_ERROR |
Invalid XML structure |
MPD_STRUCTURE_ERROR |
Missing required MPD attributes |
PERIOD_CONTINUITY_ERROR |
Period timing issues |
STALE_MANIFEST |
Manifest hasn't updated within threshold |
PUBLISH_TIME_ERROR |
Publish time went backwards |
SEGMENT_TIMELINE_ERROR |
Segment timeline inconsistencies |
SEGMENT_AVAILABILITY_ERROR |
Segments not available |
| Error Type | Description |
|---|---|
PERIOD_TRANSITION_ERROR |
Gaps or overlaps detected at period transitions |
# Install dependencies
npm install
# Build
npm run build
# Run tests
npm test
# Start development server
npm run devTest with public DASH streams:
curl -X POST http://localhost:8080/monitor \
-H "Content-Type: application/json" \
-d '{
"urls": [
"https://dash.akamaized.net/akamai/bbb_30fps/bbb_30fps.mpd"
]
}'Check metrics:
curl http://localhost:8080/metricsβββββββββββββββββββ
β DASHMonitor β Core monitoring engine
β - Validates β
β - Tracks errorsβ
β - Manages stateβ
ββββββββββ¬βββββββββ
β
ββ MPDLoader (fetch & parse)
ββ ErrorsList (FIFO storage)
ββ Validation Logic
ββ Structure
ββ Periods
ββ Timing
ββ Staleness
βββββββββββββββββββββββ
β DASHMonitorService β REST API & Metrics
β - Fastify server β
β - API endpoints β
β - Prometheus exportβ
βββββββββββββββββββββββ
| Feature | HLS Monitor | DASH Monitor |
|---|---|---|
| Manifest Format | M3U8 (text) | MPD (XML) |
| Parser Library | @eyevinn/m3u8 | mpd-parser |
| Key Validations | Media sequences, discontinuities | Periods, publish time, XML structure |
| API Pattern | β Same | β Same |
| Metrics | β Prometheus | β Prometheus |
| Docker | β Yes | β Yes |
In addition to contributing code, you can help to triage issues. This can include reproducing bug reports or asking for vital information such as version numbers or reproduction instructions.
Copyright 2024 Eyevinn Technology
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Join our community on Slack where you can post any questions regarding any of our open-source projects. Eyevinn's consulting business can also offer you:
- Further development of this component
- Customization and integration of this component into your platform
- Support and maintenance agreement
Contact [email protected] if you are interested.
Eyevinn Technology is an independent consultant firm specializing in video and streaming. Independent in a way that we are not commercially tied to any platform or technology vendor.
At Eyevinn, every software developer consultant has a dedicated budget reserved for open source development and contribution to the open source community. This gives us room for innovation, team building, and personal competence development. And also gives us as a company a way to contribute back to the open source community.
Want to know more about Eyevinn and how it is to work here. Contact us at [email protected]!