Reputation: 65
I'm trying to capture the video. If I input 00:00:10, I want to go to that time of video and capture it.
Now, I get the duration of video. And If the duration is same with input time, I stop and capture it. But that takes too much time.
int timing = cap.get(CAP_PROP_POS_MSEC);
How can I solve this problem?
Upvotes: 1
Views: 3207
Reputation: 381
You can use the function
bool cv::VideoCapture::set ( int propId, double value )
with
propId = CAP_PROP_POS_MSEC //Current position of the video file in milliseconds.
Example:
VideoCapture openCVCapture("video1.mp4");
openCVCapture.set(cv2.CAP_PROP_POS_MSEC,20000) //jump to 20 sec
openCVCapture >> image;
More information is in Opencv docs
Upvotes: 2