#!/bin/bash # Quick script to check RTSP streaming status echo "=== RTSP Streaming Status Check ===" echo "" echo "1. Starting RTSP stream (if not already running)..." RESPONSE=$(curl -s -X POST http://exp-dash:8000/cameras/camera1/start-rtsp) echo "$RESPONSE" | python3 -m json.tool 2>/dev/null || echo "$RESPONSE" echo "" echo "2. Waiting for stream to initialize (5 seconds)..." sleep 5 echo "3. Checking MediaMTX for stream..." PATH_INFO=$(curl -s http://localhost:8889/v2/paths/get/camera1 2>/dev/null) if [ -n "$PATH_INFO" ] && [ "$PATH_INFO" != "null" ] && [ "$PATH_INFO" != "{}" ]; then echo "$PATH_INFO" | python3 -m json.tool 2>/dev/null || echo "$PATH_INFO" SOURCE_READY=$(echo "$PATH_INFO" | python3 -c "import sys, json; d=json.load(sys.stdin); print(d.get('sourceReady', False))" 2>/dev/null || echo "false") if [ "$SOURCE_READY" = "True" ]; then echo "" echo "✅ Stream is READY!" else echo "" echo "⚠️ Stream path exists but source not ready yet" fi else echo "❌ Stream not found in MediaMTX" fi echo "" echo "4. Checking for FFmpeg process..." FFMPEG_PID=$(docker compose exec api bash -c "ps aux | grep '[f]fmpeg' | awk '{print \$2}'" 2>/dev/null | head -1) if [ -n "$FFMPEG_PID" ]; then echo "✅ FFmpeg is running (PID: $FFMPEG_PID)" else echo "❌ No FFmpeg process found" fi echo "" echo "5. Latest RTSP/FFmpeg logs..." docker compose logs api --tail 50 | grep -E "RTSP|FFmpeg|error|Broken pipe" | tail -10 echo "" echo "6. MediaMTX recent logs..." docker compose logs mediamtx --tail 10 | grep -E "camera1|RTSP|publishing" echo "" # Get Tailscale IP TAILSCALE_IP=$(tailscale ip -4 2>/dev/null || echo "") if [ -z "$TAILSCALE_IP" ]; then TAILSCALE_IP=$(hostname -I | awk '{print $1}') fi echo "=== Access URLs ===" echo "" echo "Your Tailscale IP: $TAILSCALE_IP" echo "" echo "📺 MediaMTX Web Interface (BEST - shows all streams with player):" echo " http://$TAILSCALE_IP:8889/static/" echo "" echo "📹 Direct WebRTC player for camera1:" echo " http://$TAILSCALE_IP:8889/camera1/webrtc" echo "" echo "🔗 RTSP URL (for VLC):" echo " rtsp://$TAILSCALE_IP:8554/camera1" echo "" echo "⚠️ IMPORTANT: Stream times out after ~10 seconds without a viewer!" echo " Start the stream, then QUICKLY open the web interface above" echo ""