将mp4文件与mp4parser

时间:2015-09-02 17:43:00

标签: java mp4parser

我需要合并2个视频,两个都是mp4,所有其他参数都是相同的。问题是当我有一个大文件我无法合并它我得到一个空指针异常。 这部分是我认为我错了但无法弄清楚问题。

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

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

    //Output the resulting movie to a new mp4 file
    String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss").format(new Date());
    String outputLocation = mediaStorageDir.getPath();
    Container out = new DefaultMp4Builder().build(result);

错误:

  

线程中的异常" AWT-EventQueue-0"显示java.lang.NullPointerException       在com.googlecode.mp4parser.boxes.mp4.ESDescriptorBox.getContentSize(ESDescriptorBox.java:60)       在com.googlecode.mp4parser.AbstractBox.getSize(AbstractBox.java:203)       在com.googlecode.mp4parser.BasicContainer.getContainerSize(BasicContainer.java:70)       在com.coremedia.iso.boxes.sampleentry.AudioSampleEntry.getSize(AudioSampleEntry.java:330)       在com.googlecode.mp4parser.BasicContainer.getContainerSize(BasicContainer.java:70)       在com.coremedia.iso.boxes.SampleDescriptionBox.getSize(SampleDescriptionBox.java:112)       在com.googlecode.mp4parser.AbstractContainerBox.getHeader(AbstractContainerBox.java:67)       在com.coremedia.iso.boxes.SampleDescriptionBox.getBox(SampleDescriptionBox.java:94)       在com.googlecode.mp4parser.authoring.tracks.AppendTrack.mergeStsds(AppendTrack.java:81)       在com.googlecode.mp4parser.authoring.tracks.AppendTrack。(AppendTrack.java:65)       在Mp4.merging.merge(merging.java:90)       at gui.maingui.projectionRecStopBActionPerformed(maingui.java:1281)       在gui.maingui.access $ 2000(maingui.java:60)       在gui.maingui $ 18.actionPerformed(maingui.java:941)       在javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)       在javax.swing.AbstractButton $ Handler.actionPerformed(AbstractButton.java:2348)       在javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)       在javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)       在javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)       at java.awt.Component.processMouseEvent(Component.java:6535)       在javax.swing.JComponent.processMouseEvent(JComponent.java:3324)       at java.awt.Component.processEvent(Component.java:6300)       at java.awt.Container.processEvent(Container.java:2236)       at java.awt.Component.dispatchEventImpl(Component.java:4891)       at java.awt.Container.dispatchEventImpl(Container.java:2294)       at java.awt.Component.dispatchEvent(Component.java:4713)       at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4888)       at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4525)       at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4466)       at java.awt.Container.dispatchEventImpl(Container.java:2280)       at java.awt.Window.dispatchEventImpl(Window.java:2750)       at java.awt.Component.dispatchEvent(Component.java:4713)       at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)       at java.awt.EventQueue.access $ 500(EventQueue.java:97)       at java.awt.EventQueue $ 3.run(EventQueue.java:709)       at java.awt.EventQueue $ 3.run(EventQueue.java:703)       at java.security.AccessController.doPrivileged(Native Method)       at java.security.ProtectionDomain $ JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)       at java.security.ProtectionDomain $ JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)       at java.awt.EventQueue $ 4.run(EventQueue.java:731)       at java.awt.EventQueue $ 4.run(EventQueue.java:729)       at java.security.AccessController.doPrivileged(Native Method)       at java.security.ProtectionDomain $ JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:76)       at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)       at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)       at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)       at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)       at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)       在java.awt.EventDispatchThread.run(EventDispatchThread.java:82)

有人可以帮助我!

0 个答案:

没有答案