opencv frame count
fr_cnt = cap.get(CV_CAP_PROP_POS_FRAMES);
I'm getting frame number of a video with this code,
and when it gets a certain key, it skips 50 frames
fr_cnt += 50;
cap.set(CV_CAP_PROP_POS_FRAMES, fr_cnt-1);
but when the frame is skipped, the number of frame shown on the video is counted slower than the real frame number, and the difference gets bigger as the time goes. What would be the problem here?
I am probably not the only one, but your problem is very unclear to me, especially because the most essential part - how you wrote the key handling - is not showing up in your question. Please edit it and improve the quality...
why the
fr_cnt-1
? (you're obviously only skipping 49 frames, not 50)I don't understand well your question but consider that setting frame number isn't immediate. It depends of codec used in your video file. When skipping some frames VideoCapture would require to grab/decode all/some frame in the range and this take time.