16

Been trying to figure this out with zero success.

I can write video output no problem ... but once I try to introduce a second AVAssetWriterInput to include audio the final quicktime movie is jumpy with frames being loss left and right and audio constantly going in and out.

Thanks - wg

wgpubs
  • 8,131
  • 15
  • 62
  • 109
  • Perhaps show us the code that does not work as intended, if you can. It would give answerers a good starting point to work from. – Aidan Steele Oct 10 '10 at 02:01

4 Answers4

1

If you include source we might be able to help you more, but this is a method with which I have had success in writing many audio and video tracks to a quicktime movie – I use a single AVMutableComposition with AVMutableVideoComposition and AVAudioMix. I then write it like so:

AVAssetExportSession *session = [[[AVAssetExportSession alloc] initWithAsset:[project.composition copy] presetName:presetName] retain];
    session.outputFileType = [session.supportedFileTypes objectAtIndex:0];
    session.outputURL = [NSURL fileURLWithPath:[VeporterAppDelegate createMoviePath]];
    session.videoComposition = project.videoComposition;
    session.audioMix = project.audioMix;

    session.metadata = project.metadata;

    [session exportAsynchronouslyWithCompletionHandler:^{}];
Peter DeWeese
  • 18,141
  • 8
  • 79
  • 101
1

Are you using requestMediaDataWhenReadyOnQueue:usingBlock: to write data? If not then you should set expectsMediaDataInRealTime to YES.

Alex Chugunov
  • 728
  • 5
  • 10
0

I got the same problem. My solution:

1) Create two AVAssetWriter objects to write audio and video in two files.

2) Use AVMutableComposition and AVAssetExportSession to compose them into one file as suggested above.

Maybe it is ugly. But in my project I should have compose several video files, so composing audio and video adds low overhead.

user2616346
  • 465
  • 1
  • 5
  • 12
0

For anyone searching on how to do this, this apple developer example should be all you need. Good luck.

ruoho ruotsi
  • 1,283
  • 14
  • 13