Python CV2 напишите на видео

import cv2
vid_capture = cv2.VideoCapture('Resources/Cars.mp4')
if (vid_capture.isOpened() == False):
  print("Error opening the video file")
else:
  # Get frame rate information
  fps = int(vid_capture.get(5))
  print("Frame Rate : ",fps,"frames per second") 
  # Get frame count
  frame_count = vid_capture.get(7)
  print("Frame count : ", frame_count)

while(vid_capture.isOpened()):
  ret, frame = vid_capture.read()
  if ret == True:
    cv2.imshow('Frame',frame)
    k = cv2.waitKey(20)
    # 113 is ASCII code for q key
    if k == 113:
      break
  else:
    break

vid_capture.release()
cv2.destroyAllWindows()
vid_capture = cv2.VideoCapture('Resources/Image_sequence/Cars%04d.jpg')
vic_capture = cv2.VideoCapture(0,cv2.CAP_DSHOW)
frame_width = int(vid_capture.get(3))
frame_height = int(vid_capture.get(4))
frame_size = (frame_width,frame_height)
fps = 20
output = cv2.VideoWriter('Resources/output_video_from_file.avi', cv2.VideoWriter_fourcc('M','J','P','G'), 20, frame_size)
while(vid_capture.isOpened()):
    ret, frame = vid_capture.read()
    if ret == True:
           output.write(frame)
    else:
         print(‘Stream disconnected’)
           break
vid_capture.release()
output.release()
Thankful Toucan