There is a clean 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 ).
He currently has very little documentation, but the development team is constantly working on it.
Here's how you can just grab a frame from an MP4 file (sample from your website):
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 your pom.xml below:
<dependency> <groupId>org.jcodec</groupId> <artifactId>jcodec</artifactId> <version>0.1.3</version> </dependency>
For the latest version see here .
source share