add generate.py demo.
Browse files- generate.py +27 -0
generate.py
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import sys
|
| 2 |
+
import argparse
|
| 3 |
+
import cv2
|
| 4 |
+
import numpy as np
|
| 5 |
+
|
| 6 |
+
def create_dummy_video(output_path, duration, resolution):
|
| 7 |
+
width, height = map(int, resolution.split("*"))
|
| 8 |
+
fps = 24
|
| 9 |
+
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
|
| 10 |
+
out = cv2.VideoWriter(output_path, fourcc, fps, (width, height))
|
| 11 |
+
|
| 12 |
+
# Δημιουργία μαύρων frames
|
| 13 |
+
for _ in range(fps * duration):
|
| 14 |
+
frame = np.zeros((height, width, 3), dtype=np.uint8)
|
| 15 |
+
out.write(frame)
|
| 16 |
+
|
| 17 |
+
out.release()
|
| 18 |
+
|
| 19 |
+
if __name__ == "__main__":
|
| 20 |
+
parser = argparse.ArgumentParser()
|
| 21 |
+
parser.add_argument("--prompt", type=str, required=True)
|
| 22 |
+
parser.add_argument("--output", type=str, required=True)
|
| 23 |
+
parser.add_argument("--duration", type=int, default=5)
|
| 24 |
+
parser.add_argument("--size", type=str, default="640*480")
|
| 25 |
+
args = parser.parse_args()
|
| 26 |
+
|
| 27 |
+
create_dummy_video(args.output, args.duration, args.size)
|