OpenCV 3.0 是否仍然对 VideoWriter 大小有限制? [英] Does OpenCV 3.0 Still Has Limits On VideoWriter Size?
问题描述
OpenCV 2.4 VideoWriter
无法保存大于 2GB 的视频文件,因为它只接受 .avi 文件,我想知道 OpenCV 3.0 中是否仍然如此,或者它是否可以保存其他类型的视频文件没有这个限制.
OpenCV 2.4 VideoWriter
couldn't save video files larger than 2GB, since it only accepts .avi files, I am wondering if this is still the case in OpenCV 3.0, or if it can save other kind of video files that doesn't have this limitations.
我试图找到任何指向 2GB 限制的文档或说明它能够处理更大文件的发行说明,但我找不到.
I tried to find any documentations pointing to a limit of 2GB or a release note saying it's capable to handle larger files, but I can't find none.
推荐答案
即使 OpenCV 3.0-beta 文档 另有说明,OpenCV 3.0 的 VideoWriter
似乎处理其他文件格式,例如 mkv
,如本期所示.
Even though the OpenCV 3.0-beta documentation states otherwise, OpenCV 3.0's VideoWriter
seems to handle other file formats, such as mkv
, as shown in this issue.
我修改了上述问题的代码以生成 4GB mkv
视频(4096 帧随机 2048x2048).
I adapted the code from the above issue to generate a 4GB mkv
video (4096 frames of random 2048x2048).
需要注意的是,图像大小应该在 VideoWriter
中作为 width
然后 height
传递,而 numpy 数组
应该用height
和width
初始化.VideoWriter
否则会静默失败.
The things to be aware is that the image size should be passed as width
then height
in the VideoWriter
whereas the numpy array
should be initialized with height
then width
. VideoWriter
will fail silently otherwise.
您还需要最新的 OpenCV 3.0 源来处理未压缩的流.
You will also require a recent OpenCV 3.0 source to handle uncompressed streams.
这篇关于OpenCV 3.0 是否仍然对 VideoWriter 大小有限制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!