Skip to content

cv::cudacodec::VideoReader unable to Play rtsp stream  #9739

@pawan9

Description

@pawan9
System information (version)
  • OpenCV => 3.3.0
  • Operating System / Platform => Ubuntu 16.04, x86_64
  • Compiler => gcc version 5.4.1 20160904
  • Cuda => 8.0
  • Nvidia card => GTX 1080 Ti
Detailed description

i am trying to play a rtsp stream using cudacodec::VideoReader

Rtsp Stream Details ( from vlc )

stream_details
this stream plays fine in vlc and cv::VideoCapture but when i try to play it in cudacodec::VideoReader i get a error saying:

OpenCV Error: Gpu API call (CUDA_ERROR_FILE_NOT_FOUND [Code = 301]) in CuvidVideoSource, file /home/sumit/Downloads/softwares/opencv/modules/cudacodec/src/cuvid_video_source.cpp, line 66
Invalid UE golomb code
Invalid UE golomb code
OpenCV Error: Unsupported format or combination of formats (Unsupported video source) in FFmpegVideoSource, file /home/sumit/Downloads/softwares/opencv/modules/cudacodec/src/ffmpeg_video_source.cpp, line 110 terminate called after throwing an instance of 'cv::Exception'
what(): /home/sumit/Downloads/softwares/opencv/modules/cudacodec/src/ffmpeg_video_source.cpp:110: error: (-210) Unsupported video source in function FFmpegVideoSource

Steps to reproduce
#include "opencv2/opencv_modules.hpp"

#if defined(HAVE_OPENCV_CUDACODEC)

#include <opencv2/core.hpp>
#include <opencv2/cudacodec.hpp>
#include <opencv2/highgui.hpp>

int main(int argc, const char* argv[])
{
    const std::string fname = "rtsp://admin:admin@192.168.1.13/media/video2";

    cv::namedWindow("GPU", cv::WINDOW_NORMAL);

    cv::cuda::GpuMat d_frame;
    cv::Ptr<cv::cudacodec::VideoReader> d_reader = cv::cudacodec::createVideoReader(fname);

    for (;;)
    {

        if (!d_reader->nextFrame(d_frame))
            break;

        cv::Mat frame;
        d_frame.download(frame);
        cv::imshow("GPU", frame);

        if (cv::waitKey(3) > 0)
            break;
    }
    return 0;
}

#else
int main()
{
    std::cout << "OpenCV was built without CUDA Video decoding support\n" << std::endl;
    return 0;
}
#endif

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions