Datasets:
File size: 1,022 Bytes
541f082 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | #!/usr/bin/env python3
"""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()
|