Onvif java or javacv recording video to file from RTSP?

1.6k Views Asked by At

From the camera direct streaming is possible and can display it as well, but not write to a video file any format will do. But from rtsp we get frames by frames and i would like to develop without any more external librarys apart from opencv or javacv if possible. and in opencv-java videoWriter is missing(here) so unable to capture video to a file.

In javacv was unable to create a stream or a recorder from rtsp. case:

FrameGrabber grabber = new FFmpegFrameGrabber("rtsp://1ink..."); FrameRecorder fr = new FFmpegFrameRecorder("rtsp://linkf", 0);

Error is :

java.lang.UnsatisfiedLinkError: no jniavcodec in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1857) at java.lang.Runtime.loadLibrary0(Runtime.java:870) at java.lang.System.loadLibrary(System.java:1119) at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:535) at org.bytedeco.javacpp.Loader.load(Loader.java:410) at org.bytedeco.javacpp.Loader.load(Loader.java:353) at org.bytedeco.javacpp.avcodec.(avcodec.java:12) at org.bytedeco.javacv.FFmpegFrameGrabber.(FFmpegFrameGrabber.java:103)

in both case The rtsp link is working as i get photos from the camera.

Thanks in advance.

1

There are 1 best solutions below

0
On BEST ANSWER

Found the issue. If any one will be helpfull with it.

In javacv if any one has the following error

java.lang.UnsatisfiedLinkError: no jniavcodec in java.library.path

do add

Class.forName("org.bytedeco.javacpp.swresample");

Rest will work fine. All the best.