Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/142.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/opencv/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ OpenCV无法读取MP4视频_C++_Opencv_Ubuntu_Image Processing_Ffmpeg - Fatal编程技术网

C++ OpenCV无法读取MP4视频

C++ OpenCV无法读取MP4视频,c++,opencv,ubuntu,image-processing,ffmpeg,C++,Opencv,Ubuntu,Image Processing,Ffmpeg,我正在使用Ubuntu 14.04上的OpenCV 2.4.8阅读一些MP4视频。该程序可在Mac和其他Linux机器上运行,但由于某种原因,当我编译并运行该程序时,它在退出之前会给我以下错误: [h264 @ 0x1d0dcc0] missing picture in access unit [h264 @ 0x1d0dcc0] missing picture in access unit Non-reference picture received and no reference avai

我正在使用Ubuntu 14.04上的OpenCV 2.4.8阅读一些MP4视频。该程序可在Mac和其他Linux机器上运行,但由于某种原因,当我编译并运行该程序时,它在退出之前会给我以下错误:

[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
Non-reference picture received and no reference available
[h264 @ 0x1d0dcc0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d0dcc0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d0dcc0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d0dcc0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d0dcc0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d0dcc0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d0dcc0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d0dcc0] decode_slice_header error
[h264 @ 0x1d0dcc0] missing picture in access unit
Non-reference picture received and no reference available
[h264 @ 0x1d0dcc0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d0dcc0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d0dcc0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d0dcc0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d0dcc0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d0dcc0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d0dcc0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d0dcc0] decode_slice_header error
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
Non-reference picture received and no reference available
[h264 @ 0x1d8a5c0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d8a5c0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d8a5c0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d8a5c0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d8a5c0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d8a5c0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d8a5c0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1d8a5c0] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1cf8f40] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1cf8f40] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1cf8f40] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1cf8f40] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1cf8f40] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1cf8f40] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1cf8f40] decode_slice_header error
Non-reference picture received and no reference available
[h264 @ 0x1cf8f40] decode_slice_header error
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
[h264 @ 0x1d0dcc0] missing picture in access unit
在文件中读取的代码的主要部分如下所示(它们在一些方法之间分割,因此我包含了执行打开和读取帧的所有工作的行:

cv::VideoCapture cap;
cap.open (input_path);
success = cap.read (data.frames[i]);

有人知道如何让我的程序在这些视频中正确阅读吗?我试着在“cap.open”之前加上“cap.set(CV_cap_PROP_FOURCC,CV_FOURCC('H','2','6','4'));”但这似乎不起作用。

根据我的经验,最简单的解决方案是转换为.avi
opencv不能像.avi那样简单地处理mp4文件,这似乎是opencv的错。不幸的是,我要处理数百个mp4视频,这将占用大量的时间(和空间)虽然你可能是对的,但我还是想把它们全部转换成视频。如果我只需要再处理几段视频而不制作更多视频,那么我就可以把它们转换成.avi。怎么样?干杯!当我也换成Mac时,我遇到了一个问题,但我发现如果我显式地使用一个标志将其链接到ffmpeg,这是可行的。