Download scripts/make_test_videos.py from hdcli/copyrightgpt-v1: direct link, hf CLI and curl.
- Browser
- Download file 1.03 kB
-
https://huggingface.co/datasets/hdcli/copyrightgpt-v1/resolve/main/scripts/make_test_videos.py
- Command line
-
hf download hf://datasets/hdcli/copyrightgpt-v1/scripts/make_test_videos.py
-
curl -L -o make_test_videos.py https://huggingface.co/datasets/hdcli/copyrightgpt-v1/resolve/main/scripts/make_test_videos.py
1.03 kB
| """Generate a couple of tiny synthetic .mp4 files to smoke-test the pipeline.""" | |
| import os | |
| import cv2 | |
| import numpy as np | |
| OUT_DIR = os.path.join(os.path.dirname(os.path.dirname(os.path.abspath(__file__))), "sample_videos") | |
| os.makedirs(OUT_DIR, exist_ok=True) | |
| def make_video(path, seed, seconds=3, fps=10, size=(160, 120)): | |
| fourcc = cv2.VideoWriter_fourcc(*"mp4v") | |
| writer = cv2.VideoWriter(path, fourcc, fps, size) | |
| rng = np.random.default_rng(seed) | |
| base = rng.integers(0, 255, (size[1], size[0], 3), dtype=np.uint8) | |
| for i in range(seconds * fps): | |
| frame = base.copy() | |
| cv2.circle(frame, (20 + (i * 4) % size[0], 60), 10, (0, 0, 255), -1) | |
| writer.write(frame) | |
| writer.release() | |
| if __name__ == "__main__": | |
| make_video(os.path.join(OUT_DIR, "original.mp4"), seed=1) | |
| make_video(os.path.join(OUT_DIR, "duplicate_reencoded.mp4"), seed=1) # same content | |
| make_video(os.path.join(OUT_DIR, "unrelated.mp4"), seed=99) # different content | |
| print("Wrote sample videos to", OUT_DIR) | |