xizaoqu commited on
Commit ·
21cda28
1
Parent(s): 27d2ea1
rename and support multi-frame infer
Browse files
app.py
CHANGED
|
@@ -181,15 +181,11 @@ device = torch.device('cuda')
|
|
| 181 |
|
| 182 |
def save_video(frames, path="output.mp4", fps=10):
|
| 183 |
h, w, _ = frames[0].shape
|
| 184 |
-
out = cv2.VideoWriter(path, cv2.VideoWriter_fourcc(*'
|
| 185 |
for frame in frames:
|
| 186 |
out.write(cv2.cvtColor(frame, cv2.COLOR_RGB2BGR))
|
| 187 |
out.release()
|
| 188 |
|
| 189 |
-
ffmpeg_cmd = [
|
| 190 |
-
"ffmpeg", "-y", "-i", path, "-c:v", "libx264", "-crf", "23", "-preset", "medium", path
|
| 191 |
-
]
|
| 192 |
-
subprocess.run(ffmpeg_cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
| 193 |
return path
|
| 194 |
|
| 195 |
cfg = OmegaConf.load("configurations/huggingface.yaml")
|
|
|
|
| 181 |
|
| 182 |
def save_video(frames, path="output.mp4", fps=10):
|
| 183 |
h, w, _ = frames[0].shape
|
| 184 |
+
out = cv2.VideoWriter(path, cv2.VideoWriter_fourcc(*'mp4v'), fps, (w, h))
|
| 185 |
for frame in frames:
|
| 186 |
out.write(cv2.cvtColor(frame, cv2.COLOR_RGB2BGR))
|
| 187 |
out.release()
|
| 188 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
return path
|
| 190 |
|
| 191 |
cfg = OmegaConf.load("configurations/huggingface.yaml")
|