Build OpenCV with FFmpeg Bug don't work VideoCapture For RTSP URL

HI.

I use following cmake options for building for Opencv.

cmake CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr -DOPENCV_EXTRA_MODULES_PATH=…/…/opencv_contrib-4.4.0/modules -DWITH_CUDA=ON -DCUDA_FAST_MATH=1 -DBUILD_EXAMPLES=ON -DCUDA_ARCH_BIN=“5.3” -DCUDA_ARCH_PTX="" -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -D OPENCV_GENERATE_PKGCONFIG=ON -DBUILD_EXAMPLES=OFF -DBUILD_opencv_python2=OFF -DBUILD_opencv_python3=OFF -DWITH_FFMPEG=ON …

But I can’t see “FFMPEG: YES” in cmake result.

– Video I/O:
– DC1394: NO
– FFMPEG: NO
– avcodec: YES (57.107.100)
– avformat: YES (57.83.100)
– avutil: YES (55.78.100)
– swscale: YES (4.8.100)
– avresample: YES (3.7.0)
– GStreamer: YES (1.14.5)
– v4l/v4l2: YES (linux/videodev2.h)

I run test code then Stop here and don’t result images from RTSP URL.
How can I fix this problem.

Opening in BLOCKING MODE
NvMMLiteOpen : Block : BlockType = 261
NVMEDIA: Reading vendor.tegra.display-size : status: 6
NvMMLiteBlockCreate : Block : BlockType = 261

#include <opencv2/opencv.hpp>

int main()
{
cv::Mat frame;
cv::VideoCapture cap(“rtsp://admin:admin@192.168.1.80:554/onvif/profile5/media.smp”);

while(1) 
{
	cap.read(frame);
    if (frame.empty())
        printf("error\n");

 	cv::imshow("result", frame);
	cv::waitKey(1);
}

}

I installed ffmpeg like this, could it be a problem?

Accelerated Decode with ffmpeg
https://docs.nvidia.com/jetson/l4t/index.html#page/Tegra%20Linux%20Driver%20Package%20Development%20Guide/multimedia.html#wwpID0E0JB0HA

Hi,
We don’t try the case of enabling ffmpeg in OpenCV. In general, we run gstreamer pipeline to utilize hardware decoding. Please refer to
Doesn't work nvv4l2decoder for decoding RTSP in gstreamer + opencv - #3 by DaneLLL
See if you can run this sample and do development based on it.

1 Like