0

Do not tell me to use AVAssetExportSession, thank you.

I tried this, but failed.

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];
Agent Chocks.
  • 1,312
  • 8
  • 19
bing
  • 1
  • 1
  • Please explain what you have tried with AVAssetExportSession and why you don't want to use it, because that's I would tell you to use. – Marcel May 31 '13 at 05:20
  • Also, what is it exactly you want to do? Merge two video files? Are they stored on disk? – Marcel May 31 '13 at 05:28
  • AVAssetExportSession to merge multiple files in IPHONE4 prone to failure. I do not know why – bing May 31 '13 at 05:31
  • Can you explain what you have tried and what kind of failures you were getting. – Marcel May 31 '13 at 06:32
  • Thank you for your reply, the problem seems solved, I add too much AVMutableCompositionTrack, led AVAssetExportSession there is a problem, I have only one AVMutableCompositionTrack, it worked. But there is a problem, I can not in IOS5.1.1 output AVFileTypeMPEG4 types of problems, which is why? – bing May 31 '13 at 06:38

1 Answers1

1

The sample app that shows you how to do exactly what you're talking about is AVCompositionDebugVieweriOS:

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

I'm sure you can pare down the code to just the parts you need; but, if that's not yet where you're at with your level of understanding, let me know.

One more thing: this app not only contains the code you need, but also draws a graph of your output, showing you where you made the connection between the two clips, and any transition you may have inserted between them.

James Bush
  • 1,485
  • 14
  • 19