| |
| """Extract a paired WildShadow MP4 clip to the frame-folder training layout.""" |
|
|
| from __future__ import annotations |
|
|
| import argparse |
| import subprocess |
| from pathlib import Path |
|
|
|
|
| def extract(video: Path, destination: Path) -> None: |
| if not video.is_file(): |
| raise FileNotFoundError(video) |
| destination.mkdir(parents=True, exist_ok=True) |
| subprocess.run([ |
| "ffmpeg", "-hide_banner", "-loglevel", "error", "-y", "-i", str(video), |
| "-vsync", "0", "-start_number", "0", str(destination / "rgb_%06d.png"), |
| ], check=True) |
|
|
|
|
| def main() -> None: |
| parser = argparse.ArgumentParser(description=__doc__) |
| parser.add_argument("--shadow", required=True, type=Path) |
| parser.add_argument("--shadow-free", required=True, type=Path) |
| parser.add_argument("--output", required=True, type=Path) |
| args = parser.parse_args() |
| extract(args.shadow, args.output / "origin") |
| extract(args.shadow_free, args.output / "shadow_free") |
|
|
|
|
| if __name__ == "__main__": |
| main() |
|
|