video_utils
sleap.sleap_io_adaptors.video_utils
¶
Video utilities for sleap-io integration.
Functions:
| Name | Description |
|---|---|
available_video_exts |
Return tuple of supported video extensions. |
can_use_ffmpeg |
Check if ffmpeg is available for writing videos. |
get_last_frame_idx |
Get the last frame index for a specific video. |
video_get_channels |
Get video channels for backward compatibility. |
video_get_frame |
Get frame by index for backward compatibility. |
video_get_frames |
Get frame count for backward compatibility. |
video_get_height |
Get video height for backward compatibility. |
video_get_width |
Get video width for backward compatibility. |
video_util_reset |
Reloads the video. |
available_video_exts()
¶
Return tuple of supported video extensions.
Returns:
| Type | Description |
|---|---|
Tuple[str]
|
Tuple of supported video extensions. |
can_use_ffmpeg()
¶
Check if ffmpeg is available for writing videos.
Source code in sleap/sleap_io_adaptors/video_utils.py
get_last_frame_idx(video=None)
¶
Get the last frame index for a specific video. This function recreates the functionality of labels.get_last_frame_idx(video) from the original SLEAP codebase.
Source code in sleap/sleap_io_adaptors/video_utils.py
video_get_channels(video)
¶
Get video channels for backward compatibility.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
video
|
Video
|
Video object to get channels from. |
required |
Returns:
| Type | Description |
|---|---|
int
|
Number of channels in video frames. |
Source code in sleap/sleap_io_adaptors/video_utils.py
video_get_frame(video, idx)
¶
Get frame by index for backward compatibility.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
video
|
Video
|
Video object to get frame from. |
required |
idx
|
int
|
Frame index to retrieve. |
required |
Returns:
| Type | Description |
|---|---|
|
Frame data as numpy array. |
Source code in sleap/sleap_io_adaptors/video_utils.py
video_get_frames(video)
¶
Get frame count for backward compatibility.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
video
|
Video
|
Video object to get frame count from. |
required |
Returns:
| Type | Description |
|---|---|
int
|
Number of frames in the video. |
video_get_height(video)
¶
Get video height for backward compatibility.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
video
|
Video
|
Video object to get height from. |
required |
Returns:
| Type | Description |
|---|---|
int
|
Height of video frames in pixels. |
Source code in sleap/sleap_io_adaptors/video_utils.py
video_get_width(video)
¶
Get video width for backward compatibility.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
video
|
Video
|
Video object to get width from. |
required |
Returns:
| Type | Description |
|---|---|
int
|
Width of video frames in pixels. |
Source code in sleap/sleap_io_adaptors/video_utils.py
video_util_reset(video, filename=None, grayscale=None)
¶
Reloads the video.
Returns:
| Type | Description |
|---|---|
|
None |