Open avanibhatnagar opened 6 years ago
My vidPath had audio and video, So I did this:
Movie originalAudioAndVideo = MovieCreator.build(vidPath);
Track nuAudio = new AACTrackImpl(new FileDataSourceImpl(audioPath));
ArrayList nuTracks = new ArrayList();
for(Track track: originalAudioAndVideo.getTracks()) {
if (track.getHandler().equals("vide")) {
nuTracks.add(track);
}
}
nuTracks.add(nuAudio);
Movie movie = new Movie();
movie.setTracks(nuTracks);
FragmentedMp4Builder mp4builder = new FragmentedMp4Builder();
Container c = mp4builder.build(movie);
FileChannel fc = new FileOutputStream(new File("C:\\Users\\Avani Bhatnagar\\Documents\\ffmpeg trial\\ffmpeg java class\\images input\\output.mp4")).getChannel();
c.writeContainer(fc);
fc.close();
}
I get this error: (at this line Movie originalAudioAndVideo = MovieCreator.build(vidPath);)
Exception in thread "main" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:67)
Caused by: java.lang.NoSuchMethodError: java.nio.ByteBuffer.rewind()Ljava/nio/ByteBuffer;
at org.mp4parser.AbstractBoxParser.parseBox(AbstractBoxParser.java:56)
at org.mp4parser.BasicContainer.initContainer(BasicContainer.java:107)
at org.mp4parser.IsoFile.
I tried to follow the MuxMe.java, my video is h264 codec and audio is aac, but this still doesn't work:
This is the error caused at this line: H264TrackImpl h264Track = new H264TrackImpl(new FileDataSourceImpl(vid));
13:28:48.710 [main] DEBUG org.mp4parser.muxer.FileDataSourceImpl - 0 269739 13:28:48.726 [main] WARN org.mp4parser.muxer.tracks.h264.H264TrackImpl - Unknown NAL unit type: 19 13:28:48.741 [main] WARN org.mp4parser.muxer.tracks.h264.H264TrackImpl - Unknown NAL unit type: 22 13:28:48.788 [main] WARN org.mp4parser.muxer.tracks.h264.H264TrackImpl - Unknown NAL unit type: 22 13:28:48.788 [main] WARN org.mp4parser.muxer.tracks.h264.H264TrackImpl - Unknown NAL unit type: 22 13:28:48.806 [main] WARN org.mp4parser.muxer.tracks.h264.H264TrackImpl - Unknown NAL unit type: 22 Exception in thread "main" java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:497) at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:67) Caused by: java.lang.IndexOutOfBoundsException at java.nio.Buffer.checkIndex(Buffer.java:540) at java.nio.DirectByteBuffer.get(DirectByteBuffer.java:253) at org.mp4parser.muxer.tracks.h264.H264TrackImpl.getNalUnitHeader(H264TrackImpl.java:115) at org.mp4parser.muxer.tracks.h264.H264TrackImpl.readSamples(H264TrackImpl.java:305) at org.mp4parser.muxer.tracks.h264.H264TrackImpl.parse(H264TrackImpl.java:128) at org.mp4parser.muxer.tracks.h264.H264TrackImpl.(H264TrackImpl.java:97)
at org.mp4parser.muxer.tracks.h264.H264TrackImpl.(H264TrackImpl.java:102)
at org.mp4parser.muxer.tracks.h264.H264TrackImpl.(H264TrackImpl.java:106)
Am I doing something wrong?