Helpful openCVers-
If I set the capture property like this:
cv.SetCaptureProperty(Capture,cv.CV_CAP_PROP_POS_FRAMES,40)
then read it like this:
cv.GetCaptureProperty(Capture,cv.CV_CAP_PROP_POS_FRAMES)
I get 0.0, not 40. The next time I query it, the frame is 37 or 49!
Here is my test script:
#testify.py import cv
VideoName= "target.avi" TempName= "temp.tiff" Capture= cv.CaptureFromFile(VideoName)
MaxFrames= cv.GetCaptureProperty(Capture,cv.CV_CAP_PROP_FRAME_COUNT)
for x in range(10):
print cv.GetCaptureProperty(Capture,cv.CV_CAP_PROP_POS_FRAMES)
CurrentFrame = cv.QueryFrame(Capture)
cv.SetCaptureProperty(Capture,cv.CV_CAP_PROP_POS_FRAMES,40)
for x in range(10):
print cv.GetCaptureProperty(Capture,cv.CV_CAP_PROP_POS_FRAMES)
CurrentFrame = cv.QueryFrame(Capture)
cv.SetCaptureProperty(Capture,cv.CV_CAP_PROP_POS_FRAMES,40)
for x in range(10):
print cv.GetCaptureProperty(Capture,cv.CV_CAP_PROP_POS_FRAMES)
CurrentFrame = cv.QueryFrame(Capture)
my output is:
0.0
0.0
1.0
2.0
3.0
4.0
5.0
6.0
7.0
8.0
0.0
49.0
50.0
51.0
52.0
53.0
54.0
55.0
56.0
57.0
0.0
37.0
38.0
39.0
40.0
41.0
42.0
43.0
44.0
45.0
So my question is: why is the first frame always 0.0? and after setting the frame to 40, why does it jump to 49 and 37?
Thanks!
--Cpp