Movie movie = MovieCreator.build(Channels.newChannel(DumpAmf0TrackToPropertyFile.class.getResourceAsStream("/example.f4v")));
for (Track track : movie.getTracks()) {
if (track.getHandler().equals("data") && (track.getMediaHeaderBox() instanceof NullMediaHeaderBox)) {
long time = 0;
Iterator<ByteBuffer> samples = track.getSamples().iterator();
Properties properties = new Properties();
File f = File.createTempFile(DumpAmf0TrackToPropertyFile.class.getSimpleName(), "" + track.getTrackMetaData().getTrackId());
for (TimeToSampleBox.Entry entry : track.getDecodingTimeEntries()) {
for (int i = 0; i < entry.getCount(); i++) {
ByteBuffer sample = samples.next();
byte[] sampleBytes = new byte[sample.limit()];
sample.reset();
sample.get(sampleBytes);
properties.put("" + time, new String(Base64.encodeBase64(sampleBytes, false, false)));
time += entry.getDelta();
}
}
FileOutputStream fos = new FileOutputStream(f);
System.err.println(properties);
properties.store(fos, "");
}
}