I began to study opencv. Open with opencv a videofile so easy. But I do not understand how you can open the file using the gsteamer. I read the documentation. As written in the documentation,must do so:
filesrc location=videofile ! decodebin name=decoder decoder. ! queue ! audioconvert ! audioresample ! osssink decoder. ! videoconvert ! xvimagesink
or
filesrc location=something.mp4 ! matroskademux ! decodebin ! videoconvert ! appsink
But I don’t quite understand how to correctly set the path to any file and still use gstreamer. How can I open any video file using opencv and gstreamer? this me code
import cv2
#filepath = input("enter the path to the video")
cap = cv2.VideoCapture("filepath",cv2.CAP_GSTREAMER)
fps = cap.get(cv2.CAP_PROP_FPS) # OpenCV2 version 2 used "CV_CAP_PROP_FPS"
duration = frame_count/fps
print('fps = ' + str(fps))
print('duration (S) = ' + str(duration))
minutes = int(duration/60)
seconds = duration%60
print('duration (M:S) = ' + str(minutes) + ':' + str(seconds))
cap.release()
P.S: Gstreamer is working. I checked the command print(cv2.getBuildInformation()). My OS windows 8.1.