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

后端 未结 8 569
挽巷
挽巷 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:40

    After having the same issue, I added one more header, opencv/ml.h, which is for machine learning. With this header and the Path variable C:\opencv\sources\3rdparty\ffmpeg\ your code works on my machine.

    0 讨论(0)
  • 2020-12-30 15:48

    I had the same problem. Very annoying (opencv 2.4.9). But what worked for me was passing the absolute file name (avi or mpeg), i.e whole path.

    E.g.:

    char* fileName = "D:/myVideos/video.avi"
    ...
    VideoCapture capture(fileName );
    
    0 讨论(0)
  • 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!

    0 讨论(0)
  • 2020-12-30 15:59

    If using absolute path, add double slash to path as below.

    data = cv2.VideoCapture('C:\Data\MyVideo.mp4')
    
    data.isOpened()
    

    Out[11]: False

    data = cv2.VideoCapture('C:\\\Data\\\MyVideo.mp4')
    
    data.isOpened()
    

    Out[13]: True

    0 讨论(0)
  • 2020-12-30 16:04

    I'm facing the same issue, but the problem is I used the wrong resolution.

    change

    rtsp://admin:admin@192.168.1.58:554/h264/video.sdp?camera=13
    

    to default solved it. (without indicating the resolution parameter)

    rtsp://admin:admin@192.168.1.58:554/h264/video.sdp
    

    BTW Device: EVO-05 Mini

    0 讨论(0)
  • 2020-12-30 16:06

    to clear up some confusion here:

    the error means, that it could not find or open your Video file. (either file not found, or codec not present)

    "/home/vaibhav/opencv/modules/highgui/src/cap_ffmpeg_impl.hpp:553" is just the location of the code, where the error is thrown.

    (and please, don't use the deprecated c-api any longer, they stopped developing it like 5 years ago, switch over to the c++ one. )

    0 讨论(0)
提交回复
热议问题