AI Auto-Tracking Guide

This guide walks you through enabling AI auto-tracking on a live stream. Given a fixed wide-angle source feed that captures the entire field of play, Visionular analyzes each frame in real time, locates the tracked object (e.g., the ball), and produces an auto-framed output stream that mimics a human camera operator following the action — no operator required.

Typical use cases: amateur volleyball/soccer matches, training sessions, and school events where a dedicated camera operator is unavailable.


Prerequisites

Before proceeding, ensure you have the following ready:

  • Valid API Key (for Basic Authentication).
  • AI Tracking entitlement enabled on your account. If your account is not provisioned for this feature, requests will fail with error code 100504 (Your account has no AI tracking permission). Contact your account manager to have it enabled.
  • A fixed, wide-angle source camera capturing the full field (see Source Stream Recommendations below).
  • Python 3.x and the requests library (for the code examples below).

Source Stream Recommendations

AI auto-tracking works by cropping a moving "virtual camera" window out of a much wider source frame. The wider and sharper your source, the better the output looks. Use one of the following recommended input resolutions:

Source ResolutionAspect RatioTypical ScenarioRecommended Output
8192x1728≈ 4.74 : 1 (ultra-wide 8K)Single fixed camera capturing the entire court/pitch with plenty of headroom for the virtual camera to pan.1920x1080
1920x404≈ 4.75 : 1 (ultra-wide 2K)Bandwidth-constrained deployments where an 8K ingest is impractical.1280x720

Frame rate: The source stream must be 30 fps. Other frame rates are not supported by the AI tracking pipeline.

Why these resolutions? Both share the same ultra-wide aspect ratio, which matches the typical side-court fixed camera framing used in volleyball and soccer. Feeding a standard 16:9 source will still work, but the virtual camera has less room to pan, and fast action near the edges may be clipped.


Supported Tracking Objects

tracking_objectSportFraming Logic
volleyballVolleyballTracks the ball; keeps all active players on both sides of the net in the frame when possible.
soccerSoccer / FootballTracks the ball; widens the frame to keep nearby players in view during transitions.

API Reference

ActionHTTP MethodEndpointPurpose
1. Enable on createPOST/live/v1/live-streamsConfigure AI tracking when creating a new live stream.
Docs: Create a live stream
2. Update settingsPUT/live/v1/live-streams/{live_stream_id}/ai-tracking-settingsChange the tracked object or output resolution on an existing stream.
Docs: Update AI tracking settings
3. DisableDELETE/live/v1/live-streams/{live_stream_id}/ai-tracking-settingsRemove AI tracking from the stream.
Docs: Delete AI tracking settings

Critical State Dependency Warning

⚠️ IMPORTANT: The PUT and DELETE endpoints above can only be called when the live stream is in the idle state. To change or disable AI tracking on a running broadcast, stop the stream first, update the configuration, then restart the broadcast.


Feature Compatibility

AI tracking is compatible with most other live-stream features. The only hard conflict is with audio-only mode.

FeatureCompatible with AI Tracking?Notes / Error Code
audio_onlyReturns 100206 at create/update time.
simulcast_targetsSupported — your auto-framed output is pushed to every target.
watermark_settingsWatermark is applied on top of the auto-framed output.
record / dvrThe recorded asset matches the auto-framed output.
auto_generate_subtitle
embedded_closed_captions

Request Parameters (ai_tracking_setting)

ParameterTypeRequiredDescription
tracking_objectStringYesSport to track. One of volleyball, soccer.
target_resolutionStringNoOutput resolution. One of 1280x720, 1920x1080. Default: 1280x720.

Complete Code Examples (Python)

Example A: Create a Volleyball Auto-Tracking Stream

import requests
import json
url = "https://api.visionular.com/live/v1/live-streams"
payload = {
"user_metadata": "volleyball-demo",
"policy": ["public"],
"latency_mode": "standard",
"reconnect_window": 20,
"ai_tracking_setting": {
"tracking_object": "volleyball",
"target_resolution": "1280x720"
}
}
headers = {
"Content-Type": "application/json",
"Authorization": "Basic YOUR_BASE64_AUTH",
"Auth-Type": "use-basic"
}
response = requests.post(url, headers=headers, json=payload)
print(json.dumps(response.json(), indent=4))

Feed the returned stream_key into an ultra-wide source (e.g., 8192x1728) and you will see the auto-framed 1280x720 output on the returned playback_ids.

Example B: Switch an Existing Stream to Soccer at 1080p

Make sure the stream is idle before calling this endpoint.

import requests
import json
live_stream_id = "YOUR_LIVE_STREAM_ID"
url = f"https://api.visionular.com/live/v1/live-streams/{live_stream_id}/ai-tracking-settings"
payload = {
"ai_tracking_setting": {
"tracking_object": "soccer",
"target_resolution": "1920x1080"
}
}
headers = {
"Content-Type": "application/json",
"Authorization": "Basic YOUR_BASE64_AUTH",
"Auth-Type": "use-basic"
}
response = requests.put(url, headers=headers, json=payload)
print(json.dumps(response.json(), indent=4))

Example C: Disable AI Tracking

import requests
live_stream_id = "YOUR_LIVE_STREAM_ID"
url = f"https://api.visionular.com/live/v1/live-streams/{live_stream_id}/ai-tracking-settings"
headers = {
"Authorization": "Basic YOUR_BASE64_AUTH",
"Auth-Type": "use-basic"
}
response = requests.delete(url, headers=headers)
print(response.status_code) # 204 on success

Best Practices

  • Lock your source framing before kickoff. The auto-tracking window is derived from the source frame; any mid-match camera repositioning will confuse the tracker.
  • Push the source at exactly 30 fps. AI tracking only processes 30 fps sources — streams pushed at other frame rates will fail or produce degraded output.
  • Match target_resolution to your players' devices. Use 1920x1080 if most viewers watch on desktop/TV; stick with 1280x720 for mobile-first audiences or bandwidth-constrained networks.
  • Enable AI tracking at creation time whenever possible. Reserving PUT/DELETE changes for between-match switches avoids the idle-state constraint.
  • Combine with record: true if you want a highlight-ready VOD asset of the auto-framed output.

Troubleshooting

SymptomLikely CauseResolution
100504 — no AI tracking permissionFeature not provisioned on your account.Contact your account manager.
100206 — incompatible with audio-onlyRequest also enabled audio_only.Remove audio_only from the payload.
100117 / 100120 — stream active or disabledPUT / DELETE called on a non-idle stream.Stop the stream, then retry.
Output looks zoomed in / crops actionSource feed is too narrow.Switch to one of the recommended ultra-wide source resolutions.
Output looks soft or jitterySource bitrate too low or frame rate ≠ 30 fps.Raise source bitrate, ensure the encoder is set to exactly 30 fps, and use a stable wired connection.