More frames = more vision API calls = higher cost.
from videodb import SceneExtractionType# Economical: 1 frame per scenevideo.index_scenes( extraction_type=SceneExtractionType.time_based, extraction_config={"time": 30, "frame_count": 1}, prompt="Describe the scene")# Premium: 5 frames per scenevideo.index_scenes( extraction_type=SceneExtractionType.time_based, extraction_config={"time": 10, "frame_count": 5}, prompt="Describe the activity and how it progresses")
Shorter intervals = more scenes = more processing.
# Long interval: fewer scenes, lower costvideo.index_scenes( extraction_type=SceneExtractionType.time_based, extraction_config={"time": 60}, # 1 scene per minute prompt="Describe the main topic")# Short interval: more scenes, higher costvideo.index_scenes( extraction_type=SceneExtractionType.time_based, extraction_config={"time": 5}, # 12 scenes per minute prompt="Describe what's happening")
# Non-blocking with callbackscene_index_id = video.index_scenes( prompt="Describe the scene", callback_url="https://your-backend.com/webhooks/index-complete")# Check status laterscene_index = video.get_scene_index(scene_index_id)print(scene_index.status) # "processing" or "completed"
Create multiple indexes at different quality levels:
# Fast, cheap index for preview/discoverypreview_index = video.index_scenes( extraction_type=SceneExtractionType.time_based, extraction_config={"time": 60, "frame_count": 1}, prompt="What is the main topic?", name="preview")# Detailed index for deep searchdetailed_index = video.index_scenes( extraction_type=SceneExtractionType.time_based, extraction_config={"time": 10, "frame_count": 3}, prompt="Describe people, objects, and actions in detail", name="detailed")
# Index spoken content immediately (cheap)video.index_spoken_words()# Index visuals only when needed (expensive)if user_requests_visual_search: video.index_scenes(prompt="Describe the scene")
For large libraries, process during off-peak hours:
# Queue videos for background indexingfor video in coll.get_videos(): video.index_scenes( prompt="Describe the scene", callback_url="https://your-backend.com/webhooks" )
video.index_spoken_words() # Always index speech (cheap)video.index_scenes( extraction_type=SceneExtractionType.time_based, extraction_config={"time": 60, "frame_count": 1}, prompt="Describe the main content")