I'm using OpenCV 4.0 and Python 3.7 to create a timelapse video.
When constructing a VideoWriter object, the documentation says the Size argument should be a tuple.
When I give it a tuple it rejects it. When I try to replace it with something else, it won't accept it because it says the argument isn't a tuple.
When Size not a tuple:
out = cv2.VideoWriter('project.avi', 1482049860, 30, height, width)
SystemError: new style getargs format but argument is not a tuple
When I changed Size to a tuple:
out = cv2.VideoWriter('project.avi', 1482049860, 30, (height, width))
TypeError: must be real number, not tuple
I just want to create a simple cv2.VideoWriter object.
I was trying to take the height and width from an uploaded video using:
width = cap.get(cv2.CAP_PROP_FRAME_WIDTH)
height = cap.get(cv2.CAP_PROP_FRAME_HEIGHT)
I changed it to:
width = int(cap.get(cv2.CAP_PROP_FRAME_WIDTH))
height = int(cap.get(cv2.CAP_PROP_FRAME_HEIGHT))
Now I don't get that error. It doesn't work yet as a whole, but that particular error isn't there anymore.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With