Simple video decoding in Java / Scala

Is there an easy way to decode video in java / scala?

I only need frames and you need to do some calculations with them. No need to be fast or real.

I tried processing that worked, but didn't like it, and I couldn't integrate it into my project. I have also seen jmf, but its seams are no longer supported since 2004.

+3
source share
3 answers

Take a look at Xuggler or FMJ (which was trying to figure out where the JMF stopped, but looks half dead).

+2
source

FrameGrab JCodec (http://jcodec.org).
MP4 (ISO BMF, QuickTime) AVC (H.264) .

int frameNumber = 150;
BufferedImage frame = FrameGrab.getFrame(new File("filename.mp4"), frameNumber);
ImageIO.write(frame, "png", new File("frame_150.png"));

JCodec maven:

<dependency>
    <groupId>org.jcodec</groupId>
    <artifactId>jcodec</artifactId>
    <version>0.1.3</version>
</dependency>

-.

0

It is easy to get frames from a video file compressed into any format supported by FFMpeg using velvet-video :

IVideoLib lib = new FFMpegVideoLib();
IDemuxer demuxer = lib.demuxer(new File("path-to-video-file"));
while(demuxer.nextPacket(frame -> {
    BufferedImage image = frame.image();
    // You get frames as BufferedImages here
}, null));

Disclaimer: I am the author of the velvet video.

0
source

All Articles