IStreamCoder coder = stream.getStreamCoder(); ICodec codec = ICodec.findEncodingCodec(ICodec.ID.CODEC_ID_H264); coder.setNumPicturesInGroupOfPictures(5);
while (i < container.getNumStreams()) { s = container.getStream(i); if (s != null && s.getStreamCoder().getCodecType() == ICodec.Type.CODEC_TYPE_VIDEO) { this.totalFrames = -1; else this.totalFrames = (long) (s.getDuration() * s.getTimeBase().getDouble() * s.getFrameRate().getDouble()); this.fps = s.getFrameRate().getDouble(); final int w = s.getStreamCoder().getWidth(); final int h = s.getStreamCoder().getHeight(); this.width = w; this.height = h;
s.getStreamCoder().getCodecType() == ICodec.Type.CODEC_TYPE_AUDIO) this.length = -1; else this.length = (long) (s.getDuration() * s.getTimeBase().getDouble() * 1000d); getStream(this.streamIndex).getStreamCoder();
double timeBase = 0; int videoStreamId = -1; private void seekToMs(IContainer container, long timeMs) { if(videoStreamId == -1) { for(int i = 0; i < container.getNumStreams(); i++) { IStream stream = container.getStream(i); IStreamCoder coder = stream.getStreamCoder(); if (coder.getCodecType() == ICodec.Type.CODEC_TYPE_VIDEO) { videoStreamId = i; timeBase = stream.getTimeBase().getDouble(); break; } } } long seekTo = (long) (timeMs/1000.0/timeBase); container.seekKeyFrame(videoStreamId, seekTo, IContainer.SEEK_FLAG_BACKWARDS); }
/** * Returns the duration of the video in seconds. * * @return The duration of the video in seconds. */ public synchronized long getDuration() { final long duration = (this.reader.getContainer().getStream(this.streamIndex).getDuration()); final double timebase = this.reader.getContainer().getStream(this.streamIndex).getTimeBase().getDouble(); return Math.round(duration * timebase); }
this.streamIndex).getTimeBase().getDouble(); final long position = (long) (timestamp / timebase);
while (i < container.getNumStreams()) { s = container.getStream(i); if (s != null && s.getStreamCoder().getCodecType() == ICodec.Type.CODEC_TYPE_VIDEO) { this.totalFrames = -1; else this.totalFrames = (long) (s.getDuration() * s.getTimeBase().getDouble() * s.getFrameRate().getDouble()); this.fps = s.getFrameRate().getDouble(); final int w = s.getStreamCoder().getWidth(); final int h = s.getStreamCoder().getHeight(); this.width = w; this.height = h;
s.getStreamCoder().getCodecType() == ICodec.Type.CODEC_TYPE_AUDIO) this.length = -1; else this.length = (long) (s.getDuration() * s.getTimeBase().getDouble() * 1000d); getStream(this.streamIndex).getStreamCoder();
/** * Returns the duration of the video in seconds. * * @return The duration of the video in seconds. */ public synchronized long getDuration() { final long duration = (this.reader.getContainer().getStream(this.streamIndex).getDuration()); final double timebase = this.reader.getContainer().getStream(this.streamIndex).getTimeBase().getDouble(); return Math.round(duration * timebase); }
this.streamIndex).getTimeBase().getDouble(); final long position = (long) (timestamp / timebase);
IStream stream = iContainerObj.getStream(i); IStreamCoder coder = stream.getStreamCoder(); if (coder.getCodecType() == ICodec.Type.CODEC_TYPE_VIDEO && videoStreamId == -1) { videoDuration = container.getDuration() == Global.NO_PTS ? 0 : container.getDuration() / 1000; frameRate = coder.getFrameRate().getDouble(); // other .... }
this.streamIndex).getTimeBase().getDouble(); final long position = (long) (timestamp / timebase);
IStreamCoder coder = stream.getStreamCoder( ); if ( coder.getCodecType( ) == ICodec.Type.CODEC_TYPE_AUDIO ) { audioStreamId = i;
this.streamIndex).getTimeBase().getDouble(); final long position = (long) (timestamp / timebase);
IStreamCoder coder = stream.getStreamCoder();
IStreamCoder coder = stream.getStreamCoder();
// create a Xuggler container object IContainer container = IContainer.make(); if(container.open(file.getPath(),IContainer.Type.READ,null) < 0) { return false; } // query how many streams the call to open found boolean isH264 = false; boolean isAAC = false; int numStreams = container.getNumStreams(); for(int i = 0; i < numStreams; i++) { // find the stream object IStream stream = container.getStream(i); // get the pre-configured decoder that can decode this stream; IStreamCoder coder = stream.getStreamCoder(); if (coder.getCodecID() == ID.CODEC_ID_H264) { isH264 = true; } if (coder.getCodecID() == ID.CODEC_ID_AAC) { isAAC = true; } } if (container !=null) { container.close(); container = null; } return isH264 && isAAC;
for (int i = 0; i < numStreams; i++) { IStream stream = container.getStream(i); IStreamCoder coder = stream.getStreamCoder(); if (coder.getCodecType() == ICodec.Type.CODEC_TYPE_AUDIO) { audioStreamId = i;
IStreamCoder coder = stream.getStreamCoder();
IStreamCoder coder = stream.getStreamCoder();