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. |
Source code in sleap/sleap_io_adaptors/video_utils.py
29 30 31 32 33 34 35 | |
can_use_ffmpeg()
¶
Check if ffmpeg is available for writing videos.
Source code in sleap/sleap_io_adaptors/video_utils.py
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | |
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
62 63 64 65 66 67 68 69 70 71 72 73 | |
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
112 113 114 115 116 117 118 119 120 121 | |
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
124 125 126 127 128 129 130 131 132 133 134 | |
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. |
Source code in sleap/sleap_io_adaptors/video_utils.py
76 77 78 79 80 81 82 83 84 85 | |
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
88 89 90 91 92 93 94 95 96 97 | |
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
100 101 102 103 104 105 106 107 108 109 | |
video_util_reset(video, filename=None, grayscale=None)
¶
Reloads the video.
Returns:
| Type | Description |
|---|---|
|
None |
Source code in sleap/sleap_io_adaptors/video_utils.py
38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |