FileDocCategorySizeDatePackage
MuxVideoWithAmf0.javaAPI Docmp4parser 1.0-RC-171909Wed Dec 19 20:10:38 GMT 2012com.googlecode.mp4parser

MuxVideoWithAmf0

public class MuxVideoWithAmf0 extends Object
Shows a simple use of the AMF0Track

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

        String videoFile = MuxVideoWithAmf0.class.getProtectionDomain().getCodeSource().getLocation().getFile() + "/example-sans-amf0.mp4";

        Movie video = MovieCreator.build(new FileInputStream(videoFile).getChannel());

        Properties props = new Properties();
        props.load(MuxVideoWithAmf0.class.getResourceAsStream("/amf0track.properties"));
        HashMap<Long, byte[]> samples = new HashMap<Long, byte[]>();
        for (String key : props.stringPropertyNames()) {
            samples.put(Long.parseLong(key), Base64.decodeBase64(props.getProperty(key)));
        }
        Track amf0Track = new Amf0Track(samples);
        amf0Track.getTrackMetaData();
        video.addTrack(amf0Track);

        FragmentedMp4Builder fragmentedMp4Builder = new FragmentedMp4Builder();
        fragmentedMp4Builder.setIntersectionFinder(new TwoSecondIntersectionFinder());

        IsoFile out = fragmentedMp4Builder.build(video);
        FileOutputStream fos = new FileOutputStream(new File(String.format("output.mp4")));

        out.getBox(fos.getChannel());
        fos.close();