How to get the single images of an mp4-Movie in Java

Viewed 19024

I want to do some image analysis on a video that's stored in .mp4 format. Therefore I need a way to just get the images of this movie in Java. I goolged a lot and found some libraries like jcodec and jaad. BUT I wasn't able to get the things running with these libraries. And as I found out, there were examples (at least I found none) that showed my usecase.

Can you help me? Do you know any library that can do what I need and is running at least on Win7 64 bit. Or do you know how to accomplish this with jcodec?

edit:

As I wrote, I tried it with jcodec. I found out how to get the data of a frame, but not how I can get it into something like a BufferedImage or so. I expect that these data isn't in a simple RGB format but in any compressed format or so. (Am I right with that?) I don't know to to decode this data.

You can get the data of a frame with jcodec as follows (at least as far as I understand this):

public static void main(String[] args) throws IOException, MP4DemuxerException {
    String path = "videos/video-2011-09-21-20-07-21.mp4";

    MP4Demuxer demuxer1 = new MP4Demuxer(new FileInput(new File(path)));
    DemuxerTrack videoTrack = demuxer1.getVideoTrack();

    Packet firstFrame = videoTrack.getFrames(1);
    byte[] data = firstFrame.getData();
}

I also found the following: http://code.google.com/p/jcodec/source/browse/trunk/src/test/java/org/jcodec/containers/mp4/DitherTest.java?r=70 But this isn't working (has compile errors) with the downloadable jar-package.

2 Answers
Related