i tried to change the resolution of a video file from 854x480 to a lower resolution of 640x480 using cv2 with the motive of reducing size,but while the original file is 3.2MB, the converted file is 8.3MB. I have also maintained the same video format. I'm new to video processing. Why is this happning and how can i modify the following code to get better results?
Thank you in advance!
here is the code i used:
import cv2
import numpy as np
cap = cv2.VideoCapture(r'C:\Users\CSC\Desktop\SmartDesert\1.mp4')
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
out = cv2.VideoWriter(r'C:\Users\CSC\Desktop\SmartDesert\1_Output.mp4', fourcc, 25, (640, 480))
while True:
ret, frame = cap.read()
if ret == True:
b = cv2.resize(frame, (640, 480), fx=0, fy=0, interpolation=cv2.INTER_CUBIC)
out.write(b)
else:
break
cap.release()
out.release()
cv2.destroyAllWindows()