直接上代码,关键位置是加载DLL
package mypkg;
import org.opencv.core.Mat;
import org.opencv.core.Size;
import org.opencv.highgui.HighGui;
import org.opencv.imgproc.Imgproc;
import org.opencv.videoio.VideoCapture;
public class TestRtsp {
public static void main(String[] args) {
System.out.println("###start rtsp test###");
System.load("F:/lee/apps/opencv/build/java/x64/opencv_java400.dll");
/// ***最重要的地方!!!一定要加载opencv_ffmpeg400_64.dll这个,要不然是无法解码的,就会失败****
// 这个问题搞了我一整天 终于出来了
System.load("F:/lee/apps/opencv/build/bin/opencv_ffmpeg400_64.dll");
testRtsp();
System.out.println("###end###");
}
private static void testRtsp() {
VideoCapture vc = new VideoCapture();
boolean isOpen = vc.open("rtsp://184.72.239.149/vod/mp4://BigBuckBunny_175k.mov");
System.out.println("isOpen="+isOpen);
Mat mat = new Ma