Reputation: 555
I have been trying for hours to read a xvid .avi file on my mac with python 2.7 and opencv. I have installed all the latest versions using brew and opencv is working in python and I can open images and other movie files but when I try to read a xvid avi file with
cap.cv2.VideoCapture('video.AVI')
ret, frame = cap.read()
It fails as frame is empty. I have installed ffmpeg with brew and x264 as well and ran brew doctor. I am totally lost what to do now. Happy to provide more information if needed. I hope someone can help me, thanks.
Upvotes: 1
Views: 2208
Reputation: 11
For opencv3 (in pyenv) I'll supplement crazjo's very helpful and accurate question and answer. I also struggled in vain to read an avi file until I found his answer. Finally I was able to read xvid avi files!
I did the following (I could not and did not install perian!!):
brew install ffmpeg
brew uninstall opencv3
brew install opencv3 --with-ffmpeg -v
Afterwards I made a symlink between the site-packages of my virtualenv and opencv3.
And presto it worked!! I could read avi files.
Thanks once again and I hope this will also be useful for others!!
Upvotes: 1