The Video Segmentation Tool is a Python-based application that allows users to segment long video files into smaller clips based on various criteria, such as shot boundaries, object detection, and audio event detection.
- Shot Boundary Detection: Identify transitions between shots or scenes in the input video using histogram-based comparison techniques.
- Video Clip Generation: Extract video segments based on the detected shot boundaries and save them as individual clips.
- Audio Clipping (Optional): Clip the audio of the input video based on the detected shot boundaries and save the audio segments separately.
- Video and Audio Combination: Combine the generated video and audio clips into the final output files.
- GUI-based Interface: Provide a user-friendly graphical interface for selecting the input video, output directory, and configuring the segmentation options.
- Filtering Options: Allow users to enable or disable object detection and audio event detection as additional filtering criteria for the video segmentation process.
- Python 3.6 or newer
- The following Python libraries:
opencv-pythontkintermoviepynumpy
- Utilize VScode to automatically set up the .venv by Ctrl + Shift + P and typing "Create Environment". This will automatically create the .venv folder with the requirements.txt folder found at the root level
- To do so manually:
python3 -m venv .venv
# For Mac and Linux-based Systems
source .venv/bin/activate
# For Windows
.venv\Scripts\activate
# This will take around 5-15 minutes
pip install -r requirements.txtThis is import as it prevents adding excess dependencies to the project
Using the Frags AI Secrets Storage file, copy and paste the secrets into the .env at the root of Clipping-Project
- If your models are storage outside of the project scope, you can specify the absolute path to the model inside of the .env file.
- If not specified, the project will automatically search for it inside of the pretrained folder inside models.
- Run the command (Assuming you're at the root level)
cd .\Clipping-project\
python run .\src\main.pyAssuming you have Postman or any API testing client
Contributions to the Video Segmentation Tool are welcome! If you find any issues or have ideas for improvements, please feel free to submit a pull request or open an issue on the [GitHub repository]
- The
shot_boundary_detection,clip_video,clip_audio, andcombine_video_audiofunctions were adapted from theVideo_Segmentation_Tool.pyfile. - The GUI implementation was based on the Tkinter library.
- Download FFmpeg:
- Download the Files: https://drive.google.com/drive/folders/1Ku9nnmQfBpeNI9M1HyvEoFQlbZorIX2Y?usp=drive_link
- Once downloaded, extract it to a folder, for example, C:\ffmpeg-master-latest-win64-gpl-shared\bin.
- Add FFmpeg to the System PATH:
- Right-click on "This PC" or "Computer" and select "Properties".
- Click on "Advanced system settings" and then click on the "Environment Variables" button.
- Under "System variables", find and select the Path variable, then click "Edit".
- In the "Edit Environment Variable" window, click "New" and add the path to the bin folder where you extracted FFmpeg (e.g., C:\ffmpeg-master-latest-win64-gpl-shared\bin).
- Click "OK" to close all windows.
- ImageMagick
- Download and Install ImageMagick
- Run the installer and follow the installation steps.
- During the installation, make sure to:
- Select the option to add ImageMagick to your system's PATH ex: C:\Program Files\ImageMagick-7.1.1-Q16.
- Choose the "Install legacy utilities (e.g., convert)" option if you need older commands like convert.
from matplotlib import font_manager
# Get all available font paths
font_paths = font_manager.findSystemFonts(fontpaths=None, fontext='ttf')
# Print font names and their paths
print("Available Fonts:")
for font_path in font_paths:
font_name = font_manager.FontProperties(fname=font_path).get_name()
print(f"{font_name} : {font_path}")