我正在尝试从 python 中的 jpeg 图像构建视频。
这是我的代码。
codec = highgui.CV_FOURCC('F', 'L', 'V', '1')
fps = 25
colored = 1
size = (float(width), float(height))
video_writer = highgui.cvCreateVideoWriter(
'out.mpg', codec, fps, cv.cvSize(1440, 553), True)
pictures = os.listdir(folder)
for picture in pictures:
picture = '%s/%s' % (folder, picture)
highgui.cvWriteFrame(self.video_writer, picture)
高度、宽度和文件夹已在其他地方定义。当我运行代码时,我收到以下错误:
Output #0, mpeg, to 'out.mpg':
Stream #0.0: Video: flv, yuv420p, 1440x553, q=2-31, 50964 kb/s, 90k tbn, 25 tbc
[mpeg @ 0x29425c0] VBV buffer size not set, muxing may fail
Traceback (most recent call last):
File "./ips.py", line 109, in <module>
main()
File "./ips.py", line 62, in main
video.build(configs['maps']['folder'])
File "/home/martin/Formspring/maraca-locator-94947aa/encoder.py", line 34, in build
highgui.cvWriteFrame(self.video_writer, picture)
TypeError: %%typemap(in) IplImage * : could not convert to CvMat
我不知道我做错了什么,知道是什么原因造成的吗?有没有首选的构建框架的方法?