Modern sports analysis faces growing challenges in providing real-time insights. From fast-paced plays to subtle player movements, monitoring every aspect of the game is tough.Traditional broadcasters use multiple camera angles but lack AI intelligence to automatically detect key moments and generate synchronized multi-angle highlights in real-time.What if AI could monitor all feeds, detect key plays instantly, and generate highlights automatically?
🏀 Basketball Arena - 3 Camera System├── CAM 1: Main Court Field (Wide Angle)│ └── rtsp://samples.rts.videodb.io:8554/bb-cam1│├── CAM 2: North Basket Area Field (Close Up)│ └── rtsp://samples.rts.videodb.io:8554/bb-cam2│└── CAM 3: South Basket Area Field (Close Up) └── rtsp://samples.rts.videodb.io:8554/bb-cam3
Define one analysis prompt and create indexes on all streams:
analysis_prompt = """Analyze this basketball game footage and describe:1. Player positions and movements on the court2. Ball location and which team has possession3. Any significant events (baskets scored, fouls, free throws, timeouts)4. Defensive and offensive plays being executed5. Crowd reactions or unusual activities"""# Create scene indexes for all camerasscene_indexes = {}for cam_name, rtstream in rtstreams.items(): scene_indexes[cam_name] = rtstream.index_visuals( batch_config={ "type": "time", "value": 15, "frame_count": 1, }, prompt=analysis_prompt, name=f"Basketball_Analytics_{cam_name.upper()}", )
Create three events that apply across all camera angles:
# Basket Scoredbasket_event_id = conn.create_event( event_prompt="Detect when a basket is scored - ball through hoop, celebrations, score change.", label="basket_scored",)# Foul Detectedfoul_event_id = conn.create_event( event_prompt="Detect fouls, aggressive behavior, or rule violations.", label="player_foul",)# Timeout Calledtimeout_event_id = conn.create_event( event_prompt="Detect when a timeout is called - players huddle or referee signals.", label="timeout_called",)
webhook_url = "https://your-webhook-url.com"# Create alerts for all events on all camerasfor cam_name, scene_index in scene_indexes.items(): scene_index.create_alert(basket_event_id, callback_url=webhook_url) scene_index.create_alert(foul_event_id, callback_url=webhook_url) scene_index.create_alert(timeout_event_id, callback_url=webhook_url)
Now you have 9 total alerts (3 events × 3 cameras).
When a basket is scored, each camera sends an alert:
{ "event_id": "event-basket-scored", "label": "basket_scored", "confidence": 0.95, "explanation": "The ball is directly above the rim and net, descending through the hoop, indicating a basket is being scored.", "timestamp": "2025-09-10T11:21:16.614553+00:00", "start_time": "2025-09-10T16:50:45.698108+05:30", "end_time": "2025-09-10T16:51:00.698108+05:30", "stream_url": "https://rt.stream.videodb.io/manifests/rts-019711db-1086-7750-ba79-8f47a4fed603/1757503245000000-1757503261000000.m3u8"}
The same event triggers on all 3 cameras, giving you synchronized multi-angle evidence.
Generate synchronized clips from all cameras for the same moment:
# When you receive a basket alert with timestamp, extract italert_timestamp = "2025-09-10T16:50:45.698108+05:30"import datetimeepoch_time = int(datetime.datetime.fromisoformat(alert_timestamp.replace("Z", "+00:00")).timestamp())# Generate streams from all cameras for same time window (±5 seconds)time_window = 5synchronized_streams = {}for cam_name, rtstream in rtstreams.items(): stream_url = rtstream.generate_stream( start=epoch_time - time_window, end=epoch_time + time_window ) synchronized_streams[cam_name] = stream_url
Now you have 3 synchronized video clips from different angles for the same moment.