Ask Your Question
0

delay of VideoCapture::read (python)

asked 2019-06-14 02:46:00 -0600

shuhei gravatar image

updated 2019-06-14 02:57:55 -0600

I try to capture frame from IP camera by VideoCapture::read.

cap = cv2.VideoCapture(url)
while True:
    ret, frame = cap.read()

But, capture of 1st frame is delayed about 3 seconds, and subsequent behavior is different on the two PCs.
The version of OS(Windows10), python, OpenCV is same on two PCs. But hardware(model) is different.
The behavior on each PC is as follows.

  • PC1 :
    Capture of 1st frame is delayed about 3 secondes.
    After that, the capture(display) looks like fast-forwarding, finally frame is captured(displayed) in real time.

  • PC2 :
    Frame capture is delayed by fps as follows:

    3fps - about 2.5 seconds
    6fps - about 1.2 seconds
    9fps - about 0.7 seconds
    12fps - about 0.5 seconds
    15fps - about 0.5 seconds
    30fps - about 0.3 seconds

I want to make the behavior of PC2 the same as PC1.
I guess that the settings(like frame buffer) are different, but I don't know where I can set it.
Please help, if you know.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
0

answered 2019-06-14 03:57:27 -0600

RomanS gravatar image

I can suggest you to check two options:
1. Cameras have buffers. And it is possible that your camera uses it.
2. I noticed that video latency could depend on GPU. Please, read this post to get more details.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2019-06-14 02:46:00 -0600

Seen: 3,128 times

Last updated: Jun 14 '19