AVFoundation + AssetWriter: Generate Movie With Images and Audio

I ended up exporting the video separately using the above code and added the audio files separately using AVComposition & AVExportSession. Here is the code -(void) addAudioToFileAtPath:(NSString *) filePath toPath:(NSString *)outFilePath { NSError * error = nil; AVMutableComposition * composition = [AVMutableComposition composition]; AVURLAsset * videoAsset = [AVURLAsset URLAssetWithURL:[NSURL fileURLWithPath:filePath] options:nil]; AVAssetTrack * videoAssetTrack = … Read more

AVMutableVideoComposition rotated video captured in portrait mode

By default, when you export video using AVAssetExportSession then video will be rotated from its original orientation. You have to apply its transform to set it exact orientation.You please try below code to do the same. – (AVMutableVideoCompositionLayerInstruction *)layerInstructionAfterFixingOrientationForAsset:(AVAsset *)inAsset forTrack:(AVMutableCompositionTrack *)inTrack atTime:(CMTime)inTime { //FIXING ORIENTATION// AVMutableVideoCompositionLayerInstruction *videolayerInstruction = [AVMutableVideoCompositionLayerInstruction videoCompositionLayerInstructionWithAssetTrack:inTrack]; AVAssetTrack *videoAssetTrack = [[inAsset … Read more