Compares audio content of streaming media to determine if they're the same source. Supports HLS and Icecast/MP3 streams.
- Stream type auto-detection (HLS/Icecast/MP3)
- Synchronized recording of live streams
- Smart audio alignment detection
- Configurable comparison duration
- Detailed similarity scoring
- Verbose debugging output
pip install -r requirements.txt
apt-get install ffmpeg
Compare two Icecast streams: ./compare_streams.py https://stream1.example.com https://stream2.example.com
Compare with 60 second sample: ./compare_streams.py https://stream1.example.com https://stream2.example.com -d 60
Enable verbose output: ./compare_streams.py https://stream1.example.com https://stream2.example.com -v
-d, --duration Duration in seconds to compare (default: 30) -s, --segments Number of segments for HLS comparison (default: 5) -v, --verbose Increase output verbosity --max-offset Maximum time offset for alignment in seconds (default: 1.0)
- Python 3.7+
- ffmpeg
- Required Python packages (see requirements.txt)
- Auto-detects stream type (HLS/Icecast/MP3)
- Records synchronized samples from both streams
- Normalizes audio data
- Finds optimal time alignment between samples
- Calculates similarity score based on correlation
- Reports match percentage
Similarity scores:
- 90%+ : Almost certainly same source
- 70-90%: Very likely same source
- 50-70%: Some similarities, possibly same source
- <50%: Different sources
MIT License - see LICENSE file
Pull requests welcome! Please see CONTRIBUTING.md