VideoCapture from file

asked 2013-10-29 04:44:50 -0500

eran gravatar image

updated 2013-10-29 05:22:43 -0500


I'm kinda new to opencv, and cant figure out what i'm doing wrong while opening a video file with VideoCapture functionality.

I only use this simple code:

import cv2
cap = cv2.VideoCapture()"Field.avi")
print cap.isOpened()

I tried installing k-lite's most updated codec pack, and several more. Still, I get 'False'. Needless to say, the video is in the same folder as the py file.

The video works on the media player.


edit retag flag offensive close merge delete



Are your path variables set correctly? If the python code isn't able to find the ffmpeg library which is in the provided library structure, then it will never execute correctly...

StevenPuttemans gravatar imageStevenPuttemans ( 2013-10-29 05:27:30 -0500 )edit

I've copied opencv_ffmpeg.dll to the Python27 folder. Is that what you mean?

eran gravatar imageeran ( 2013-10-29 05:31:44 -0500 )edit

I have no experience with python but when using the C++ interface on Windows, I have to define the location of all additional libraries and include folders. The PATH variable is used to define where the dll's for those libraries are found. I guess you need to do something equal in python?

StevenPuttemans gravatar imageStevenPuttemans ( 2013-10-29 05:44:54 -0500 )edit

The Python27 folder is written in PATH variable

eran gravatar imageeran ( 2013-10-29 06:03:52 -0500 )edit