Video caption
Schemas for video-caption metadata.
Keyframe
Bases: BaseModel
A keyframe extracted from a video segment.
Attributes:
| Name | Type | Description |
|---|---|---|
time_offset |
float
|
Time within the segment where the keyframe occurs. |
caption |
str | None
|
Text description of the keyframe. |
VideoCaptionMetadata
Bases: BaseModel
Caption metadata for an entire video.
Attributes:
| Name | Type | Description |
|---|---|---|
video_summary |
str
|
A high-level video summary. |
segments |
list[VideoSegment]
|
Captioned video segments. |
ensure_segment_end_time_greater_than_start_time()
Normalize segments whose end time is not after their start time.
Returns:
| Name | Type | Description |
|---|---|---|
VideoCaptionMetadata |
VideoCaptionMetadata
|
The video caption metadata with normalized segment end times. |
VideoSegment
Bases: BaseModel
A timed video segment with captions, transcripts, and keyframes.
Attributes:
| Name | Type | Description |
|---|---|---|
start_time |
float | None
|
The segment start time in seconds. Defaults to None. |
end_time |
float | None
|
The segment end time in seconds. Defaults to None. |
transcripts |
list[AudioTranscript]
|
The segment transcripts. |
segment_caption |
list[str]
|
The segment captions. |
keyframes |
list[Keyframe]
|
The segment keyframes. |
ensure_caption()
Populate an empty caption from valid keyframes or transcripts.
Returns:
| Name | Type | Description |
|---|---|---|
VideoSegment |
VideoSegment
|
The video segment with populated caption. |
ensure_keyframes()
Discard keyframes with negative time offsets.
Returns:
| Name | Type | Description |
|---|---|---|
VideoSegment |
VideoSegment
|
The video segment with keyframes whose time offsets are non-negative. |
ensure_transcripts()
Discard transcripts with invalid timestamps.
Returns:
| Name | Type | Description |
|---|---|---|
VideoSegment |
VideoSegment
|
The video segment with non-negative, non-reversed transcripts. |