i want to know how can i extract images from a video using JMF.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
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