I keep getting an assertion error when I'm trying to write frames to video. The error I'm getting is this:
Traceback (most recent call last):
File "VideoMixer.py", line 23, in <module>
cv.WriteFrame(writer, cv.LoadImage(fileName))
cv.error: dst.data == dst0.data
Here's my script:
import cv
import sys
files = sys.argv[1:]
for f in files:
capture = cv.CaptureFromFile(f)
height = cv.GetCaptureProperty(capture, cv.CV_CAP_PROP_FRAME_WIDTH)
width = cv.GetCaptureProperty(capture, cv.CV_CAP_PROP_FRAME_HEIGHT)
fps = cv.GetCaptureProperty(capture, cv.CV_CAP_PROP_FPS)
fourcc = cv.GetCaptureProperty(capture, cv.CV_CAP_PROP_FOURCC)
print fourcc
writer = cv.CreateVideoWriter('ok.mov', int(fourcc),fps,(int(width),int(height)),1)
print writer
for i in range(30):
frame = cv.QueryFrame(capture)
print frame
if frame:
cv.WriteFrame(writer, frame)
Saving the frames as images works fine so I know there's nothing wrong with the capture. Am I creating the writer wrong? The 'print fourcc' outputs 0.0 but I've tried with many FOUR_CC values.
Thanks!