File size: 655 Bytes
d7ac483
61b71df
 
 
d7ac483
37ed8b3
61b71df
 
 
 
37ed8b3
61b71df
 
 
 
 
 
 
d7ac483
61b71df
 
 
 
 
d7ac483
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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()