protected Box createMvhd() { MovieHeaderBox mvhd = new MovieHeaderBox(); mvhd.setVersion(1); mvhd.setCreationTime(creationTime); mvhd.setModificationTime(creationTime); long[] timescales = new long[0]; long maxTrackId = 0; double duration = 0; for (StreamingTrack streamingTrack : source) { duration = Math.max((double) nextSampleStartTime.get(streamingTrack) / streamingTrack.getTimescale(), duration); timescales = Mp4Arrays.copyOfAndAppend(timescales, streamingTrack.getTimescale()); maxTrackId = Math.max(streamingTrack.getTrackExtension(TrackIdTrackExtension.class).getTrackId(), maxTrackId); } mvhd.setTimescale(Mp4Math.lcm(timescales)); mvhd.setDuration((long) (Mp4Math.lcm(timescales) * duration)); // find the next available trackId mvhd.setNextTrackId(maxTrackId + 1); return mvhd; }
protected Box createMvhd() { MovieHeaderBox mvhd = new MovieHeaderBox(); mvhd.setVersion(1); mvhd.setCreationTime(creationTime); mvhd.setModificationTime(creationTime); mvhd.setDuration(0);//no duration in moov for fragmented movies long[] timescales = new long[0]; long maxTrackId = 0; for (StreamingTrack streamingTrack : source) { timescales = Mp4Arrays.copyOfAndAppend(timescales, streamingTrack.getTimescale()); maxTrackId = Math.max(streamingTrack.getTrackExtension(TrackIdTrackExtension.class).getTrackId(), maxTrackId); } mvhd.setTimescale(Mp4Math.lcm(timescales)); // find the next available trackId mvhd.setNextTrackId(maxTrackId + 1); return mvhd; }
/** * Creates a single 'mvhd' movie header box for a given movie. * * @param movie the concerned movie * @return an 'mvhd' box */ protected ParsableBox createMvhd(Movie movie) { MovieHeaderBox mvhd = new MovieHeaderBox(); mvhd.setVersion(1); mvhd.setCreationTime(getDate()); mvhd.setModificationTime(getDate()); mvhd.setDuration(0);//no duration in moov for fragmented movies long movieTimeScale = movie.getTimescale(); mvhd.setTimescale(movieTimeScale); // find the next available trackId long nextTrackId = 0; for (Track track : movie.getTracks()) { nextTrackId = nextTrackId < track.getTrackMetaData().getTrackId() ? track.getTrackMetaData().getTrackId() : nextTrackId; } mvhd.setNextTrackId(++nextTrackId); return mvhd; }
protected MovieBox createMovieBox(Movie movie, Map<Track, int[]> chunks) { MovieBox movieBox = new MovieBox(); MovieHeaderBox mvhd = new MovieHeaderBox();
protected Box createMvhd() { MovieHeaderBox mvhd = new MovieHeaderBox(); mvhd.setVersion(1); mvhd.setCreationTime(getDate()); mvhd.setModificationTime(getDate()); mvhd.setDuration(0);//no duration in moov for fragmented movies long movieTimeScale = theTrack.getTrackMetaData().getTimescale(); mvhd.setTimescale(movieTimeScale); mvhd.setNextTrackId(theTrack.getTrackMetaData().getTrackId() + 1); return mvhd; }
/** * Creates a single 'mvhd' movie header box for a given movie. * * @param movie the concerned movie * @return an 'mvhd' box */ protected ParsableBox createMvhd(Movie movie) { MovieHeaderBox mvhd = new MovieHeaderBox(); mvhd.setVersion(1); mvhd.setCreationTime(getDate()); mvhd.setModificationTime(getDate()); mvhd.setDuration(0);//no duration in moov for fragmented movies long movieTimeScale = movie.getTimescale(); mvhd.setTimescale(movieTimeScale); // find the next available trackId long nextTrackId = 0; for (Track track : movie.getTracks()) { nextTrackId = nextTrackId < track.getTrackMetaData().getTrackId() ? track.getTrackMetaData().getTrackId() : nextTrackId; } mvhd.setNextTrackId(++nextTrackId); return mvhd; }
protected MovieBox createMovieBox(Movie movie, Map<Track, int[]> chunks) { MovieBox movieBox = new MovieBox(); MovieHeaderBox mvhd = new MovieHeaderBox();