检测到 ffmpeg 默认设置出现问题。

16

我在使用X264 Fourcc编解码器进行VideoWrite时遇到了ffmpeg错误,导致程序崩溃。我已安装所有依赖项,如何解决这个问题?以下是我正在使用的示例代码。

VideoWriter oVideoWriter ("path.mp4", CV_FOURCC('X','2','6','4'), 15, frameSize, false);

操作系统:Ubuntu 14.04 64位

控制台错误:

[libx264 @ 0x8d6220] broken ffmpeg default settings detected
[libx264 @ 0x8d6220] use an encoding preset (e.g. -vpre medium)
[libx264 @ 0x8d6220] preset usage: -vpre <speed> -vpre <profile>
[libx264 @ 0x8d6220] speed presets are listed in x264 --help
[libx264 @ 0x8d6220] profile is optional; x264 defaults to high
Could not open codec 'libx264': Unspecified errorOpenCV Error: Unsupported format or combination of formats (Your version of Gstreamer doesn't support this codec acutally or needed plugin missing.) in CvVideoWriter_GStreamer::open, file /home/mbox140/Development/opencv-2.4.9/modules/highgui/src/cap_gstreamer.cpp, line 518
terminate called after throwing an instance of 'cv::Exception'
  what():  /home/mbox140/Development/opencv-2.4.9/modules/highgui/src/cap_gstreamer.cpp:518: error: (-210) Your version of Gstreamer doesn't support this codec acutally or needed plugin missing. in function CvVideoWriter_GStreamer::open

请为我提供任何解决此问题的方案。

1
如果使用CLI工具而不是API,实际的ffmpeg命令是什么? 实际的完整ffmpeg控制台/日志输出是什么? - llogan
@LordNeckbeard,我已经更新了我的问题并附上了控制台日志,请您查看一下。 - Ramakrishna
请展示完整的控制台输出和(如果可能的话)命令。 - llogan
你坚持使用h264吗?你可以尝试使用其他编解码器,例如MJPG。 - mirosval
也许你的gstreamer过时了? - mprat
显示剩余2条评论
4个回答

1
你可能想要确保你拥有最新版本的libx264编解码器。你可以通过以下方式来实现:
sudo apt-get install --reinstall x264 libx264-dev

错误还指示了GStreamer缺少必要的插件的问题。您可以使用以下命令安装GStreamer插件:
sudo apt-get install gstreamer0.10-plugins-base gstreamer0.10-plugins-good gstreamer0.10-plugins-bad gstreamer0.10-plugins-ugly

0

针对错误:

[libx264 @ 0x8d6220] broken ffmpeg default settings detected
[libx264 @ 0x8d6220] use an encoding preset (e.g. -vpre medium)
[libx264 @ 0x8d6220] preset usage: -vpre <speed> -vpre <profile>
[libx264 @ 0x8d6220] speed presets are listed in x264 --help
[libx264 @ 0x8d6220] profile is optional; x264 defaults to high

您可能需要使用命令 -vpre preset(例如 -vpre fast)。 也许您的libx264版本过旧。 我曾在使用2014年构建的ffmpeg时遇到同样的错误。


由于libx264是间接调用的,因此无法在任何命令行上提供额外的ffmpeg开关。 - micha137

0

这个问题是关于在Linux上使用OpenCv。 - micha137

0
请安装libx264-dev并尝试使用它编译openvc3.0。请参考此链接

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接