opencv / opencv/opencv-python

how to connect video stream fasterly

Open
#956 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

question
Dominant language
Python
Stars
5.4k
Forks
1k
Avg merge
22h 17m
Merged PRs (30d)
3

Description

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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the timing around cv2.VideoCapture(s) with the stated Windows, Python 3.8, and OpenCV 4.5.2.52 environment and RTSP stream. Compare behavior across stream resolutions and determine whether the delay belongs to opencv-python or the underlying video backend; completion would require a confirmed cause, minimal reproduction, and documented fix or limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
opencv, python
Domain
computer-vision, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.