A frame-count file generator for video clip configuration. Reads a YAML config describing a video sequence and produces one text file per clip containing the total frame count.
- Reads the first
.yamlor.ymlfile found in01.input/. - Validates required fields:
num_clips,duration_seconds,fps. - Calculates total frames per clip:
total_frames = fps × duration_seconds. - Generates
{n}.txtfiles (one per clip, numbered 1 tonum_clips), each containing the calculated frame count. - Output goes to a timestamped directory under
02.output/.
Place a .yaml file in 01.input/. The tool uses the first one it finds.
num_clips: 5 # Number of clips / output files to generate
duration_seconds: 10 # Duration of each clip in seconds
fps: 30 # Frames per secondtotal_frames per clip = fps × duration_seconds
Example: 30 × 10 = 300 → each .txt file contains "300"
02.output/
└── YYMMDD_HHMMSS_GENERATED_NUM_FRAMES/
├── 1.txt # Contains "300"
├── 2.txt # Contains "300"
├── 3.txt # Contains "300"
├── 4.txt # Contains "300"
└── 5.txt # Contains "300"
| Condition | Behaviour |
|---|---|
01.input/ does not exist |
Error message, exit code 1 |
No .yaml/.yml files in input |
Error message, exit code 1 |
Missing num_clips, duration_seconds, or fps |
Error message, exit code 1 |
| Invalid YAML syntax | Error message, exit code 1 |
# One-command run (auto-installs dependencies):
python3 run.py
# Or manually:
pip install pyyaml>=6.0
python3 generate_frames.pypyyaml>=6.0(only dependency)