Reputation: 73
The following is the code used to read the .mp4
video from python. The code cap.isOpened()
is returning false.
FYI:
I installed the relavant codes and copied opencv_ffmpeg_64.dll
into python folder (/usr/local/lib/python2.7)
-Opencv version: 3.0
-Python:2.7
import numpy as np
import cv2
import gtk
import pygtk
import gobject
count=0
loop=0
cascPath = 'haarcascade_frontalface_default.xml'
faceCascade = cv2.CascadeClassifier(cascPath)
cap = cv2.VideoCapture('sample.mp4')
print (cap.isOpened())
Please suggest what best can be done?
Upvotes: 0
Views: 925
Reputation: 2337
You're probably missing FFMPEG. OpenCV needs the codec information to decode the videos, which ffmpeg provides.
Download FFMPEG from http://ffmpeg.zeranoe.com/builds/ by hitting the 'Download FFmpeg' button. Ensure you have selected the correct version, architecture and 'Statis' build. Unzip the downloaded file, rename it as 'ffmpeg' and move to C:\ (for eg). Now add the path C:\ffmpeg\bin to your PATH system variable.
The steps are detailed here with pictures: http://www.wikihow.com/Install-FFmpeg-on-Windows
Upvotes: 1