Unable to open video from C++ in opencv. It works from python
I'm trying to use open cv (2.4.9) video support from within C++. However, when I try to open a video file with cv::VideoCapture
I get
warning: Error opening file (/tmp/opencv-mLsrDm/opencv-2.4.9/modules/highgui/src/cap_ffmpeg_impl.hpp:545)
WARNING: Couldn't read movie file videoname.mp4
Using cv2.VideoCapture
from within python on the same file works. The python wrappers are from the same build of opencv as far as I can tell so I'm a bit perplexed.
Mac os 10.9.4. OpenCV is built with ffmpeg (but no quicktime as that wouldn't compile) via homebrew.
I'm linking against all the libraries that the the python cv2.so is linked against.
Any ideas? Thanks.
Are you certain that the path to the video file in your C++ code is correct?
Ffmpeg is outdated and known to cause TONS of errors on linux. On Ubuntu it is replaced by libav. I suggest building opencv without ffmpeg support and trying again. That might work for you.