freealise commited on
Commit
a1ede95
·
verified ·
1 Parent(s): cf92cd0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -16,6 +16,7 @@ import json
16
  from collections import Counter
17
  import mediapy
18
  import ffmpy
 
19
 
20
  #from depth_anything.dpt import DepthAnything
21
  #from depth_anything.util.transform import Resize, NormalizeImage, PrepareForNet
@@ -63,10 +64,11 @@ def create_alpha_video(frames, fps, type):
63
  print("building composite video result")
64
  imgs = []
65
  for j, img in enumerate(frames):
66
- imgs.append(cv2.cvtColor(cv2.imread(img).astype(np.uint8), cv2.COLOR_RGBA2RGB))
67
 
68
- mediapy.write_video(type + "_result.mp4", imgs, fps=fps)
69
- return type + "_result.mp4"
 
70
 
71
  def create_video(frames, fps, type):
72
  print("building video result")
 
16
  from collections import Counter
17
  import mediapy
18
  import ffmpy
19
+ from apng import APNG
20
 
21
  #from depth_anything.dpt import DepthAnything
22
  #from depth_anything.util.transform import Resize, NormalizeImage, PrepareForNet
 
64
  print("building composite video result")
65
  imgs = []
66
  for j, img in enumerate(frames):
67
+ imgs.append(cv2.imread(img).astype(np.uint8))
68
 
69
+ APNG.from_files(frames, delay=1000).save(type + "_result.png")
70
+ mediapy.write_video(type + "_result.webm", imgs, fps=fps)
71
+ return type + "_result.webm"
72
 
73
  def create_video(frames, fps, type):
74
  print("building video result")