A Python utility to automatically create short summary videos from a longer source file. It uses the MoviePy library to extract evenly spaced segments and stitch them into a final highlight reel.
The Video Summarizer is a practical command-line tool designed for quick video manipulation. It takes a single video file and automatically generates a shorter summary video of a specified duration. Instead of using complex algorithms, this tool takes a straightforward, deterministic approach: it extracts a set number of evenly spaced segments from the original video.
This is handled by the `VideoSummarizer` class, which encapsulates all logic for loading the video, calculating segment timings, clipping the video, and compiling the final output using MoviePy.
Calculates the optimal spacing interval and uses `video.subclipped()` to extract clips of a fixed duration across the video's timeline.
The total number of segments is dynamically adjusted if the source video is too short for the user's requested segment parameters.
Uses `moviepy.concatenate_videoclips()` to stitch the extracted segments together. Each segment's duration is adjusted to meet the final requested `summary_duration`.
Attempts to seamlessly include the original video's audio, clipping it to match the final summary duration and attaching it to the final clip.