public void setPAR(Rational par) { for (SampleEntry sampleEntry : getSampleEntries()) { sampleEntry.removeChildren("pasp"); sampleEntry.add(new PixelAspectExt(par)); } }
protected void doWrite(ByteBuffer out) { super.doWrite(out); out.putInt(0); out.putInt(flags); out.putInt(timescale); out.putInt(frameDuration); out.put(numFrames); out.put((byte) 207); }
private SeekableByteChannel getInput(Chunk chunk) { SampleEntry se = entries[chunk.getEntry() - 1]; return inputs[se.getDrefInd() - 1]; }
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 void parse(ByteBuffer input) { super.parse(input); NIOUtils.skip(input, 4); flags = input.getInt(); timescale = input.getInt(); frameDuration = input.getInt(); numFrames = input.get(); NIOUtils.skip(input, 1); }
private static int appendEntries(TrakBox trakBox1, TrakBox trakBox2) { appendDrefs(trakBox1, trakBox2); SampleEntry[] ent1 = trakBox1.getSampleEntries(); SampleEntry[] ent2 = trakBox2.getSampleEntries(); SampleDescriptionBox stsd = SampleDescriptionBox.createSampleDescriptionBox(ent1); for (int i = 0; i < ent2.length; i++) { SampleEntry se = ent2[i]; se.setDrefInd((short) (se.getDrefInd() + ent1.length)); stsd.add(se); } NodeBox.findFirstPath(trakBox1, NodeBox.class, Box.path("mdia.minf.stbl")).replace("stsd", stsd); return ent1.length; }
public String getFourcc() { return getSampleEntries()[0].getFourcc(); }
private void cleanDrefs(TrakBox trak) { MediaInfoBox minf = trak.getMdia().getMinf(); DataInfoBox dinf = trak.getMdia().getMinf().getDinf(); if (dinf == null) { dinf = new DataInfoBox(); minf.add(dinf); } DataRefBox dref = dinf.getDref(); if (dref == null) { dref = new DataRefBox(); dinf.add(dref); } dref.getBoxes().clear(); dref.add(AliasBox.createSelfRef()); for (SampleEntry entry : NodeBox.findAll(trak, SampleEntry.class, "mdia", "minf", "stbl", "stsd", null)) { entry.setDrefInd((short) 1); } }
public void setCodecPrivateIfNeeded() { if (codec == Codec.H264) { List<ByteBuffer> sps = selectUnique(spsList); List<ByteBuffer> pps = selectUnique(ppsList); if (!sps.isEmpty() && !pps.isEmpty()) { getEntries().get(0).add(H264Utils.createAvcCFromPS(sps, pps, 4)); } else { Logger.warn("CodecMP4MuxerTrack: Not adding a sample entry for h.264 track, missing any SPS/PPS NAL units"); } } else if (codec == Codec.AAC) { if (adtsHeader != null) { getEntries().get(0).add(EsdsBox.fromADTS(adtsHeader)); } else { Logger.warn("CodecMP4MuxerTrack: Not adding a sample entry for AAC track, missing any ADTS headers."); } } }
public void parse(ByteBuffer input) { super.parse(input); NIOUtils.skip(input, 4); flags = input.getInt(); timescale = input.getInt(); frameDuration = input.getInt(); numFrames = input.get(); NIOUtils.skip(input, 1); }
public String getFourcc() { return getSampleEntries()[0].getFourcc(); }
private void cleanDrefs(TrakBox trak) { MediaInfoBox minf = trak.getMdia().getMinf(); DataInfoBox dinf = trak.getMdia().getMinf().getDinf(); if (dinf == null) { dinf = new DataInfoBox(); minf.add(dinf); } DataRefBox dref = dinf.getDref(); if (dref == null) { dref = new DataRefBox(); dinf.add(dref); } dref.getBoxes().clear(); dref.add(AliasBox.createSelfRef()); for (SampleEntry entry : NodeBox.findAll(trak, SampleEntry.class, "mdia", "minf", "stbl", "stsd", null)) { entry.setDrefInd((short) 1); } }
public void setPAR(Rational par) { SampleEntry[] sampleEntries = getSampleEntries(); for (int i = 0; i < sampleEntries.length; i++) { SampleEntry sampleEntry = sampleEntries[i]; sampleEntry.removeChildren("pasp"); sampleEntry.add(PixelAspectExt.createPixelAspectExt(par)); } }
Size size = new Size(width, height); SampleEntry sampleEntry = MP4Muxer.videoSampleEntry("avc1", size, "OpenH264"); sampleEntry.add(avcCBox);
protected void doWrite(ByteBuffer out) { super.doWrite(out); out.putInt(0); out.putInt(flags); out.putInt(timescale); out.putInt(frameDuration); out.put(numFrames); out.put((byte) 207); }
public void parse(ByteBuffer input) { super.parse(input); NIOUtils.skip(input, 4); flags = input.getInt(); timescale = input.getInt(); frameDuration = input.getInt(); numFrames = input.get(); NIOUtils.skip(input, 1); }
public static AACMetadata getMetadata(SampleEntry mp4a) { if (!"mp4a".equals(mp4a.getFourcc())) throw new IllegalArgumentException("Not mp4a sample entry"); ByteBuffer b = getCodecPrivate(mp4a); if (b == null) return null; return parseAudioInfo(b); }
private SeekableByteChannel getInput(Chunk chunk) { SampleEntry se = entries[chunk.getEntry() - 1]; return inputs[se.getDrefInd() - 1]; }
private void cleanDrefs(TrakBox trak) { MediaInfoBox minf = trak.getMdia().getMinf(); DataInfoBox dinf = trak.getMdia().getMinf().getDinf(); if (dinf == null) { dinf = DataInfoBox.createDataInfoBox(); minf.add(dinf); } DataRefBox dref = dinf.getDref(); if (dref == null) { dref = DataRefBox.createDataRefBox(); dinf.add(dref); } dref.getBoxes().clear(); dref.add(AliasBox.createSelfRef()); SampleEntry[] sampleEntries = trak.getSampleEntries(); for (int i = 0; i < sampleEntries.length; i++) { SampleEntry entry = sampleEntries[i]; entry.setDrefInd((short) 1); } }
public void setPAR(Rational par) { for (SampleEntry sampleEntry : getSampleEntries()) { sampleEntry.removeChildren("pasp"); sampleEntry.add(new PixelAspectExt(par)); } }