public VideoStreamDescriptor() { this.frameRates = new Rational[] { null, new Rational(24000, 1001), new Rational(24, 1), new Rational(25, 1), new Rational(30000, 1001), new Rational(30, 1), new Rational(50, 1), new Rational(60000, 1001), new Rational(60, 1), null, null, null, null, null, null, null}; }
public FramesMP4MuxerTrack(SeekableByteChannel out, int trackId, TrackType type, int timescale) { super(trackId, type, timescale); this.out = out; setTgtChunkDuration(new Rational(1, 1), Unit.FRAME); }
public static Rational parse(String string) { String[] split = split(string, ":"); return new Rational(Integer.parseInt(split[0]), Integer.parseInt(split[1])); }
public static Rational parse(String string) { int idx = string.indexOf(":"); if (idx < 0) { idx = string.indexOf("/"); } if (idx > 0) { String num = string.substring(0, idx); String den = string.substring(idx + 1); return new Rational(parseInt(num), parseInt(den)); } return R(parseInt(string), 1); }
public FramesMP4MuxerTrack(SeekableByteChannel out, int trackId, TrackType type, int timescale) { super(trackId, type, timescale); this.out = out; setTgtChunkDuration(new Rational(1, 1), Unit.FRAME); }
private Rational getFrameRate(double fps) { if (fps < 0) { throw new WPSException("Frames per second must be greater than zero"); } BigDecimal bigDecimal = BigDecimal.valueOf(fps); int numerator = (int) bigDecimal.unscaledValue().longValue(); int denominator = (int) Math.pow(10L, bigDecimal.scale()); return new Rational(numerator, denominator); } }
public static Rational parse(String string) { String[] split = split(string, ":"); return new Rational(Integer.parseInt(split[0]), Integer.parseInt(split[1])); }
public Rational getPAR() { PixelAspectExt pasp = NodeBox.findFirst(this, PixelAspectExt.class, "mdia", "minf", "stbl", "stsd", null, "pasp"); return pasp == null ? new Rational(1, 1) : pasp.getRational(); }
public PCMMP4MuxerTrack(SeekableByteChannel out, int trackId, TrackType type, int timescale, int frameDuration, int frameSize, SampleEntry se) { super(trackId, type, timescale); this.out = out; this.frameDuration = frameDuration; this.frameSize = frameSize; addSampleEntry(se); setTgtChunkDuration(new Rational(1, 2), Unit.SEC); }
public Rational getPAR() { PixelAspectExt pasp = NodeBox.findFirst(this, PixelAspectExt.class, "mdia", "minf", "stbl", "stsd", null, "pasp"); return pasp == null ? new Rational(1, 1) : pasp.getRational(); }
public PCMMP4MuxerTrack(SeekableByteChannel out, int trackId, TrackType type, int timescale, int frameDuration, int frameSize, SampleEntry se) { super(trackId, type, timescale); this.out = out; this.frameDuration = frameDuration; this.frameSize = frameSize; addSampleEntry(se); setTgtChunkDuration(new Rational(1, 2), Unit.SEC); }
public MP4MuxerTrack(int trackId, MP4TrackType type) { super(trackId, type); this.sampleDurations = new ArrayList<TimeToSampleEntry>(); this.chunkOffsets = LongArrayList.createLongArrayList(); this.sampleSizes = IntArrayList.createIntArrayList(); this.iframes = IntArrayList.createIntArrayList(); this.compositionOffsets = new ArrayList<LongEntry>(); setTgtChunkDuration(new Rational(1, 1), Unit.FRAME); }
protected Box finish(MovieHeaderBox mvhd) throws IOException { processGop(); outTimecodeSample(); if (sampleEntries.size() == 0) return null; if (edits != null) { edits = Util.editsOnEdits(new Rational(1, 1), lower, edits); } else edits = lower; return super.finish(mvhd); }
protected Box finish(MovieHeaderBox mvhd) throws IOException { processGop(); outTimecodeSample(); if (sampleEntries.size() == 0) return null; if (edits != null) { edits = Util.editsOnEdits(new Rational(1, 1), lower, edits); } else edits = lower; return super.finish(mvhd); }
@Override protected Box finish(MovieHeaderBox mvhd) throws IOException { processGop(); outTimecodeSample(); if (sampleEntries.size() == 0) return null; if (edits != null) { edits = Util.editsOnEdits(new Rational(1, 1), lower, edits); } else edits = lower; return super.finish(mvhd); }
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); }
/** * Splits track on the timevalue specified * * @param movie * @param track * @param tvMv * @return */ public static Pair<List<Edit>> split(MovieBox movie, TrakBox track, long tvMv) { return splitEdits(track.getEdits(), new Rational(track.getTimescale(), movie.getTimescale()), tvMv); }
public Size getDisplayDimensions() { int width = 0, height = 0; if (sampleEntries.get(0) instanceof VideoSampleEntry) { VideoSampleEntry vse = (VideoSampleEntry) sampleEntries.get(0); PixelAspectExt paspBox = Box.findFirst(vse, PixelAspectExt.class, PixelAspectExt.fourcc()); Rational pasp = paspBox != null ? paspBox.getRational() : new Rational(1, 1); width = (int) (pasp.getNum() * vse.getWidth()) / pasp.getDen(); height = (int) vse.getHeight(); } return new Size(width, height); }
public Size getDisplayDimensions() { int width = 0, height = 0; if (sampleEntries.get(0) instanceof VideoSampleEntry) { VideoSampleEntry vse = (VideoSampleEntry) sampleEntries.get(0); PixelAspectExt paspBox = Box.findFirst(vse, PixelAspectExt.class, PixelAspectExt.fourcc()); Rational pasp = paspBox != null ? paspBox.getRational() : new Rational(1, 1); width = (int) (pasp.getNum() * vse.getWidth()) / pasp.getDen(); height = (int) vse.getHeight(); } return new Size(width, height); }
public PCMMP4MuxerTrack(int trackId, AudioFormat format) { super(trackId, MP4TrackType.SOUND); this.chunkOffsets = LongArrayList.createLongArrayList(); this.frameDuration = 1; this.frameSize = (format.getSampleSizeInBits() >> 3) * format.getChannels(); addSampleEntry(AudioSampleEntry.audioSampleEntryPCM(format)); this._timescale = format.getSampleRate(); setTgtChunkDuration(new Rational(1, 2), Unit.SEC); }