Refactor MediaMTX configuration and enhance RTSP streaming logging

- Removed outdated timeout settings from MediaMTX configuration for improved stream handling.
- Updated CameraStreamer class to include detailed logging for RTSP streaming state and frame dimension checks.
- Added environment variable support for configuring MediaMTX host, enhancing flexibility in deployment.
This commit is contained in:
salirezav
2025-11-01 12:58:30 -04:00
parent b7adc3788a
commit 3cb6a8e76e
4 changed files with 163 additions and 7 deletions

59
test_rtsp_working.md Normal file
View File

@@ -0,0 +1,59 @@
# RTSP Streaming is Working! 🎉
**Status**: ✅ RTSP streaming is functional and VLC can view the stream!
## Current Status
- ✅ FFmpeg is encoding and publishing frames
- ✅ MediaMTX is receiving the RTSP stream
- ✅ VLC can successfully view the stream via RTSP
- ⚠️ WebRTC requires the stream to be active when accessed
## Access Methods
### 1. RTSP (Working - Use This!)
```bash
rtsp://100.93.40.84:8554/camera1
```
**For VLC:**
- File → Open Network Stream
- URL: `rtsp://100.93.40.84:8554/camera1`
- Or with TCP: `rtsp://100.93.40.84:8554/camera1?transport=tcp`
### 2. WebRTC (Browser Player)
The WebRTC player needs the stream to be active when you open it.
**To use WebRTC:**
1. First, make sure RTSP is running:
```bash
curl -X POST http://exp-dash:8000/cameras/camera1/start-rtsp
```
2. Then quickly open (within 10 seconds):
```
http://100.93.40.84:8889/camera1/webrtc
```
**Note**: WebRTC uses POST requests to `/camera1/whep`, so 404/405 errors are normal if the stream isn't active.
## Troubleshooting WebRTC
If you see "stream not found" in the browser:
- The RTSP stream may have timed out
- Restart RTSP and immediately open the WebRTC URL
- MediaMTX closes streams after ~10 seconds without active viewers
## Quick Test Commands
```bash
# Check if RTSP is running
curl -X POST http://exp-dash:8000/cameras/camera1/start-rtsp
# Check stream status
curl -s http://localhost:8889/v2/paths/get/camera1 | python3 -m json.tool
# Full diagnostic
./diagnose_rtsp.sh
```