Extracting individual frames from a video clip (AVI)
From: Tom Robinson (tom.robinson_at_durham.ac.uk)
Date: 03/11/04
- Next message: keith edward: "Tool to auto-generate bean and jsp forms/pages?"
- Previous message: Jezuch: "Re: which one is faster?"
- Next in thread: Tom Robinson: "Re: Extracting individual frames from a video clip (AVI)"
- Reply: Tom Robinson: "Re: Extracting individual frames from a video clip (AVI)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 11 Mar 2004 00:00:32 +0000
(Posted to comp.lang.java.programmer and jmf-interest.)
I'm trying to write an application which can accept a video clip in
the form of an AVI file as input, and produce a series of still images
taken from specific frames in the video. The goal is to be able to
extract every nth frame as an Image object or similar.
I'm currently using JMF to do this, working from the FrameAccess.java
example. The output tells me that the AVI I'm using for input has the
following format:
Video format: IV32, 640x480, FrameRate=5.0, Length=921600 0 extra
bytes
I have already run into trouble trying to use FramePositioningControl
and FrameGrabbingControl for this (using Player rather than Processor
- what is the distinction between the two? why does it exist?), and
I've read that this is because these are not supported for AVI files
(although they might work with mpegs). (Does anyone know why?)
My current solution is to add a BufferToImage converter to
PostAccessCodec.accessFrame() in FrameAccess.java, but this is no good
either because firstly when playing the movie clip through the codec
doesn't seem to "catch" every frame, about 3/4 of them slip through.
And secondly, the BufferToImage converter doesn't work, returning
null, which the documentation says means the conversion failed. Could
anyone tell me why these two problems are occuring?
I think I can access the raw data from the Buffer using
Buffer.getData(), but even so the problem of skipping frames still
remains. The solution isn't ideal anyway because you have to play the
whole movie clip through at normal speed, and wait for the frames to
pass through the codec.
I have noticed through searching archives of jmf-interest and looking
on google groups and the web in general that a few people appear to
have come across the same problems in the past, when trying to
accomplish the same task. There doesn't seem to be a definitive
solution, and I think that extracting frames from a video clip should
definitely be something that JMF is capable of, so I would like to
work towards this.
Perhaps there are better approaches that can be taken to solving this
problem using the JMF. Should I investigate using something like a
PullBufferStream?
If anybody has any suggestions of other routes I could take with this,
perhaps using something other than JMF, please tell me.
Thanks very much for your help,
Tom
References:
http://java.sun.com/products/java-media/jmf/2.1.1/solutions/FrameAccess.java
- Next message: keith edward: "Tool to auto-generate bean and jsp forms/pages?"
- Previous message: Jezuch: "Re: which one is faster?"
- Next in thread: Tom Robinson: "Re: Extracting individual frames from a video clip (AVI)"
- Reply: Tom Robinson: "Re: Extracting individual frames from a video clip (AVI)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|