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

Latest version cannot open rtsp cameras #1085

Open
hdnh2006 opened this issue Feb 20, 2025 · 3 comments
Open

Latest version cannot open rtsp cameras #1085

hdnh2006 opened this issue Feb 20, 2025 · 3 comments

Comments

@hdnh2006
Copy link

Hello OpenCV team!

This is a very important issue to be solved.

The latest version of opencv-python is unable to open rtsp cameras. Specifically I am using the version opencv-python-4.11.0.86

With version 4.11.0.86

import cv2
cap = cv2.VideoCapture("rtsp://user:pass@my_dns_of_the_camera:port/h264/ch1/main/av_stream")
while True:
    ret, frame = cap.read()
    print(frame)

Results gotten:

[ WARN:0@30.017] global cap_ffmpeg_impl.hpp:453 _opencv_ffmpeg_interrupt_callback Stream timeout triggered after 30008.638889 ms
[ WARN:0@60.065] global cap_ffmpeg_impl.hpp:453 _opencv_ffmpeg_interrupt_callback Stream timeout triggered after 30036.811558 ms
None

With version 4.10.0.84 (or lower):

import cv2
cap = cv2.VideoCapture("rtsp://user:pass@my_dns_of_the_camera:port/h264/ch1/main/av_stream")
while True:
    ret, frame = cap.read()
    print(frame)

Results gotten:

[[[ 26  26  26]
  [115 115 115]
  [158 158 158]
  ...
  [156 159 155]
  [164 167 163]
  [125 128 124]]

 [[ 26  26  26]
  [115 115 115]
  [158 158 158]
  ...

Versions affected: 4.11.0.86

@babashark
Copy link

I got the same problem too.

opencv-python==4.10.0.84

switch back to previous version then i can open rtsp

@hdnh2006
Copy link
Author

I got the same problem too.

opencv-python==4.10.0.84

switch back to previous version then i can open rtsp

Sure, that's what I did, but the bug is still there in version 4.11

@SYPark0795
Copy link

SYPark0795 commented Feb 28, 2025

I also have a problem capturing a frame from RTSP streams, though not exactly the same error.
When I am capturing a photo, the following message shows up, if the image is complicated enough.

[hevc @ 0x36559090] The cu_qp_delta 78 is outside the valid range [-26, 25].

And then the lower part of the image gets corrupted, often filled with green, or sometimes with a more complicated pattern.

On the web, they say this message often comes up when the computer is not processing the stream fast enough, but in my use case, the computer (RPi 4B) was able to process 70 simultaneous threads with asyncio.to_thread() (they might have been processed in series internally, but that doesn't really matter here). With the new version, even a single capture is getting corrupted.

System: RPi 4B, Bookworm OS version, pip package opencv-python-headless
Camera: Dozens of 5MP RTSP cameras

@mshabunin mshabunin changed the title ⚠️⚠️⚠️ Alert! Latest version cannot open rtsp cameras Latest version cannot open rtsp cameras Feb 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants