freealise commited on
Commit
c50ba42
1 Parent(s): af52397

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -8
app.py CHANGED
@@ -41,21 +41,22 @@ def do_interpolation(frame1, frame2, times_to_interpolate):
41
  def get_frames(video_in, step, name):
42
  frames = []
43
  #resize the video
44
- clip = VideoFileClip(video_in).set_duration(1)
 
 
 
 
 
45
 
46
  #check fps
47
- if clip.fps > 25:
48
  print("video rate is over 25, resetting to 25")
49
  clip_resized = clip.resize(height=1024)
50
  clip_resized.write_videofile("video_resized.mp4", fps=25)
51
- else if clip.fps:
52
- print("video rate is OK")
53
- clip_resized = clip.resize(height=1024)
54
- clip_resized.write_videofile("video_resized.mp4", fps=clip.fps)
55
  else:
56
- print("video rate is indefinite")
57
  clip_resized = clip.resize(height=1024)
58
- clip_resized.write_videofile("video_resized.mp4", fps=1)
59
 
60
  print("video resized to 1024 height")
61
 
 
41
  def get_frames(video_in, step, name):
42
  frames = []
43
  #resize the video
44
+ clip = cv2.VideoCapture(video_in)
45
+ cframes = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
46
+ cfps = int(cap.get(cv2.CAP_PROP_FPS))
47
+ print(f'Checking Video {count} Frames {cframes} fps: {cfps}')
48
+
49
+ #clip = VideoFileClip(video_in)
50
 
51
  #check fps
52
+ if cfps > 25:
53
  print("video rate is over 25, resetting to 25")
54
  clip_resized = clip.resize(height=1024)
55
  clip_resized.write_videofile("video_resized.mp4", fps=25)
 
 
 
 
56
  else:
57
+ print("video rate is OK")
58
  clip_resized = clip.resize(height=1024)
59
+ clip_resized.write_videofile("video_resized.mp4", fps=cfps)
60
 
61
  print("video resized to 1024 height")
62