/** * Retrieves coded size of this video track. * * Note: May be different from video display dimension. * * @return */ public Size getCodedSize() { SampleEntry se = getSampleEntries()[0]; if (!(se instanceof VideoSampleEntry)) throw new IllegalArgumentException("Not a video track"); VideoSampleEntry vse = (VideoSampleEntry) se; return new Size(vse.getWidth(), vse.getHeight()); }
public static VideoSampleEntry createVideoSampleEntry(Header atom, short version, short revision, String vendor, int temporalQual, int spacialQual, short width, short height, long hRes, long vRes, short frameCount, String compressorName, short depth, short drefInd, short clrTbl) { VideoSampleEntry e = new VideoSampleEntry(atom); e.drefInd = drefInd; e.version = version; e.revision = revision; e.vendor = vendor; e.temporalQual = temporalQual; e.spacialQual = spacialQual; e.width = width; e.height = height; e.hRes = hRes; e.vRes = vRes; e.frameCount = frameCount; e.compressorName = compressorName; e.depth = depth; e.clrTbl = clrTbl; return e; }
public void parse(ByteBuffer input) { super.parse(input); version = input.getShort(); revision = input.getShort(); vendor = NIOUtils.readString(input, 4); temporalQual = input.getInt(); spacialQual = input.getInt(); width = input.getShort(); height = input.getShort(); hRes = (float) input.getInt() / 65536f; vRes = (float) input.getInt() / 65536f; input.getInt(); // Reserved frameCount = input.getShort(); compressorName = NIOUtils.readPascalStringL(input, 31); depth = input.getShort(); clrTbl = input.getShort(); parseExtensions(input); }
/** * * @return Vertical dimension of video track */ public int getHeight() { return ((VideoSampleEntry) videoTrack.getSampleEntries()[0]).getHeight(); }
/** * * @return Horizontal dimension of video track */ public int getWidth() { return ((VideoSampleEntry) videoTrack.getSampleEntries()[0]).getWidth(); }
@Override public void doWrite(ByteBuffer out) { super.doWrite(out); out.putShort(version); out.putShort(revision); out.put(JCodecUtil.asciiString(vendor), 0, 4); out.putInt(temporalQual); out.putInt(spacialQual); out.putShort((short) width); out.putShort((short) height); out.putInt((int) (hRes * 65536)); out.putInt((int) (vRes * 65536)); out.putInt(0); // data size out.putShort(frameCount); NIOUtils.writePascalString(out, compressorName, 31); out.putShort(depth); out.putShort(clrTbl); writeExtensions(out); }
public static SampleEntry createMOVSampleEntryFromAvcC(AvcCBox avcC) { SeqParameterSet sps = SeqParameterSet.read(avcC.getSpsList().get(0).duplicate()); int codedWidth = (sps.picWidthInMbsMinus1 + 1) << 4; int codedHeight = SeqParameterSet.getPicHeightInMbs(sps) << 4; SampleEntry se = VideoSampleEntry.videoSampleEntry("avc1", getPicSize(sps), "JCodec"); se.add(avcC); return se; }
public static VideoSampleEntry videoSampleEntry(String fourcc, Size size, String encoderName) { return createVideoSampleEntry(new Header(fourcc), (short) 0, (short) 0, "jcod", 0, 768, (short) size.getWidth(), (short) size.getHeight(), 72, 72, (short) 1, encoderName != null ? encoderName : "jcodec", (short) 24, (short) 1, (short) -1); }
/** * * @return Vertical dimension of video track */ public int getHeight() { return ((VideoSampleEntry) videoTrack.getSampleEntries()[0]).getHeight(); }
/** * * @return Horizontal dimension of video track */ public int getWidth() { return ((VideoSampleEntry) videoTrack.getSampleEntries()[0]).getWidth(); }
@Override public void doWrite(ByteBuffer out) { super.doWrite(out); out.putShort(version); out.putShort(revision); out.put(JCodecUtil2.asciiString(vendor), 0, 4); out.putInt(temporalQual); out.putInt(spacialQual); out.putShort((short) width); out.putShort((short) height); out.putInt((int) (hRes * 65536)); out.putInt((int) (vRes * 65536)); out.putInt(0); // data size out.putShort(frameCount); NIOUtils.writePascalStringL(out, compressorName, 31); out.putShort(depth); out.putShort(clrTbl); writeExtensions(out); }
void addVideoSampleEntry(VideoCodecMeta meta) { SampleEntry se = VideoSampleEntry.videoSampleEntry(codec2fourcc.get(codec), meta.getSize(), "JCodec"); if (meta.getPixelAspectRatio() != null) se.add(PixelAspectExt.createPixelAspectExt(meta.getPixelAspectRatio())); addSampleEntry(se); }
/** * Retrieves coded size of this video track. * * Note: May be different from video display dimension. * * @return */ public Size getCodedSize() { SampleEntry se = getSampleEntries()[0]; if (!(se instanceof VideoSampleEntry)) throw new IllegalArgumentException("Not a video track"); VideoSampleEntry vse = (VideoSampleEntry) se; return new Size(vse.getWidth(), vse.getHeight()); }
public static VideoSampleEntry videoSampleEntry(String fourcc, Size size, String encoderName) { return new VideoSampleEntry(new Header(fourcc), (short) 0, (short) 0, "jcod", 0, 768, (short) size.getWidth(), (short) size.getHeight(), 72, 72, (short) 1, encoderName != null ? encoderName : "jcodec", (short) 24, (short) 1, (short) -1); }
public void parse(ByteBuffer input) { super.parse(input); version = input.getShort(); revision = input.getShort(); vendor = NIOUtils.readString(input, 4); temporalQual = input.getInt(); spacialQual = input.getInt(); width = input.getShort(); height = input.getShort(); hRes = (float) input.getInt() / 65536f; vRes = (float) input.getInt() / 65536f; input.getInt(); // Reserved frameCount = input.getShort(); compressorName = NIOUtils.readPascalString(input, 31); depth = input.getShort(); clrTbl = input.getShort(); parseExtensions(input); }
@Override public void doWrite(ByteBuffer out) { super.doWrite(out); out.putShort(version); out.putShort(revision); out.put(JCodecUtil.asciiString(vendor), 0, 4); out.putInt(temporalQual); out.putInt(spacialQual); out.putShort((short) width); out.putShort((short) height); out.putInt((int) (hRes * 65536)); out.putInt((int) (vRes * 65536)); out.putInt(0); // data size out.putShort(frameCount); NIOUtils.writePascalString(out, compressorName, 31); out.putShort(depth); out.putShort(clrTbl); writeExtensions(out); }
/** * Retrieves coded size of this video track. * * Note: May be different from video display dimension. * * @return */ public Size getCodedSize() { SampleEntry se = getSampleEntries()[0]; if (!(se instanceof VideoSampleEntry)) throw new IllegalArgumentException("Not a video track"); VideoSampleEntry vse = (VideoSampleEntry) se; return new Size(vse.getWidth(), vse.getHeight()); }
public static VideoSampleEntry videoSampleEntry(String fourcc, Size size, String encoderName) { return new VideoSampleEntry(new Header(fourcc), (short) 0, (short) 0, "jcod", 0, 768, (short) size.getWidth(), (short) size.getHeight(), 72, 72, (short) 1, encoderName != null ? encoderName : "jcodec", (short) 24, (short) 1, (short) -1); }
public void parse(ByteBuffer input) { super.parse(input); version = input.getShort(); revision = input.getShort(); vendor = NIOUtils.readString(input, 4); temporalQual = input.getInt(); spacialQual = input.getInt(); width = input.getShort(); height = input.getShort(); hRes = (float) input.getInt() / 65536f; vRes = (float) input.getInt() / 65536f; input.getInt(); // Reserved frameCount = input.getShort(); compressorName = NIOUtils.readPascalString(input, 31); depth = input.getShort(); clrTbl = input.getShort(); parseExtensions(input); }
public Size getDisplayDimensions() { int width = 0, height = 0; if (sampleEntries != null && !sampleEntries.isEmpty() && sampleEntries.get(0) instanceof VideoSampleEntry) { VideoSampleEntry vse = (VideoSampleEntry) sampleEntries.get(0); PixelAspectExt paspBox = NodeBox.findFirst(vse, PixelAspectExt.class, PixelAspectExt.fourcc()); Rational pasp = paspBox != null ? paspBox.getRational() : new Rational(1, 1); width = pasp.getNum() * vse.getWidth() / pasp.getDen(); height = vse.getHeight(); } return new Size(width, height); }