Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to connect video stream fasterly #956

Open
hexianbin1994 opened this issue Feb 20, 2024 · 1 comment
Open

how to connect video stream fasterly #956

hexianbin1994 opened this issue Feb 20, 2024 · 1 comment
Labels

Comments

@hexianbin1994
Copy link

env:
os windows
python 3.8
opencv==4.5.2.52

when I connect video stream ,it cost more than 1 second to connect ,how to make this time less than 0.5 second

ex:

import os
os.environ["OPENCV_VIDEOIO_MSMF_ENABLE_HW_TRANSFORMS"] = "0"
import cv2,datetime
s = "rtsp://128.8.84.224:18554/stream"

print(f"\ncv2.VideoCapture 1  -- time {datetime.datetime.now().strftime('%Y%m%d %H:%M:%S:%f')}")
self.cap = cv2.VideoCapture(s)
print(f"\ncv2.VideoCapture 2  -- time {datetime.datetime.now().strftime('%Y%m%d %H:%M:%S:%f')}")
cv2.VideoCapture 1  -- time 20240220 10:56:10:635229

cv2.VideoCapture 2  -- time 20240220 10:56:11:730034

if the video stream resolution is heigher ,it maybe cost more than 3 second to connect.

@asmorkalov
Copy link
Collaborator

RTSP stream with h264/h265 codec is stateful. Decoder starts produce frames, when the first key frame is reached. Please check the camera configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants