Overview
wink-hls-stats is a powerful command-line tool for analyzing HTTP Live Streaming (HLS) streams at the HTTP/segment level. Get deep insights into stream performance, CDN behavior, and delivery quality - plus actionable recommendations to fix issues before they impact viewers.
Key Features
- Actionable Diagnostics - Don't just see problems - understand how to fix them. Get specific recommendations for cache configuration, keyframe alignment, variant selection, and more.
- Real-Time Visibility - Watch your HLS streams perform in real-time with an interactive mtr-like console interface.
- No Dependencies - Single binary, zero external dependencies. No ffmpeg, no video codecs, no complex installations.
- CDN Intelligence - Automatically detect CDN providers, track cache hit rates, identify load balancer behavior.
- CI/CD Ready - JSON output and threshold-based exit codes make it perfect for automated testing pipelines.
Installation
Pre-built Binaries
Download the latest release for your platform:
- Linux (x86_64, arm64)
- macOS (x86_64, Apple Silicon)
- Windows (x86_64, arm64)
Verify Installation
$ ./wink-hls-stats version
Quick Start
$ wink-hls-stats analyze https://example.com/stream.m3u8 --parse-segments
$ wink-hls-stats manifest https://example.com/stream.m3u8
$ wink-hls-stats monitor https://example.com/live.m3u8
$ wink-hls-stats compare https://origin/s.m3u8 https://cdn/s.m3u8
$ wink-hls-stats analyze https://example.com/stream.m3u8 --output json
Commands
analyze
Full stream analysis with segment fetching, timing metrics, and actionable recommendations.
$ wink-hls-stats analyze <url> [flags]
Fetches and parses the HLS manifest, selects a variant, and downloads segments while measuring HTTP timing (TTFB, download time, throughput). Provides recommendations for cache configuration, keyframe alignment, and variant selection.
Key outputs:
- Segment timing (TTFB, throughput with p50/p95)
- Cache hit/miss analysis with warnings
- Keyframe alignment warnings (with
--parse-segments)
- ABR variant recommendations
- Error breakdown by category
manifest
Quick manifest inspection without segment fetching.
$ wink-hls-stats manifest <url> [flags]
Fetches and parses the HLS manifest, displaying variant information (bandwidth, resolution, codecs) and media playlist details.
monitor
Continuous live stream monitoring with real-time display and latency estimation.
$ wink-hls-stats monitor <url> [flags]
Provides an interactive mtr-like display that continuously monitors a live HLS stream. Shows estimated live latency, playlist refresh status, and segment arrival times.
Key outputs:
- Estimated live latency (the first question everyone asks)
- Playlist refresh timing
- Stale playlist detection
- Real-time segment fetches
compare
Compare two HLS streams side-by-side with summary recommendations.
$ wink-hls-stats compare <url1> <url2> [flags]
Analyzes two streams (e.g., origin vs CDN, or two CDN providers) and displays comparative metrics with a summary of differences.
Comparison Summary:
Stream 2 adds +45ms TTFB
Stream 2 improves throughput by +15.2 Mbps
Stream 2 cache hit rate: +80%
Flags Reference
| Flag |
Default |
Description |
--output, -o |
console |
Output format: console, json |
--timeout, -t |
10s |
HTTP request timeout |
--variant, -v |
-1 |
Variant index: -1 = highest, 0 = lowest, n = specific |
--all-variants |
false |
Test all variants sequentially |
--segments, -n |
10 |
Number of segments to fetch |
--parse-segments |
false |
Parse TS/fMP4 for keyframe detection |
--duration, -d |
30s |
Maximum analysis duration |
--trace-ips |
false |
Track resolved IP addresses per segment |
--header, -H |
- |
Custom HTTP header (can repeat) |
--insecure, -k |
false |
Skip TLS certificate verification |
--error-threshold |
0 |
Exit code 2 if error rate > n% |
--latency-threshold |
0 |
Exit code 3 if TTFB > n ms |
--throughput-threshold |
0 |
Exit code 4 if throughput < n kbps |
Understanding Recommendations
wink-hls-stats doesn't just report metrics - it provides actionable recommendations to fix issues.
Cache Warnings
Cache Warnings:
! 0% cache hit rate - check cache key configuration or TTL
What it means: Segments are being fetched from origin every time. CDN caching is not working as expected.
How to fix:
- Check
Cache-Control headers on your origin
- Verify CDN cache key configuration (query strings, cookies)
- Ensure TTL is appropriate for segment duration
- Look for
Vary headers that might be creating unique cache keys
Keyframe Alignment Warnings
Playlist Warnings:
! 5 segment(s) don't start with keyframe - may cause slow channel change
What it means: Segments don't begin with an IDR/keyframe. Players must wait for a keyframe before displaying video, causing black frames and slow tune-in times.
How to fix:
- Configure encoder to place keyframes at segment boundaries
- Set GOP size = segment duration (e.g., 4s segments = GOP of 4s)
- Enable "scene cut detection" in encoder with forced keyframe alignment
ABR Variant Recommendations
ABR Simulation:
Measured Bandwidth: 57.8 Mbps
Recommended: 1080p @ 4712 kbps
Safe Fallback: 720p @ 2493 kbps
Variant Bandwidth Headroom Risk (p95)
1080p 4712 kbps 12.3x MEDIUM
720p 2493 kbps 23.2x NONE
Understanding risk levels:
- NONE: P95 throughput provides 3x+ headroom - very safe
- LOW: P95 throughput provides 2-3x headroom - safe
- MEDIUM: P95 throughput provides 1.2-2x headroom - may rebuffer on bad connections
- HIGH: P95 throughput provides <1.2x headroom - high rebuffer risk
Why P95 matters: Average throughput hides problems. Your "100 Mbps average" might have 5% of requests at 5 Mbps. P95 shows real worst-case performance that affects users.
IP Flip Warnings
Infrastructure:
IP Flips: 7
! frequent IP flips may indicate DNS/LB instability
What it means: Backend IP is changing frequently between requests. May indicate DNS TTL issues or load balancer churn.
How to fix:
- Increase DNS TTL for origin/CDN endpoints
- Check load balancer sticky session configuration
- Verify CDN edge selection is stable
Error Breakdown
Error Breakdown:
HTTP 4xx (client): 2
HTTP 5xx (server): 1
Timeouts: 3
Short Reads/EOF: 1
How to interpret:
- HTTP 4xx: Authentication, authorization, or bad request issues
- HTTP 5xx: Origin/CDN server errors - check server logs
- Timeouts: Network congestion or slow origin response
- Short Reads/EOF: Connection dropped mid-transfer - network stability issue
Exit Codes
wink-hls-stats uses exit codes for CI/CD integration:
| Code |
Name |
Description |
0 |
Success |
Analysis completed successfully |
1 |
General Error |
Unexpected error occurred |
2 |
Error Threshold |
Error rate exceeded --error-threshold |
3 |
Latency Threshold |
TTFB exceeded --latency-threshold |
4 |
Throughput Threshold |
Throughput below --throughput-threshold |
5 |
Manifest Failed |
Could not fetch or parse manifest |
6 |
No Segments |
Media playlist has no segments |
CI/CD Example
wink-hls-stats analyze https://staging.example.com/stream.m3u8 \
--segments 20 \
--parse-segments \
--error-threshold 1 \
--latency-threshold 500 \
--throughput-threshold 5000 \
--output json > /tmp/stream-report.json
EXIT_CODE=$?
if [ $EXIT_CODE -ne 0 ]; then
echo "Stream quality check failed with exit code $EXIT_CODE"
cat /tmp/stream-report.json | jq '.summary, .infrastructure.cache_warnings'
exit 1
fi
echo "Stream validation passed"
Examples
Pre-Launch Checklist
$ wink-hls-stats manifest https://cdn.example.com/stream.m3u8
$ wink-hls-stats analyze https://cdn.example.com/stream.m3u8 --all-variants
$ wink-hls-stats analyze https://cdn.example.com/stream.m3u8 --parse-segments
$ wink-hls-stats analyze https://cdn.example.com/stream.m3u8 --segments 20
Debugging Slow Start / Black Frames
$ wink-hls-stats analyze https://cdn.example.com/stream.m3u8 \
--parse-segments \
--segments 10
Debugging Cache Issues
$ wink-hls-stats analyze https://cdn.example.com/stream.m3u8 \
--segments 30 \
--trace-ips
Comparing CDN Performance
$ wink-hls-stats compare \
https://origin.example.com/stream.m3u8 \
https://cdn.example.com/stream.m3u8 \
--segments 15
Live Stream Latency Check
$ wink-hls-stats monitor https://live.example.com/stream.m3u8 --duration 60s
Test URLs
Public HLS test streams for testing wink-hls-stats:
Multi-variant VOD
$ wink-hls-stats analyze "https://stream.mux.com/VZtzUzGRv02OhRnZCxcNg49OilvolTqdnFLEqBsTwaxU.m3u8"
$ wink-hls-stats analyze "https://sample.vodobox.net/skate_phantom_flex_4k/skate_phantom_flex_4k.m3u8"
$ wink-hls-stats analyze "http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8" --parse-segments
Cache Testing
$ wink-hls-stats analyze "https://playertest.longtailvideo.com/adaptive/captions/playlist.m3u8"
Troubleshooting
"Manifest parse failed" (Exit code 5)
- Verify the URL is accessible and returns valid M3U8 content
- Check for authentication requirements (
-H "Authorization: ...")
- Try
--insecure if using self-signed certificates
"No segments available" (Exit code 6)
- The media playlist may be empty (live stream not yet started)
- Try the manifest command to inspect the playlist structure
Low cache hit rate
- Check
Cache-Control headers on origin
- Look for query string variations in segment URLs
- Verify CDN cache key configuration
- Check for
Vary headers creating unique keys
Segments not starting with keyframe
- Configure encoder GOP = segment duration
- Enable keyframe alignment in packager
- Check for "scene cut detection" forcing mid-segment keyframes
High P95 vs average throughput gap
- Indicates inconsistent network/CDN performance
- Check for geographic routing issues
- Verify CDN edge capacity
- Consider using Safe Fallback variant recommendation