import gradio as gr | |
import cv2 | |
def video_input(video): | |
video = cv2.VideoCapture(video) | |
# We need to set resolutions. | |
# so, convert them from float to integer. | |
frame_width = int(video.get(3)) | |
frame_height = int(video.get(4)) | |
size = (frame_width, frame_height) | |
# Below VideoWriter object will create | |
# a frame of above defined The output | |
# is stored in 'filename.avi' file. | |
result = cv2.VideoWriter('videos/filename.avi', | |
cv2.VideoWriter_fourcc(*'MJPG'),10, size) | |
iface = gr.Interface( | |
video_input, | |
gr.inputs.Video(source="upload"), | |
"playable_video", | |
) | |
iface.launch() |