A tool designed to create datasets from a single high quality input video for AI training purposes. It processes videos by splitting them into chunks, applying random codecs and quality settings (more degredations to come), and finally extracting frame sequences.
This toolkit consists of two main components:
-
Video Processing (
main.py)- Splits videos into chunks
- Applies random codecs with varying quality settings (more degredations to come)
- Creates paired HR/LR video chunks
-
Frame Extraction (
frame_extractor.py)- Extracts frame sequences from video chunks
- Supports scene-based or time-based extraction
- Creates paired HR/LR frame sequences
- Note: You MUST have ffmpeg in your PATH to use this program
- Run this command to clone the repository
git clone https://github.com/Kim2091/video-destroyer/- Install Python dependencies (and ensure ffmpeg is in your PATH):
pip install -r requirements.txt-
Edit
config.yamland configure it as you wish- Set
inputto a video file or folder of videos (auto-detects which mode to use) - Customize video degradations
- NOTE: Only resizing and compression are enabled by default
- Set
-
Run the video processor:
python main.py --config config.yaml- Extract frame sequences:
python frame_extractor.pyThe first step creates paired high-quality and degraded video chunks:
- Splits input video into chunks using scene detection or fixed duration
- Processes each chunk with random codecs and quality settings
- Creates HR (original) and LR (degraded) pairs
The tool automatically detects whether you're processing a single video or a folder of videos.
Single Video Mode:
Edit config.yaml and set the input to a video file:
input: "C:/path/to/video.mp4"Batch Processing Mode:
Edit config.yaml and set the input to a folder path:
input: "C:/path/to/video/folder"Then run:
python main.py --config config.yamlWhen processing a folder, each video will be processed independently and output to its own subfolder:
chunks_directory/video1_name/HR/chunks_directory/video1_name/LR/chunks_directory/video2_name/HR/chunks_directory/video2_name/LR/- etc.
The batch processor will:
- Automatically detect all videos in the folder (supports .mp4, .mov, .mkv, .avi, .webm, .flv)
- Process each video independently
- Continue processing even if one video fails
- Provide a summary report at the end
The second step extracts frame sequences from the video chunks.
To use, you can either edit the configuration in config.yaml for frame extraction, or use the arguments below.
Arguments:
-c, --chunks_dir Directory containing HR and LR chunks
-o, --output_dir Directory to save extracted frames
-s, --sequence_length Number of frames in each sequence
-d, --use_scene_detection Use scene detection for frame selection
-m, --max_sequences Maximum sequences per chunk pair
-t, --time_gap Time gap between sequences in secondsExample usage:
# Extract using time gaps
python frame_extractor.py -c chunks -o frames -s 5 -t 3.0
# Extract using scene detection
python frame_extractor.py -c chunks -o frames -s 5 -d-
The video processor creates two directories for each chunk:
chunks/HR/: Original quality chunkschunks/LR/: Degraded video chunks
-
Frame sequences are saved as:
frames/HR/show{N}_Frame{M}.png: High-quality framesframes/LR/show{N}_Frame{M}.png: Degraded frames
-
Scene detection is recommended for videos with distinct scene changes
-
Time-based extraction is better for continuous footage
-
When using scene detection, the time gap parameter is ignored
-
Default sequence length is 5 frames
-
Default time gap is 3 seconds when not using scene detection
This tool is particularly useful for creating training datasets for video enhancement AI models:
- Use high-quality source videos as input
- Process them to create controlled degradations
- Extract matching frame sequences
- Use the resulting HR/LR pairs for training
Train one yourself with traiNNer-redux, using the TSCUNet architecture!