What is Scene Detection?
Scene detection is a technique used in video processing to identify and separate different scenes within a video. This is particularly useful for tasks such as video summarization, content analysis, and ad insertion.
The path to use scene detection:
Running Scene Detection
To run scene detection:
resp = moonshine.run(
flow = "core/scene-detection" ,
index = "your-index" ,
video_id = "[file_id].mp4"
)
Scene detection can only be run on one video at a time. If you need to process multiple videos, you will need to run the scene detection function for each video separately.
The response of scene detection follows:
JSON object (returned as a string) that contains the [output][scenes]
List of scene objects detected in the video
JSON object (returned as a string) that contains the [output][scenes]
List of scene objects detected in the video
Completion status of the scene-detection operation
Video ID (file name) of the analysed video
Where a scene item is made out of:
scenes.scene_id scenes.start_time scenes.end_time scenes.description scenes.type scenes.cues scenes.characters_or_subjects [output][scenes][].scene_id
Sequential identifier for the scene
[output][scenes][].scene_id
Sequential identifier for the scene
[output][scenes][].start_time
Start timestamp of the scene (HH:MM:SS)
[output][scenes][].end_time
End timestamp of the scene (HH:MM:SS)
[output][scenes][].description
Narrative summary of what happens in the scene
Scene category (e.g., “action-oriented”, “dialogue-driven”)
Salient visual or audio cues that define the scene
[output][scenes][].characters_or_subjects
Key people or subjects appearing in the scene
Example:
{
"output" : {
"scenes" : [
{
"scene_id" : 1 ,
"start_time" : "00:00:00" ,
"end_time" : "00:01:25" ,
"description" : "The initial segment of a basketball game at the Intuit Dome, featuring early plays, dunks, and three-pointers with ongoing commentary." ,
"type" : "action-oriented" ,
"cues" : "Close-ups, wide court shots, score progression, live commentary" ,
"characters_or_subjects" : "Sohan, Wembanyama, Harden, Champagne, other players"
}
]
},
"status" : "complete" ,
"video_id" : "[file_id].mp4"
}
Scene Detection Complete Example
A complete example over an entire index:
import moonshine
moonshine.configure( "YOUR-TOKEN-HERE" )
index = "my-videos"
items = moonshine.items( index = index)
for item in items:
file_id = item[ "file_id" ]
file_name = item[ "file_name" ]
print ( f "Processing video: { file_name } (ID: { file_id } )" )
resp = moonshine.run(
flow = "core/scene-detection" ,
index = index,
video_id = file_id
)
print ( f "Scene detection results for { file_name } : { resp } " )
Scene Detection JSON
TODO
.run(flow='core/scene-detection', ...) params
Name/ID of the parent index of the video being processed.
ID of the video being processed.