Cannot open “.mp4” video files using OpenCV 2.4.3, Python 2.7 in Windows 7 machine

蹲街弑〆低调 提交于 2019-11-27 09:18:09

I have had the same issue before, solved by this step:

Check your OpenCV python version

>>> from cv2 import __version__
>>> __version__
'2.4.0'

Then Copy your opencv_ffmpeg.dll to C:\Python27\ and rename it to relevant your OpenCV Python Version. In my case I had to rename it to opencv_ffmpeg240.dll.

Update: On Windows, you can find the opencv_ffmpeg DLL inside of the build folder of your OpenCV installation. For example: C:\dev\opencv\build\x86\vc12\bin

Then, just copy and paste the opencv_ffmpeg<version>.dll file into the root folder of your Python installation.

I ran into this issue using OpenCV version 2.4.11 and Python 2.7 under a Windows 7 operating system. I wasn't able to open and manipulate mp4 files, but was able to open avi files.

The solution in my case was to copy the opencv_ffmpeg2411.dll file from the build folder of my OpenCV installation, and paste it into the root folder of my Python installation. So, in my case, the DLL file is in "C:\dev\opencv\build\x86\vc12\bin", and I copied it to "C:\Program Files(x86)\Python2.7".

Your mp4 may be having codecs for which your system does not have support (or opencv does not have support) while your avi codecs may be supported. Also if opencv is using libav for decoding you should install that.

Suresh Doraiswamy

I had the same problem with my .mpg video file. Couldn't open it in openCV.

I copied the openCv_ffmpeg330.dll from the C:\OpenCV\build\bin folder into the c:\python27 folder.

That worked!.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!