2013-05-31 104 views
0

不要告诉我使用AVAssetExportSession,谢谢。AVAssetWriter可以合并两个视频文件

我试过了,但失败了。

for (int i =0; i < count; i++) { 

     assetWriterInput = nil; 
     assetWriterInput = [AVAssetWriterInput assetWriterInputWithMediaType:AVMediaTypeVideo outputSettings:videoSettings]; 

     NSParameterAssert(assetWriterInput); 
     NSParameterAssert([assetWriter canAddInput:assetWriterInput]); 

     [assetWriterInput setExpectsMediaDataInRealTime:YES]; 
     [assetWriter addInput:assetWriterInput]; 
}   
[assetWriter startWriting]; 
+0

请解释您使用AVAssetExportSession进行的尝试,以及您为什么不想使用它,因为这是我会告诉您使用的。 – Marcel

+0

另外,你想要做什么?合并两个视频文件?它们是否存储在磁盘上? – Marcel

+0

AVAssetExportSession在IPHONE4中合并多个文件容易失败。我不知道为什么 – bing

回答

0

的示例应用程序,显示你如何做你所谈论的究竟是什么AVCompositionDebugVieweriOS:

https://developer.apple.com/library/ios/samplecode/AVCompositionDebugVieweriOS/Introduction/Intro.html#//apple_ref/doc/uid/DTS40013421

我敢肯定,你可以削减下来的代码只是部分你需要;但是,如果这还不是你理解水平的地方,请告诉我。

还有一件事:这个应用程序不仅包含您需要的代码,还绘制了您的输出图,显示您在两个剪辑之间建立连接的位置,以及您可能在它们之间插入的任何转换。

相关问题