Spaces:
Runtime error
Runtime error
File size: 653 Bytes
592221d 9300af7 1e3589d 9300af7 1e3589d 592221d 1e3589d 592221d 1e3589d |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
import gradio as gr
import cv2
import moviepy.editor as mpe
from moviepy.editor import VideoFileClip
def process(video_path):
print(video_path)
clip = mpe.VideoFileClip(video_path)
clip.write_videofile('mp4file.mp4', fps=60)
cap = cv2.VideoCapture('mp4file.mp4')
fps = int(cap.get(cv2.CAP_PROP_FPS))
total_frames = int(cap.get(cv2.CAP_PROP_FRAME_COUNT))
interval = int(fps/2)
print(interval, total_frames)
return interval, total_frames
demo = gr.Interface(fn=process, inputs=gr.Video(format='mp4'), outputs=["textbox", "textbox"], title="Video Frame Counter")
if __name__ == "__main__":
demo.launch() |