Error opening file (/home/vaibhav/opencv/modules/highgui/src/cap_ffmpeg_impl.hpp:553) in openCV

后端 未结 8 700
挽巷
挽巷 2020-12-30 15:10

I am using OpenCV to display a video my code is as

#include
#include
#include
#include

        
8条回答
  •  醉酒成梦
    2020-12-30 15:51

    I had the same problem, and I did two things (I'm using Python 2.7.9 on Windows 10):

    First, add this folder to your Path variable:

    C:\opencv\sources\3rdparty\ffmpeg\

    And this file opencv_ffmpeg300.dll must have the correct OpenCV version. For example, for me it's 3.0.0, so you need to change it for yourself.

    Next, make sure to add an extra backslash slash in your video path:

    video_capture = cv2.VideoCapture ('C:\Temp\\bouncingBall.avi')
    

    Python has some special characters, so if there's only one backslash, it would interpret it differently and thus throw an error. You can see more here:

    https://docs.python.org/2.0/ref/strings.html

    Hence the double backslash.

    Anyway, hope this helps!

提交回复
热议问题