OpenCV VideoWriter无法打开文件
OpenCV VideoWriter does not open file
以下代码无法打开VideoWriter对象:
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
using namespace cv;
using namespace std;
int main() {
VideoWriter oVideo;
oVideo.open ("381.avi", -1, 30, Size(640,480), true);
if (!oVideo.isOpened()) {
cout << "Could not open the output video for write" << endl;
return -1;
}
return 0;
}
我在Ubuntu 12.04上运行Code::Blocks预构建的OpenCV 2.4.9。我已经在同一位置使用imwrite()
编写了许多图像,没有问题,所以我怀疑它与权限有关。我还尝试了CV_FOURCC('X','V','I','D')
,但没有工作。
我在这里错过了什么?
我重新安装了OpenCV使用这个惊人的脚本:https://help.ubuntu.com/community/OpenCV
解决。
确保您的机器安装了特定的编解码器
只是为了供任何在Windows的OpenCV 4.6中遇到类似问题的人参考,值得注意的是,预构建的opencv_world460。lib似乎不支持API之外的视频编解码器,我发现我需要在安装ffmpeg后重建和链接opencvbuildlibRelease文件夹中的所有单个库。
相关文章:
- .cpp和.h文件中的模板专用化声明
- 为什么两个不同的未命名名称空间可以共存于一个cpp文件中
- 文本文件中的单词链表
- CMake-按正确顺序将项目与C运行时对象文件链接
- 使用新行和不使用新行读取文件
- 在C++程序中输入的文本文件将不起作用,除非文本被复制和粘贴
- 挂起和取消挂起一个文件DLL
- 如何确定我已使用非编码文件到达 EOF?
- 命名空间中具有.h和.cpp文件的类
- 如何使用ndk-build.cmd构建Android.so文件
- 从包含m行的文件中提取n行,必要时(惰性地)重复该文件
- 读取文件并输入到矢量中
- 在C++中查找文件
- c++库的公共头文件中应该包含什么
- 用c++从输入文件中读取另一行
- Cppcheck生成xml转储文件
- 读取文件的最后一行并输入到链接列表时出错
- OPENCV VIDEOWRITER创建空文件
- C OPENCV 3.4 / FFMPEG 3.4.1 VIDEOWRITER和MP4输出文件格式
- OpenCV VideoWriter无法打开文件