extracting image from a video in java
i want to know how can i extract images from a video using JMF开发者_Python百科.
Player player = Manager.createRealizedPlayer(cdi.getLocator());
player.start();
FrameGrabbingControl frameGrabber = (FrameGrabbingControl) player.getControl("javax.media.control.FrameGrabbingControl");
//////////////////////////////
private Image grab() {
Buffer buf = frameGrabber.grabFrame();
// Convert frame to an buffered image so it can be processed and saved
Image img = (new BufferToImage((VideoFormat) buf.getFormat()).createImage(buf));
return img;
}
for more info see complete example: http://www.comp.rgu.ac.uk/staff/fh/CM4062/mis/jmf/FrameGrab.html
精彩评论