is there a frame size limitation in opencv VideoWriter?

2

When using opencv to save a bunch of pictures to a video file the file won't open unless I resize the image: (Windows error - "This item is in a format we don't support. 0xc00d36b4")

My code looks like this:

import cv2
import os

input_path = "input_images_folder_path"
imgs_lst = os.listdir(r"C:\Users\...\input_path")
outvid_path = r"C:\Users\...\output.avi"

image0 = input_path +"\\"+ imgs_lst[0]
img0 = cv2.imread(image)    
size = (int(img0.shape[1]), int(img0.shape[0]))


fps = 12.0
is_color = True
fourcc = cv2.VideoWriter_fourcc(*"XVID")

vid = cv2.VideoWriter(outvid_path, fourcc, 10.0, size, True)

for i in range(0,50):# int(len(imgs_lst))):

    image = input_path +"\\"+ imgs_lst[i]
    img = cv2.imread(image,1)
    img = cv2.resize(img, size) #tried to comment this out... wont work either
    cv2.imshow("img", img)
    cv2.waitKey(1)

    vid.write(img)

vid.release()

if I resize -

size = (int(img0.shape[1]/2), int(img0.shape[0]/2))
  • all works well. My question is whether or not there is a limit on the frame size. I found some other answers regarding the output file size limitation, but nothing about the single frame shape.

(changing fps, format didn't work either)

python
opencv
video-capture
asked on Stack Overflow Apr 1, 2019 by Frank Musteman • edited Apr 1, 2019 by Frank Musteman

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0