import cv2
import numpy as np
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
shape = cv2.imread('data/temp/enhanced/1.png')
shape = shape.shape
shape = (shape[1], shape[0])
writer = cv2.VideoWriter('output.mp4', fourcc, 30, shape)
for i in range(50):
img = cv2.imread(f'data/temp/enhanced/{i + 1}.png')
writer.write(img)
print(i+1)
writer.release()
I have a script that generates a video file, but when I try to open the generated video, I encounter the 0xC00D36C4 error and it refuses to play. What could be causing this issue? Any suggestions for resolving it?
All the images in the 'data/temp/enhanced/' directory have a consistent size of 17080 x 9600 pixels.
I attempted to change the file extension of the video to AVI and used the appropriate codec for AVI files. However, despite these changes, the issue persists and the video still cannot be played.
import cv2
import numpy as np
fourcc = cv2.VideoWriter_fourcc(*'mp4v')
shape = cv2.imread('data/temp/enhanced/1.png')
shape = shape.shape
shape = (1920, 1080)
print(shape)
writer = cv2.VideoWriter('output.mp4', fourcc, 30, shape)
for i in range(50):
img = cv2.imread(f'data/temp/enhanced/{i + 1}.png')
img = cv2.resize(img, shape)
writer.write(img)
print(i+1)
writer.release()
Fixed it by resizing the input image sizes