示例#1
0
  public static void main(String[] args) throws IOException {
    //        AACTrackImpl aacTrack = new
    // AACTrackImpl(Ac3Example.class.getResourceAsStream("/sample.aac"));
    AACTrackImpl aacTrack =
        new AACTrackImpl(
            new FileDataSourceImpl(
                "/Users/magnus/Projects/castlabs/cff/Solekai015_1920_29_75x75_v2/Solekai_BeautifulTension_15sec_160k.aac"));
    Movie m = new Movie();
    m.addTrack(aacTrack);
    DefaultMp4Builder mp4Builder = new DefaultMp4Builder();
    Container out = mp4Builder.build(m);
    FileOutputStream fos = new FileOutputStream("output.mp4");
    FileChannel fc = fos.getChannel();
    out.writeContainer(fc);

    fos.close();
  }
示例#2
0
  @Test
  public void freeze() throws IOException {
    Track t =
        new AC3TrackImpl(
            new BufferedInputStream(
                AC3TrackImpl.class.getResourceAsStream(
                    "/com/googlecode/mp4parser/authoring/tracks/ac3-sample.ac3")));
    Movie m = new Movie();
    m.addTrack(t);

    DefaultMp4Builder mp4Builder = new DefaultMp4Builder();
    IsoFile isoFile = mp4Builder.build(m);
    IsoFile isoFileReference =
        new IsoFile(
            Channels.newChannel(
                AACTrackImplTest.class.getResourceAsStream(
                    "/com/googlecode/mp4parser/authoring/tracks/ac3-sample.mp4")));
    BoxComparator.check(
        isoFile,
        isoFileReference,
        Arrays.asList(
            "/moov[0]/mvhd[0]", "/moov[0]/trak[0]/tkhd[0]", "/moov[0]/trak[0]/mdia[0]/mdhd[0]"));
  }