我想知道如何使用JMF从视频中提取图像。
答案 0 :(得分:2)
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;
}
有关详细信息,请参阅完整示例:http://www.comp.rgu.ac.uk/staff/fh/CM4062/mis/jmf/FrameGrab.html