/** * Get frame at a specified frame number as JCodec image * * @param file * @param second * @return * @throws IOException * @throws JCodecException */ public static Picture getFrameFromChannel(SeekableByteChannel file, int frameNumber) throws JCodecException, IOException { return createFrameGrab(file).seekToFramePrecise(frameNumber).getNativeFrame(); }
/** * Get a specified frame by number from an already open demuxer track * * @param vt * @param decoder * @param frameNumber * @return * @throws IOException * @throws JCodecException */ public static Picture getNativeFrameAtFrame(SeekableDemuxerTrack vt, ContainerAdaptor decoder, int frameNumber) throws IOException, JCodecException { return new FrameGrab(vt, decoder).seekToFramePrecise(frameNumber).getNativeFrame(); }
try{ fg = new FrameGrab(seekableByteChannel); if(startFrame != 0) fg.seekToFramePrecise(startFrame); } catch(JCodecException e){ throw new RuntimeException(e);
/** * Get frame at a specified frame number as JCodec image * * @param file * @param second * @return * @throws IOException * @throws JCodecException */ public static Picture getFrameFromFile(File file, int frameNumber) throws IOException, JCodecException { FileChannelWrapper ch = null; try { ch = NIOUtils.readableChannel(file); return createFrameGrab(ch).seekToFramePrecise(frameNumber).getNativeFrame(); } finally { NIOUtils.closeQuietly(ch); } }
fg = new FrameGrab(seekableByteChannel); if (startFrame != 0) fg.seekToFramePrecise(startFrame); } catch (JCodecException e) { throw new RuntimeException(e);