lovecc0923 / mp4parser

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

AppendExample breaks sometime after r968 #83

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hi,

I have been using isoparser-1.0-RC-27 in a Android project and it was working 
great. Recently I needed access to the MP3TrackImpl and CroppedTrack 
functionality so I downloaded RC-36 and built it (without errors). I then 
noticed the Append function not working. After working backwards through the 
snapshots I found it stopped working some time during RC-29.

What steps will reproduce the problem?
1. Create a standard Eclipse project with the AppendExample.java example (see 
src below).
2. Use 3 example mp4 files included in the downloaded version.
3. Build and run the project to produce "output.mp4".

What is the expected output? What do you see instead?
Should be the 3 videos concatenated together. 
What appears to be the first few frames from the first mp4 is shown repeating 
in video plaver (VLC on windows and Android video player).
Video length shown as 0:00.

What version of the product are you using? On what operating system?
isoparser-1.0-RC-36-SNAPSHOT
isoparser-1.0-RC-35-SNAPSHOT
isoviewer-1.0-RC-35
isoviewer-1.0-RC-34
isoparser-1.0-RC-29-SNAPSHOT (post r968)
All the above tried with aspectjrt-1.7.3.jar and aspectjrt-1.7.4.jar
All on Windows 7 and Android 4.2 and 4.4

Please provide any additional information below.
isoparser-1.0-RC-27 and isoparser-1.0-RC-29-SNAPSHOT (PRE r968) work as expected

The following is the only output when running the code below:
invalid compressor name displayable data: 32
invalid compressor name displayable data: 32
invalid compressor name displayable data: 32

Source code:
import com.coremedia.iso.boxes.Container;
import com.googlecode.mp4parser.authoring.Movie;
import com.googlecode.mp4parser.authoring.Track;
import com.googlecode.mp4parser.authoring.builder.DefaultMp4Builder;
import com.googlecode.mp4parser.authoring.container.mp4.MovieCreator;
import com.googlecode.mp4parser.authoring.tracks.AppendTrack;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.nio.channels.FileChannel;
import java.util.LinkedList;
import java.util.List;

public class AppendExample {
    public static void main(String[] args) throws IOException {

        String f1 = "1365070268951.mp4";
        String f2 = "1365070285923.mp4";
        String f3 = "1365070453555.mp4";

        Movie[] inMovies = new Movie[]{
                MovieCreator.build(f1),
                MovieCreator.build(f2),
                MovieCreator.build(f3)};

        List<Track> videoTracks = new LinkedList<Track>();
        List<Track> audioTracks = new LinkedList<Track>();

        for (Movie m : inMovies) {
            for (Track t : m.getTracks()) {
                if (t.getHandler().equals("soun")) {
                    audioTracks.add(t);
                }
                if (t.getHandler().equals("vide")) {
                    videoTracks.add(t);
                }
            }
        }

        Movie result = new Movie();

        if (audioTracks.size() > 0) {
            result.addTrack(new AppendTrack(audioTracks.toArray(new Track[audioTracks.size()])));
        }
        if (videoTracks.size() > 0) {
            result.addTrack(new AppendTrack(videoTracks.toArray(new Track[videoTracks.size()])));
        }

        Container out = new DefaultMp4Builder().build(result);

        FileChannel fc = new RandomAccessFile(String.format("output.mp4"), "rw").getChannel();
        out.writeContainer(fc);
        fc.close();
    }
}

Original issue reported on code.google.com by unixc...@gmail.com on 28 Feb 2014 at 1:56

GoogleCodeExporter commented 8 years ago
This is output.mp4 using the three test videos v1.mp4, v2.mp4 and v3.mp4 
included in the download. Tested using isoviewer-1.0-RC-35.jar

Original comment by unixc...@gmail.com on 1 Mar 2014 at 10:26

Attachments:

GoogleCodeExporter commented 8 years ago
Sorry, in previous update lib used was isoparser-1.0-RC-35-SNAPSHOT.jar, not 
isoviewer.

Original comment by unixc...@gmail.com on 1 Mar 2014 at 9:49

GoogleCodeExporter commented 8 years ago
A quick and easy fix for me was the following:

1. checkout r962
2. copy MP3TrackImpl.java from
isoparser/src/test/java/com/googlecode/mp4parser/authoring/tracks/ 
to
isoparser/src/main/java/com/googlecode/mp4parser/authoring/tracks/
3. rebuild with "mvn clean install"

Now I have an isoparser that can append mp4 videos and add a cropped mp3 sound 
track ;)

Original comment by unixc...@gmail.com on 4 Mar 2014 at 12:54

GoogleCodeExporter commented 8 years ago
thanks bro, ur issue helped me :D

Original comment by Moh.Na...@gmail.com on 15 Apr 2014 at 2:14

GoogleCodeExporter commented 8 years ago
I checked out r1064 and it seems to have fixed AppendTrack, although I only 
tried with aac audio and not mp3.
Best to use the latest if it works ;)

Original comment by unixc...@gmail.com on 15 Apr 2014 at 2:18

GoogleCodeExporter commented 8 years ago

Original comment by Sebastian.Annies on 19 Jun 2014 at 3:40