【发布时间】:2014-04-30 21:10:12
【问题描述】:
除了以 MJPEG 编码的视频文件之外,我无法在 OpenCV 中打开任何视频文件。
我已经使用this 脚本安装了 OpenCV(它应该编译支持 ffmpeg 的 OpenCV)并使用提供的示例进行测试 here。
使用 h264 编码的视频运行时,我得到:
[mov,mp4,m4a,3gp,3g2,mj2 @ 0x123ed80] multiple edit list entries, a/v desync might occur, patch welcome
[h264 @ 0x12465e0] A non-intra slice in an IDR NAL unit.
[h264 @ 0x12465e0] decode_slice_header error
Could not open the output video for write: test.mp4
当运行 MPEG-2 编码的视频时,我得到:
[mpegts @ 0x1e92d80] PES packet size mismatch
[mpegts @ 0x1e92d80] PES packet size mismatch
[mpegts @ 0x1e92d80] max_analyze_duration reached
[mpegts @ 0x1e92d80] PES packet size mismatch
Could not open the output video for write: test.mpeg
我正在运行 x64 Ubuntu 12.04。
编辑:我在 Ubuntu 13.10 x86 VM 上尝试了 OpenCV 2.4.8,ffmpeg 工作正常,但是示例代码仍然失败,这次出现以下错误:
[h264 @ 0x849ff40] A non-intra slice in an IDR NAL unit.
[h264 @ 0x849ff40] decode_slice_header error
Could not find encoder for codec id 28: Encoder not foundOpenCV Error: Unsupported format or combination of formats (Gstreamer Opencv backend doesn't support this codec acutally.) in CvVideoWriter_GStreamer::open, file /home/dan/Install-OpenCV/Ubuntu/2.4/OpenCV/opencv-2.4.8/modules/highgui/src/cap_gstreamer.cpp, line 505
terminate called after throwing an instance of 'cv::Exception'
what(): /home/dan/Install-OpenCV/Ubuntu/2.4/OpenCV/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
【问题讨论】:
-
您可能需要找到位于 OpenCV 中的目录
3rdparty\ffmpeg,并将其完整路径添加到您的系统环境变量。 -
错误信息
Could not open the **output** video for **write**提示你不是要读取文件,而是要写入文件。显示您的代码(只需编辑您的问题),其中可能存在错误。 -
@cyriel 抱歉,我在问题中包含了错误的链接。