VideoWriter什么都不写
VideoWriter do not write anything
本文关键字:什么 VideoWriter 更新时间:2023-10-16
当我尝试使用VideoWriter编写帧时,它不起作用。我已经尝试了很多FOURCC代码,比如defaul、h264、mjpg、divx、xvid等。是的,我已经安装了带有所有必要配置的ffmpeg(--enable-shared、--enable-libx264…),opencv安装支持ffmpeg。
我已经在谷歌上搜索了很多,我发现的所有东西都几乎不能解决这个问题,这在OpenCV中反复出现。这个代码是最简单的,几周前它就工作了,但事实并非如此。
一些见解:get(CV_CAP_PROP_FPS)返回未知的选项消息,其值为-1(该集也是如此)。opencv的cmake过程的以下部分也很有趣:
-- Could NOT find Jasper (missing: JASPER_LIBRARIES JASPER_INCLUDE_DIR)
-- checking for module 'gstreamer-video-1.0'
-- package 'gstreamer-video-1.0' not found
-- checking for module 'gstreamer-app-1.0'
-- package 'gstreamer-app-1.0' not found
-- checking for module 'gstreamer-riff-1.0'
-- package 'gstreamer-riff-1.0' not found
-- checking for module 'gstreamer-pbutils-1.0'
-- package 'gstreamer-pbutils-1.0' not found
-- checking for module 'gstreamer-base-0.10'
-- package 'gstreamer-base-0.10' not found
-- checking for module 'gstreamer-video-0.10'
-- package 'gstreamer-video-0.10' not found
-- checking for module 'gstreamer-app-0.10'
-- package 'gstreamer-app-0.10' not found
-- checking for module 'gstreamer-riff-0.10'
-- package 'gstreamer-riff-0.10' not found
-- checking for module 'gstreamer-pbutils-0.10'
-- package 'gstreamer-pbutils-0.10' not found
-- Looking for linux/videodev.h
-- Looking for linux/videodev.h - not found
-- Looking for linux/videodev2.h
-- Looking for linux/videodev2.h - found
-- Looking for sys/videoio.h
-- Looking for sys/videoio.h - not found
-- Looking for libavformat/avformat.h
-- Looking for libavformat/avformat.h - found
-- Looking for ffmpeg/avformat.h
-- Looking for ffmpeg/avformat.h - not found
Opencv 2.4.10Ubuntu 14.04
编辑:我发现问题是VideoWriter对象没有打开,即使在构造函数调用之后也是如此
VideoWriter wr(outputFile, CV_FOURCC('D','I','V','X'), capture.get(CV_CAP_PROP_FPS,Size(capture.get(CV_CAP_PROP_FRAME_WIDTH),capture.get(CV_CAP_PROP_FRAME_HEIGHT)));
使用CV_CAP_PROP_FPS使OpenCV在安全时间内显示以下消息:
HIGHGUI ERROR: V4L2: Unable to get property <unknown property string>(5) - Invalid argument
为什么这个hqppen,我该怎么修?
给出输出文件。"带有扩展"试试这个:示例-带CV_FOURCC('M','J','P','G')的outputfile.avi
相关文章:
- 为不同配置设置MSVC_RUNTIME_LIBRARY的正确方法是什么
- 警告处理为错误这里有什么问题
- 什么时候调用组成单元对象的析构函数
- #定义c-预处理器常量..我做错了什么
- 努力将整数转换为链表。不知道我在这里做错了什么
- C++我的数学有什么问题,为什么我的代码不能正确循环
- 什么时候在C++中返回常量引用是个好主意
- 当在同一名称空间中有两个具有相同签名的函数时,会发生什么
- C++避免重复声明的语法是什么
- c++库的公共头文件中应该包含什么
- 问题:什么是QAbstractItemView::NoEditTriggers的反面
- 有什么方法可以遍历结构吗
- 当类在C++中定义时,有什么方法可以"register"类吗?
- ifstream什么都没读
- 在C++中,将大的无符号浮点数四舍五入为整数的最佳方法是什么
- 实现无开销push_back的最佳方法是什么
- C++从另一个类访问公共静态向量的正确方法是什么
- "throw expression code" 1e7 >返回 d 是什么?投掷标准::overflow_error( "too big" ) : d;意味 着?
- 我应该使用什么来代替void作为变体中的替代类型之一
- VideoWriter什么都不写