Well, there is FFMPEG and some Java bindings and wrappers for it but I need to distribute for each specific platform the right binary file of FFMPEG.
Isnt there any plain Java solution or library without any dependencies like FFMPEG for converting a video fle to an image sequence?
Solutions like FFMPEG, XUGGLER or JMF (abandoned) are not suitable. Is there really no pure Java solution for this?
Maybe for specific video codecs / files at least?
I just want to extract the images from the video file to jpeg / png files and save them to the disk
Is there really no pure Java solution for [extracting images from a video stream]?
Let's see. You have to:
It appears that decoding the video would be the most challenging step. People and companies have spent years developing codecs (encoder / decoder) for various video formats.
There's a project on SourceForge, JMF wrapper for ffmpeg, that has developed a few pure Java video codecs. Perhaps you can look at their source code and see how to develop a Java video codec for yourself.
You can look for other pure Java video codecs if you wish.
There is a pure Java implementation of the following codecs: H.264 ( AVC ), MPEG 1/2, Apple ProRes, JPEG; and the following file formats: MP4 ( ISO BMF, QuickTime ), Matroska, MPEG PS and MPEG TS.
The library is called JCodec ( http://www.jcodec.org ).
It has very little documentation for now but the development team is constantly working on this.
Here's how you can simply grab a frame from an MP4 file ( sample from their web site ):
int frameNumber = 150;
BufferedImage frame = FrameGrab.getFrame(new File("filename.mp4"), frameNumber);
ImageIO.write(frame, "png", new File("frame_150.png"));
To add JCodec to your project you can simply add below to your pom.xml:
<dependency>
<groupId>org.jcodec</groupId>
<artifactId>jcodec</artifactId>
<version>0.1.3</version>
</dependency>
For latest version, see here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With