@Override public void reset() { try { grabber = new FrameGrab(NIOUtils.readableFileChannel(new File(filename))); } catch (IOException | JCodecException e) { throw new RuntimeException(e); } try { frameCurrent = null; frameNext = grabber.getNativeFrame(); } catch (IOException e) { frameNext = null; } } }
@Override public void reset() { try { grabber = new FrameGrab(NIOUtils.readableFileChannel(new File(filename))); } catch (IOException | JCodecException e) { throw new RuntimeException(e); } try { frameCurrent = null; frameNext = grabber.getNativeFrame(); } catch (IOException e) { frameNext = null; } } }
/** * 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(); }
/** * Get a specified frame by second from an already open demuxer track * * @param vt * @param decoder * @param frameNumber * @return * @throws IOException * @throws JCodecException */ public static Picture getNativeFrameAtSec(SeekableDemuxerTrack vt, ContainerAdaptor decoder, double second) throws IOException, JCodecException { return new FrameGrab(vt, decoder).seekToSecondPrecise(second).getNativeFrame(); }
/** * Get a specified frame by number from an already open demuxer track ( * sloppy mode, i.e. nearest keyframe ) * * @param vt * @param decoder * @param frameNumber * @return * @throws IOException * @throws JCodecException */ public static Picture getNativeFrameSloppy(SeekableDemuxerTrack vt, ContainerAdaptor decoder, int frameNumber) throws IOException, JCodecException { return new FrameGrab(vt, decoder).seekToFrameSloppy(frameNumber).getNativeFrame(); }
/** * Get a specified frame by second from an already open demuxer track ( * sloppy mode, i.e. nearest keyframe ) * * @param vt * @param decoder * @param frameNumber * @return * @throws IOException * @throws JCodecException */ public static Picture getNativeFrameAtSecSloppy(SeekableDemuxerTrack vt, ContainerAdaptor decoder, double second) throws IOException, JCodecException { return new FrameGrab(vt, decoder).seekToSecondSloppy(second).getNativeFrame(); }
FrameGrab fg; try{ fg = new FrameGrab(seekableByteChannel); if(startFrame != 0) fg.seekToFramePrecise(startFrame); } catch(JCodecException e){
FrameGrab fg; try { fg = new FrameGrab(seekableByteChannel); if (startFrame != 0) fg.seekToFramePrecise(startFrame);
public static FrameGrab createFrameGrab(SeekableByteChannel _in) throws IOException, JCodecException { ByteBuffer header = ByteBuffer.allocate(65536); _in.read(header); header.flip(); Format detectFormat = JCodecUtil.detectFormatBuffer(header); if (detectFormat == null) { throw new UnsupportedFormatException("Could not detect the format of the input video."); } SeekableDemuxerTrack videoTrack_; switch (detectFormat) { case MOV: MP4Demuxer d1 = MP4Demuxer.createMP4Demuxer(_in); videoTrack_ = (SeekableDemuxerTrack)d1.getVideoTrack(); break; case MPEG_PS: throw new UnsupportedFormatException("MPEG PS is temporarily unsupported."); case MPEG_TS: throw new UnsupportedFormatException("MPEG TS is temporarily unsupported."); default: throw new UnsupportedFormatException("Container format is not supported by JCodec"); } FrameGrab fg = new FrameGrab(videoTrack_, detectDecoder(videoTrack_)); fg.decodeLeadingFrames(); return fg; }