(video_path)
| 39 | |
| 40 | |
| 41 | def getVideoFPS(video_path): |
| 42 | name = os.path.splitext(video_path) |
| 43 | ext = name[1].lower() |
| 44 | |
| 45 | if ext == '.webp' or ext == '.apng' or ext == '.png': |
| 46 | #from gif2gif extension |
| 47 | with Image.open(video_path) as im: |
| 48 | if 'duration' in im.info: |
| 49 | fps = round (1000 / im.info["duration"], 3) |
| 50 | else: |
| 51 | fps = 'unknown' |
| 52 | else: |
| 53 | video = cv2.VideoCapture(video_path) |
| 54 | fps = round(video.get(cv2.CAP_PROP_FPS), 3) |
| 55 | video.release() |
| 56 | |
| 57 | return fps |
| 58 | |
| 59 | def save_video(frames_dir, fps, original, output_path, interpolate): |
| 60 | if original != '': # order of parameters is fussy |
no test coverage detected