nicetoolbox.utils.video.equal_splits_by_frames¶
- nicetoolbox.utils.video.equal_splits_by_frames(video_file: str, output_base: str, frames_per_split: int, keep_last_split: bool = True, start_frame: int | None = None, number_of_frames: int | None = None) list[source]¶
Splits a video into equal segments based on the number of frames.
- Parameters:
video_file (str) – The path to the input video file.
output_base (str) – The base path for the output segments.
frames_per_split (int) – The number of frames per split segment.
keep_last_split (bool, optional) – Whether to keep the last split segment if it is shorter than the others. Defaults to True.
start_frame (int, optional) – The starting frame index. Defaults to None.
number_of_frames (int, optional) – The total number of frames to consider. Defaults to None.
- Returns:
A list of paths to the created segments.
- Return type:
List[str]
- Raises:
AssertionError – If the total number of frames is less than the frames per split.