faizanmahmood / mp4parser

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

h264 to mp4 failed #45

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
i try this on a android device.

but the output mp4 file is not correct;it have only two seconds duration.not 
equal with the count.h264 duration

H264TrackImpl h264Track = new H264TrackImpl(new FileInputStream(
                "//mnt/sdcard/count.h264"));
        Movie m = new Movie();
        m.addTrack(h264Track);
        {
            IsoFile out = new DefaultMp4Builder().build(m);
            File ofile = new File("//mnt/sdcard/output.mp4");
            if(ofile.exists())
            {
                ofile.delete();
            }
            ofile.createNewFile();
            FileOutputStream fos = new FileOutputStream(ofile);
            out.getBox(fos.getChannel());
            fos.close();
        }
        {
            FragmentedMp4Builder fragmentedMp4Builder = new FragmentedMp4Builder();
            fragmentedMp4Builder
                    .setIntersectionFinder(new SyncSampleIntersectFinderImpl());
            IsoFile out = fragmentedMp4Builder.build(m);
            File ofile2 = new File("//mnt/sdcard/output-frag.mp4");
            if(ofile2.exists())
            {
                ofile2.delete();
            }
            ofile2.createNewFile();
            FileOutputStream fos = new FileOutputStream(ofile2);
            out.getBox(fos.getChannel());
            fos.close();
        }

Original issue reported on code.google.com by gmlm...@gmail.com on 19 Sep 2012 at 12:19

GoogleCodeExporter commented 8 years ago

Are you trying to play output.mp4 or output-frag.mp4? 
output-frag.mp4 will probably not work since most player don't support 
fragmented mp4 files. 
If output.mp4 plays but only two seconds we are at least on the right track: 
* Which isoparser-RC-XX are you using isoparser-RC-15? 
* Does the file show the first two seconds of the original video or is it 
running too fast?
* Can you attach an example h264 bitstream since my example stream work. 

Best Regards,
Sebastian

Original comment by Sebastian.Annies on 19 Sep 2012 at 9:13

GoogleCodeExporter commented 8 years ago
yes, i played output.mp4,and use isoparser-RC-15; the file show the first two 
second of the original video,and it seems just the original video's first 
frame; and i also try to use  other players to run the output.mp4, in some 
player it is running too fast;

the h264 file i use just the count.h264

Original comment by gmlm...@gmail.com on 20 Sep 2012 at 3:25

GoogleCodeExporter commented 8 years ago
Sorry for late answer. count.h264 is a video from a crappy phone and has no 
constant frame rate as most h264 streams have. Whenever the H264TrackImpl 
creates a a track it assume constant frame rate (since I'm not even sure if the 
information is preserved when converting the original MP4 to h264 bitstream). 

Please try a decent video!

Original comment by Sebastian.Annies on 26 Nov 2012 at 12:30

GoogleCodeExporter commented 8 years ago
that issue is resolved,this project is very useful for me,you did a great 
job.and many thanks to u!

Original comment by gmlm...@gmail.com on 28 Nov 2012 at 2:25

GoogleCodeExporter commented 8 years ago
[deleted comment]
GoogleCodeExporter commented 8 years ago

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