mittal9878 / mp4parser

Automatically exported from code.google.com/p/mp4parser
0 stars 0 forks source link

Append one video to another #49

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
            FileInputStream is1 = new FileInputStream(storagePath + "V1.mp4");
            FileChannel source1 = is1.getChannel();

            FileInputStream is2 = new FileInputStream(storagePath + "V2.mp4");
            FileChannel source2 = is2.getChannel();

            video = MovieCreator.build(source1);
            audio = MovieCreator.build(source2);

            List<Track> videoTracks = video.getTracks();
            video.setTracks(new LinkedList<Track>());

            List<Track> audioTracks = audio.getTracks();

            for (Track videoTrack : videoTracks) {
                video.addTrack(new AppendTrack(videoTrack, videoTrack));
            }
            for (Track audioTrack : audioTracks) {
                video.addTrack(new AppendTrack(audioTrack, audioTrack));
            }

            IsoFile out = new DefaultMp4Builder().build(video);
            FileOutputStream fos = new FileOutputStream(new File(storagePath,
                    String.format("output.mp4")));
            out.getBox(fos.getChannel());
            fos.close();

            is1.close();
            is2.close();
            source1.close();
            source2.close();

What is the expected output? What do you see instead?
I found output.mp4 appended but, two times V1.mp4. I want concatenation of 
V1.mp4 and V2.mp4. How can I add tracks appneded.

I am using ICS 4.0.3

Original issue reported on code.google.com by bhavesh4...@gmail.com on 26 Dec 2012 at 6:36

GoogleCodeExporter commented 8 years ago

Original comment by Sebastian.Annies on 26 Dec 2012 at 9:37