I am trying to capture video screenshot from a java application. I have donwloaded the sarxos/webcam-capture library. I have add to my project the executable jar. It is a little bit mess. I want to capture video from a simple javafx interface that I have created. The issue is that after installing the lib and slf4 then it required to install also xuggle. I add xuggle in the path and my code is the following:
File file = new File("output.ts");
IMediaWriter writer = ToolFactory.makeWriter(file.getName());
Dimension size = WebcamResolution.QVGA.getSize();
writer.addVideoStream(0, 0, ICodec.ID.CODEC_ID_H264, size.width, size.height);
Webcam webcam = Webcam.getDefault();
webcam.setViewSize(size);
webcam.open(true);
long start = System.currentTimeMillis();
for (int i = 0; i < 50; i++) {
System.out.println("Capture frame " + i);
BufferedImage image = ConverterFactory.convertToType(webcam.getImage(), BufferedImage.TYPE_3BYTE_BGR);
IConverter converter = ConverterFactory.createConverter(image, IPixelFormat.Type.YUV420P);
IVideoPicture frame = converter.toPicture(image, (System.currentTimeMillis() - start) * 1000);
frame.setKeyFrame(i == 0);
frame.setQuality(0);
writer.encodeVideo(0, frame);
// 10 FPS
Thread.sleep(100);
}
writer.close();
System.out.println("Video recorded in file: " + file.getAbsolutePath());
However I am receiving the following:
Caused by: java.lang.UnsatisfiedLinkError: no xuggle-ferry in java.library.path
EDIT2 I also tried the jxcapture library. I add in my project all the necessary libs I run the following code: enter link description here, the code worked fine I manage to store the video, however in the end I am receiving the following error:
8614 [JNIWrapper.ShutdownHook] ERR