Read video with VideoCapture in OpenCV 2.4.11
Hi,
I am trying to read a video:
#include <cassert>
#include <opencv2/highgui/highgui.hpp>
int main()
{
cv::VideoCapture in("mpi_sintel_final_alley_1.avi");
cv::Mat frame;
assert(in.isOpened());
assert(in.read(frame));
}
The second assertion fails. I've tried some other videos as well, it doesn't work either. I uploaded this video to my GitHub repo: https://raw.githubusercontent.com/vad...
The version of OpenCV is 2.4.11 and it is compiled with FFmpeg 2.7.2.
What am I missing?
Thank you, Vadim
May be your issue is with FMP4 codec installation in your PC. You are using the DirectShow version of the codec or a VFW interface compatible codec ?
I am running this example on Linux. I install FFmpeg and OpenCV as follows: http://pastebin.com/LP1VzRSJ
here with OpenCV 3.0.0 and ffmpeg 2.7.2 the above code works without problem ;-).
Is the codec FMP4 available for your opencv installation ?
What's happens if you try to create a video using that codec ? and if you try to create a video file using CV_FOURCC_PROMPT for the codec param (you should see the list of available codec) ?
When I compile this:
with OpenCV 3.0.0 (built with this script: http://pastebin.com/sdzH7udG), I get this:
877677894 corresponds to FMP4
assert(in.isOpened()) check passes fine.
I build the example with this:
The linking is done statically, the resulting binary has no OpenCV/ffmpeg shared lib dependencies.
try with