# 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: - `ffmpeg` - `ffprobe` - `SvtAv1EncApp.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. (Optional) Detect Crop If your video has black bars, you can use `cropdetect.py` to find the correct crop values. ```bash python cropdetect.py "path/to/your/video.mkv" ``` ### 2. Cut Video into Scenes Use [`scene_cutter.py`](scene_cutter.py) to analyze the video, detect scene changes, and split the source into lossless segments in the `cuts/` directory. ```bash python scene_cutter.py "path/to/your/video.mkv" ``` ### 3. Encode Segments Choose one of the encoder scripts to process the files from the `cuts/` directory. Encoded files will be placed in the `segments/` directory. **Option A: VMAF-based Encoding (Recommended)** Use [`vmaf_encoder.py`](vmaf_encoder.py) to encode each segment to a target VMAF quality level. ```bash python vmaf_encoder.py --target-vmaf 96.0 ``` **Option B: Static CRF Encoding** Use [`static_encoder.py`](static_encoder.py) to encode all segments with a single, fixed CRF value. ```bash python static_encoder.py --crf 27 ``` ### 4. Mux Final Video Use [`segment_muxer.py`](segment_muxer.py) to combine all the encoded `.mkv` files from the `segments/` directory into a single output file. ```bash python segment_muxer.py --cleanup ``` Using the `--cleanup` flag will automatically remove the `cuts/` and `segments/` directories