如何从rtsp播放.mov

问题描述 投票:1回答:1

我正在尝试使用rtsp在.mov文件上播放的wifi摄像头播放,我得到的图像但它到达扭曲,有时像素化有时绿色,有时没有错误,而我正在播放它我在bash中得到以下消息:

    left block unavailable for requested intra mode at 0 29
[h264 @ 0x1e5af00] error while decoding MB 0 29, bytestream (-1)
[h264 @ 0x1e5b4c0] left block unavailable for requested intra mode at 0 29
[h264 @ 0x1e5b4c0] error while decoding MB 0 29, bytestream (-1)
[h264 @ 0x1e56900] left block unavailable for requested intra mode at 0 28
[h264 @ 0x1e56900] error while decoding MB 0 28, bytestream (-1)
[h264 @ 0x1e56900] left block unavailable for requested intra mode at 0 28
[h264 @ 0x1e56900] error while decoding MB 0 28, bytestream (-1)
[h264 @ 0x1ef56e0] left block unavailable for requested intra mode at 0 29
[h264 @ 0x1ef56e0] error while decoding MB 0 29, bytestream (-1)
[h264 @ 0x1e5af00] left block unavailable for requested intra mode at 0 19

看到相机拍摄的图像我正在使用它

 cv::VideoCapture capture("rtsp://192.168.1.254/sjcam.mov");
if (!capture.isOpened()) {
        //Error
    }

    cv::namedWindow("TEST", CV_WINDOW_AUTOSIZE);

    cv::Mat frame;

    for(int i =0; i<50000;i++) {
        if (!capture.read(frame)) {
            //Error
        }
        cv::imshow("TEST", frame);

        cv::waitKey(30);
    }

我不知道我还能做什么,或者问题出在哪里,我曾尝试使用opencv播放.mov视频,我没有遇到任何问题,所以我想我做错了rtsp非常感谢

opencv video stream rtp
1个回答
1
投票

如果你收到如下错误:

解码MB时出错

qscale diff的cabac解码失败了

左侧块不可用于请求的帧内模式

再次初始化您的VideoCapture:

#python
import cv2
address = "rtsp://login:[email protected]:554/live/main"
cap = cv2.VideoCapture(address)
while (True):
    ret, image_np = cap.read()
    if ret:
        cv2.imwrite("image.jpg", image_np)
    else:
        cap = cv2.VideoCapture(address)
© www.soinside.com 2019 - 2024. All rights reserved.