2014-02-26 51 views
1

我正在嘗試使用OpenCV將視頻寫入磁盤。該代碼使用視頻編寫器對象以.mpg格式和30幀/秒的格式保存文件。我指定使用CV_FOURCC宏編解碼器如下:使用OpenCV創建視頻 - Gstreamer編解碼器不能正常工作

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

當我執行的代碼我得到的錯誤:

[email protected]:~/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,運動-jpeg,MPEG-4.2,MPEG-4.3,MPEG-4,H263,H263I和FLV1,但它們都沒有工作。問題似乎是V4L。

我試着用下面的命令來安裝它,但我得到了化妝後的錯誤:

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] Error 1 make[3]: Leaving directory /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] Error 1 make[1]: Leaving directory `/home/userk/Development/opencv-2.4.8/dependencies/v4l-utils-1.0.1' make: ** [all] Error 2

這有什麼錯爲v41?你有什麼建議嗎?

回答