Usama Ewall
Usama Ewall

Reputation: 1

RTSP stream gray and laging

I have code to stream the RTSP link via OpenCV. When I run this code, the stream opens with all gray and blurry pixels, and when something moves in the stream, the colors and actual stream is shown and the rest of the pixels are just gray and blurry.

import cv2

# RTSP stream URL
RTSP_URL = "rtsp://192.168.144.25:8554/main.264"

# Open RTSP stream using OpenCV
cap = cv2.VideoCapture(RTSP_URL)

if not cap.isOpened():
    print("❌ Error: Unable to open RTSP stream.")
    exit()

print("✅ RTSP Stream Opened Successfully")

while True:
    ret, frame = cap.read()
    if not ret:
        print("⚠️ Frame missing! Retrying...")
        continue

    cv2.imshow("RTSP Stream", frame)

    # Press 'q' to exit
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

cap.release()
cv2.destroyAllWindows()

The errors/warnings shown in the terminal are:

[hevc @ 0x182b4340] Could not find ref with POC 6
[hevc @ 0x1828ffc0] Could not find ref with POC 0
[hevc @ 0x185ddb10] Could not find ref with POC 12
qt.qpa.plugin: Could not find the Qt platform plugin "wayland" 
in "/home/raspberrypi/bird_motion/lib/python3.11/site- 
packages/cv2/qt/plugins"
[hevc @ 0x182b4340] Could not find ref with POC 15
[hevc @ 0x1828ffc0] Could not find ref with POC 17
[hevc @ 0x182e0050] Could not find ref with POC 20
[hevc @ 0x185ddb10] Could not find ref with POC 25
[hevc @ 0x182b4340] Could not find ref with POC 27
[hevc @ 0x182e0050] Could not find ref with POC 0
[hevc @ 0x182b4340] Could not find ref with POC 3
[hevc @ 0x1828ffc0] Could not find ref with POC 19
[hevc @ 0x182e0050] Could not find ref with POC 3
[hevc @ 0x185ddb10] Could not find ref with POC 5
[hevc @ 0x1828ffc0] Could not find ref with POC 12
[hevc @ 0x185ddb10] Could not find ref with POC 15
[hevc @ 0x182b4340] Could not find ref with POC 22
[hevc @ 0x182e0050] Could not find ref with POC 25
[hevc @ 0x185ddb10] Could not find ref with POC 27
[hevc @ 0x182b4340] Could not find ref with POC 3
[hevc @ 0x1828ffc0] Could not find ref with POC 9
[hevc @ 0x182e0050] Could not find ref with POC 18

Upvotes: -1

Views: 57

Answers (0)

Related Questions