FileDocCategorySizeDatePackage
DumpAmf0TrackToPropertyFile.javaAPI Docmp4parser 1.0-RC-172033Wed Dec 19 20:10:38 GMT 2012com.googlecode.mp4parser.stuff

DumpAmf0TrackToPropertyFile

public class DumpAmf0TrackToPropertyFile extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidmain(java.lang.String[] args)

        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, "");

            }
        }