使用OpenCV创建视频 - Gstreamer编解码器无法正常工作

时间:2014-02-26 16:44:16

标签: c++ opencv video gstreamer

我正在尝试使用OpenCV将视频写入磁盘。该代码使用视频编写器对象以.mpg格式保存文件,并以30帧/秒的速度保存。我已经使用CV_FOURCC宏指定了编解码器,如下所示:

VideoWriter put("test.mpg", CV_FOURCC('M','P','E','G'), 30, S);

当我执行代码时,我收到错误:

userk@dopamine:~/Development/opencv-2.4.8/sketch/RegVideo$ ./vi
HIGHGUI ERROR: V4L/V4L2: VIDIOC_S_CROP
OpenCV Error: Unsupported format or combination of formats (Gstreamer Opencv backend doesn't support this codec acutally.) in CvVideoWriter_GStreamer::open, file /home/userk/Development/opencv-2.4.8/modules/highgui/src/cap_gstreamer.cpp, line 505
terminate called after throwing an instance of 'cv::Exception'
  what():  /home/userk/Development/opencv-2.4.8/modules/highgui/src/cap_gstreamer.cpp:505: error: (-210) Gstreamer Opencv backend doesn't support this codec acutally. in function CvVideoWriter_GStreamer::open

Aborted (core dumped)

我尝试过不同的编解码器,如MPEG-1,motion-jpeg,MPEG-4.2,MPEG-4.3,MPEG-4,H263,H263I和FLV1,但它们都没有奏效。问题似乎是V4L。

我尝试使用以下命令安装它,但是在make之后我遇到了错误:

wget http://www.linuxtv.org/downloads/v4l-utils/v4l-utils-0.9.3.tar.bz2
tar xvf v4l-utils-0.9.3.tar.bz2
cd v4l-utils-0.9.3
make
sudo make install

这是错误消息:

  

make [3]: * [qv4l2-moc_qv4l2.o]错误1   make [3]:离开目录/home/userk/Development/opencv-2.4.8/dependencies/v4l-utils-1.0.1/utils/qv4l2' make[2]: *** [all-recursive] Error 1 make[2]: Leaving directory / home / userk / Development / opencv-2.4.8 / dependencies / v4l-utils-1.0.1 / utils'   make [1]: [all-recursive]错误1   make [1]:离开目录`/home/userk/Development/opencv-2.4.8/dependencies/v4l-utils-1.0.1'   make:* * [all]错误2

v4l有什么问题?你有什么建议吗?

1 个答案:

答案 0 :(得分:-1)