Video Processing Library for Java

I want to extract frames from a video and apply some filters to it, such as gabor / hough, etc. Which Java library is ideal for handling all kinds of video encodings? I watched GStreamer, JMF, Xuggler, etc., but I could not decide which one would be the best. I also want to edit frames and make videos with new frames.

+6
source share
4 answers

If you want to perform low-level operations, such as retrieving frames and managing them, then Xuggler would be the best choice, because the APIs are focused on this low level. It works on ffmpeg, so it can handle all types of video encodings.

Do not use JMF for anything old, outdated and bad - GStreamer is good, but the API gives you more options to play videos, rather than manipulate frames.

+8
source

JMF is a good choice. But if process time is important in your code, it is better to use Xuggler. Obviously, JMF is more general than Xuggler.

+1
source

You can try the Marvin Framework . It uses JavaCV to encode video and access devices, but all image processing algorithms are pure Java.

It’s very easy to upload video and process frames in real time, as shown in the edge detection example below.

enter image description here

Source:

import static marvin.MarvinPluginCollection.*; public class SimpleVideoProcessing extends JFrame implements Runnable{ private MarvinVideoInterface videoAdapter = new MarvinJavaCVAdapter(); private MarvinImagePanel videoPanel = new MarvinImagePanel(); private MarvinImage videoFrame, videoOut = new MarvinImage(640,480); public SimpleVideoProcessing() throws MarvinVideoInterfaceException{ super("Simple Video Processing using Marvin"); add(videoPanel); // Load video file and start the processing thread videoAdapter.loadResource("./res/snooker.wmv"); new Thread(this).start(); setSize(640,500); setVisible(true); } public void run() { try { while(true){ // Request, process and show the video frame. videoOut.clear(); videoFrame = videoAdapter.getFrame(); prewitt(videoFrame.clone(), videoOut); videoPanel.setImage(videoOut); } } catch (MarvinVideoInterfaceException e) { e.printStackTrace(); } } public static void main(String[] args) throws MarvinVideoInterfaceException { new SimpleVideoProcessing().setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } } 
+1
source

Xuggler, yes. But if you are going to work on a lot of image processing, you should go with OpenImaj . This library uses Xuggler as its dependency, but that’s not all it does. Think about the features of Opencv without the lack of speed you get in Java. Also, all that is required is to add the maven dependency, and you are good to go. The amount of code is also reduced.

Note I am still browsing the library and will keep updating my answer on how this happens.

Introductory video: https://www.youtube.com/watch?v=TNEQ0eNqLgA

0
source

All Articles