1.8 KiB
Chunk Encoder
Note: This project is a work in progress. The scripts, their features, and command-line arguments are subject to change.
A collection of Python scripts to automate a video encoding workflow. The process involves detecting scenes, cutting the source video into smaller segments, encoding each segment individually, and muxing them back into a final file.
Prerequisites
Ensure the following command-line tools are installed and available in your system's PATH:
ffmpegffprobeSvtAv1EncApp.exe(from the SVT-AV1 project)mkvmerge(from the MKVToolNix package)
Workflow
The scripts are designed to be run in sequence. They create and use local directories (cuts, segments, temp) to store intermediate files.
1. Cut Video into Scenes
Use scene_cutter.py to analyze the video, detect scene changes, and split the source into lossless segments in the cuts/ directory.
python scene_cutter.py "path/to/your/video.mkv"
If your video has black bars, you can use the --autocrop flag to automatically detect and apply the correct crop values during this process.
python scene_cutter.py "path/to/your/video.mkv" --autocrop
2. Encode Segments
Use static_encoder.py to encode all segments from the cuts/ directory with a single, fixed CRF value. Encoded files will be placed in the segments/ directory.
python static_encoder.py --crf 27
3. Mux Final Video
Use segment_muxer.py to combine all the encoded .mkv files from the segments/ directory into a single output file.
python segment_muxer.py --cleanup
Using the --cleanup flag will automatically remove the cuts/ and segments/ directories upon successful completion of the muxing process.