I didn't managed to open the .avi file after i have performed videowrite.cv2.
Is there any way to solve the issues?
Able to write but not able to read as it said corrupted data.
Below is the sample code :
day_video = cv2.VideoCapture('/content/gdrive/Shareddrives/Computer Vision/Assignment 2/Q1_day_video.avi')
check, frame = day_video.read()
height, width, _ = frame.shape
fourcc = cv2.VideoWriter_fourcc(*'MJPG')
out = cv2.VideoWriter('output_day.avi', fourcc, 20, (height, width))
while day_video.isOpened():
check, frame = day_video.read()
if not check:
out.release()
break
new_output = lines_highlighted_day(frame)
out.write(new_output)
out.release()
CodePudding user response:
Change the height & video in this line
out = cv2.VideoWriter('output_day.avi', fourcc, 20, (height, width))
to
out = cv2.VideoWriter('output_day.avi', fourcc, 20, (width, height ))