检测到破坏的ffmpeg默认设置

Ram*_*hna 14 opencv ffmpeg video-capture h.264 libx264

我在使用X264 Fourcc编解码器的VideoWrite时遇到了ffmpeg错误.我已经安装了所有依赖项.如何解决这个问题.我一直使用的示例代码如下.

VideoWriter oVideoWriter ("path.mp4", CV_FOURCC('X','2','6','4'), 15, frameSize, false);
Run Code Online (Sandbox Code Playgroud)

操作系统:64位Ubuntu 14.04

控制台错误:

[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
Run Code Online (Sandbox Code Playgroud)

建议我解决这个问题.

小智 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
Run Code Online (Sandbox Code Playgroud)

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