Skip to content

VideoCaptureStreamRT is stuck when reading streams #67

@QZL12138

Description

@QZL12138
import cv2
import ffmpegcv
from ultralytics import YOLO

model = YOLO("yolo11n.pt")
STREAM_URL = "rtmp://192.168.1.100/live/test"
with ffmpegcv.ReadLiveLast(ffmpegcv.VideoCaptureStreamRT,
                           stream_url=STREAM_URL,
                           gpu=0,
                           resize=(1280, 720),
                           timeout=10,
                           resize_keepratio=False,
                           ) as cap:
    for frame in cap:  # After running for a long time, it will get stuck here. If it doesn't enter the "for" section, it will keep getting stuck here
        results = model(frame, stream=True)
        for result in results:
            annotated_frame = result.plot()
            cv2.imshow("YOLO Inference", annotated_frame)
            if cv2.waitKey(1) & 0xFF == ord('q'):
                break

In the project, I used VideoCaptureStreamRT to pull the RTSP stream from the camera. After running for some time, I found that the program did not enter the for loop normally

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions