Spaces:
Running
Running
File size: 414 Bytes
2ba4412 |
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 numpy as np
import cv2
cap = cv2.VideoCapture('workspace/img_dir/tst.mp4')
fourcc = cv2.VideoWriter_fourcc(*'H264')
ret, frame = cap.read()
vid_size = frame.shape[:2][::-1]
out = cv2.VideoWriter('workspace/img_dir/testwrite.mp4',fourcc, 8, vid_size)
out.write(frame)
while(cap.isOpened()):
ret, frame = cap.read()
if not ret: break
out.write(frame)
cap.release()
out.release()
|