这是我在终端中运行的命令,rosrun ros_exploration ros_exploration
之后,出现如下意外错误。应该指出的是,GStreamer: cannot put pipeline to play
可能是此操作的重点问题。不幸的是,我不知道该如何解决。
0:00:04.442429649 3130 0x2071c90 ERROR omx gstomx.c:3249:plugin_init: Failed to load configuration file: Valid key file could not be found in search dirs (searched in: /home/htf/.config:/etc/xdg/xdg-ubuntu:/usr/share/upstart/xdg:/etc/xdg:/usr/local/etc/xdg as per GST_OMX_CONFIG_DIR environment variable, the xdg user config directory (or XDG_CONFIG_HOME) and the system config directory (or XDG_CONFIG_DIRS)
0:00:04.990602557 3078 0x7fd5a8002e70 ERROR GST_PIPELINE grammar.y:816:priv_gst_parse_yyparse: no element "Video"
(ros_exploration:3078): GStreamer-CRITICAL **: gst_element_make_from_uri: assertion 'gst_uri_is_valid (uri)' failed
0:00:04.990762618 3078 0x7fd5a8002e70 ERROR GST_PIPELINE grammar.y:971:priv_gst_parse_yyparse: no source element for URI "/18_09_11-11:44:53-PCL.avi"
GStreamer Plugin: Embedded video playback halted; module filesink0 reported: Could not open file "Video/18_09_11-11:44:53-PCL.avi" for writing.
GStreamer Plugin: Embedded video playback halted; module filesink0 reported: GStreamer error: state change failed and some element failed to post a proper error message with the reason for the failure.
OpenCV Error: Unspecified error (GStreamer: cannot put pipeline to play
) in CvVideoWriter_GStreamer::open, file /home/htf/Downloads/opencv-2.4.13.6/modules/highgui/src/cap_gstreamer.cpp, line 1528
Qt has caught an exception thrown from an event handler. Throwing
exceptions from an event handler is not supported in Qt. You must
reimplement QApplication::notify() and catch all exceptions there.
terminate called after throwing an instance of 'cv::Exception'
what(): /home/htf/Downloads/opencv-2.4.13.6/modules/highgui/src/cap_gstreamer.cpp:1528: error: (-2) GStreamer: cannot put pipeline to play
in function CvVideoWriter_GStreamer::open
Aborted (core dumped)
如果您曾经使用过GStreamer或遇到了相关的问题和解决方案,将不会有什么线索。
这是相关代码的一部分,
PCL_VideoWriter.open(FileName.toAscii()。data(),CV_FOURCC('M','P','2','V'),FPS,cv :: Size(640,480)); // MainTimer-> start(viewer_thr-> loop_time);
if(SLAM_IMG_Capture_flag == 1)
{
FileName.clear();
FileName = "Video/"+CurrDateText+"-"+CurrTimeText+"-SLAM"+".avi";
我尝试重新编译OpenCV-2.4.13。这是我的命令,cmake cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local/opencv-2.4.13 -D WITH_FFMPEG=ON ..
&make
&
`sudo make install`
。然后我得到了
Video I/O:
-- DC1394 1.x: NO
-- DC1394 2.x: YES (ver 2.2.1)
-- FFMPEG: YES
-- avcodec: YES (ver 58.18.100)
-- avformat: YES (ver 58.12.100)
-- avutil: YES (ver 56.14.100)
-- swscale: YES (ver 5.1.100)
-- avresample: YES (ver 1.0.1)
-- GStreamer:
-- base: YES (ver 1.15.0.1)
-- video: YES (ver 1.15.0.1)
-- app: YES (ver 1.15.0.1)
-- riff: YES (ver 1.15.0.1)
-- pbutils: YES (ver 1.15.0.1)
但是,错误是error: ‘CV_CAP_FFMPEG’ was not declared in this scope
或error: ‘CAP_FFMPEG’ is not a member of ‘cv’
仍然存在。
答案 0 :(得分:0)
从我所见,您正在尝试打开视频文件而不是gstreamer管道。对于这种情况,使用opencv的FFMPEG接口可能会更有用。 VideoWriter
类具有一个overload function:
bool cv::VideoWriter::open ( const String & filename,
int apiPreference,
int fourcc,
double fps,
Size frameSize,
bool isColor = true
)
您可以像这样使用它:
PCL_VideoWriter.open(FileName.toAscii().data(),CAP_FFMPEG,CV_FOURCC('M','P','2','V'),FPS,cv::Size(640,480));
// MainTimer->start(viewer_thr->loop_time);
此外,视频的路径是否正确,即“ Video / 18_09_11-11:44:53-PCL.avi”?