I have some frames (dimensions: 8192x2160) that are generated from concatenating two 4096x2160 frames side by side. When writing these frames to a video file using OpenCV VideoWriter, I get this error: dimensions too large for MPEG-4
Here is my code:
video_name = "vid.mp4"
images = sorted([img for img in os.listdir(images_folder) if img.endswith(".png")])
frame = cv2.imread(os.path.join(images_folder, images[0]))
height, width, layers = frame.shape
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
video = cv2.VideoWriter(video_name, fourcc, FRAME_RATE, (width, height))
for image in images:
video.write(cv2.imread(os.path.join(images_folder, image)))
cv2.destroyAllWindows()
video.release()
This didn't work either:
video_name = "output.avi"
video = cv2.VideoWriter(video_name, cv2.VideoWriter_fourcc(*'DIVX'), 10, (width, height))
Does anyone have any suggestions?