2015-04-23 42 views
0

当我尝试使用VideoWriter写入帧时,它不起作用。我已经尝试了许多FOURCC代码,如defaul,h264,mjpg,divx,xvid等。是的,我已经安装了ffmpeg所有必要的配置(--enable-shared,--enable-libx264,... )并且opencv安装在ffmpeg支持上。VideoWriter不会写任何东西

我已经谷歌它很多,我发现一切都甚至几乎没有解决这个问题,这是在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.10 的Ubuntu 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的显示secution时间以下消息:

HIGHGUI ERROR: V4L2: Unable to get property <unknown property string>(5) - Invalid argument 

为什么这个hqppen,我该如何解决这个问题? 。

+0

你能也张贴代码写作的片段? – newbie

回答

0

给OUTPUTFILE “与extention” 尝试了这一点: 与CV_FOURCC示例 - outputfile.avi( 'M', 'J', 'P', 'G')