bytedeco / javacv

Java interface to OpenCV, FFmpeg, and more
Other
7.39k stars 1.56k forks source link

Can Java use the OpenCV library bound by JavaCPP for CUDA-accelerated decoding of RTSP streams #2194

Closed sulv9999 closed 4 months ago

sulv9999 commented 4 months ago

Can Java use the OpenCV library bound by JavaCPP for CUDA-accelerated decoding of RTSP streams I have not succeeded. I can confirm that the RTSP stream address I am using is correct, and I am able to open it using VLC.

package org.example; import org.bytedeco.opencv.opencv_core.GpuMat; import org.bytedeco.opencv.opencv_core.Mat; import org.bytedeco.opencv.opencv_videoio.VideoCapture; public class Main { public static void main(String[] args) { VideoCapture videoCapture = new VideoCapture("rtsp://admin:abcd1234@192.168.2.101:554/h265/ch1/main/video"); if (videoCapture.isOpened()) { System.out.println(1); } GpuMat gpuMat = new GpuMat(); Mat mat = new Mat(); if (videoCapture.read(gpuMat)) { gpuMat.upload(mat); } } }

ERROR:0@0.320] global cap.cpp:164 open VIDEOIO(CV_IMAGES): raised OpenCV exception:

OpenCV(4.7.0) /__w/javacpp-presets/javacpp-presets/opencv/cppbuild/linux-x86_64/opencv-4.7.0/modules/videoio/src/cap_images.cpp:253: error: (-5:Bad argument) CAP_IMAGES: can't find starting number (in the name of file): rtsp://admin:abcd1234@192.168.2.101:554/h265/ch1/main/video in function 'icvExtractPattern'

Exception in thread "main" java.lang.RuntimeException: OpenCV(4.7.0) /__w/javacpp-presets/javacpp-presets/opencv/cppbuild/linux-x86_64/opencv-4.7.0/modules/core/src/matrix_wrap.cpp:1689: error: (-213:The function/feature is not implemented) CUDA support is not enabled in this OpenCV build (missing HAVE_CUDA) in function 'release'

at org.bytedeco.opencv.opencv_videoio.VideoCapture.read(Native Method)
at org.example.Main.main(Main.java:23)
saudet commented 4 months ago

Please use FFmpegFrameGrabber

saudet commented 4 months ago

Duplicate of https://github.com/bytedeco/javacpp-presets/issues/1478