I can successfully combine two m4a files one after the other using AVMutableComposition and AVExportSession
Code:
AVMutableComposition* composition = [AVMutableComposition composition];
AVURLAsset* audioAsset1 = [[AVURLAsset alloc]initWithURL:[NSURL fileURLWithPath:audioFile1Path] options:nil];
AVURLAsset* audioAsset2 = [[AVURLAsset alloc]initWithURL:[NSURL fileURLWithPath:audioFile2Path] options:nil];
AVMutableCompositionTrack *audioTrack1 = [composition addMutableTrackWithMediaType:AVMediaTypeAudio
preferredTrackID:kCMPersistentTrackID_Invalid];
[audioTrack1 insertTimeRange:CMTimeRangeMake(kCMTimeZero, audioAsset1.duration)
ofTrack:[[audioAsset1 tracksWithMediaType:AVMediaTypeAudio] objectAtIndex:0]
atTime:kCMTimeZero
error:nil];
[audioTrack1 insertTimeRange:CMTimeRangeMake(kCMTimeZero, audioAsset2.duration)
ofTrack:[[audioAsset2 tracksWithMediaType:AVMediaTypeAudio] objectAtIndex:0]
atTime:audioAsset1.duration
error:nil];
AVAssetExportSession * ex = [[AVAssetExportSession alloc] initWithAsset:[audioTrack1 asset] presetName:AVAssetExportPresetAppleM4A];
When I export, the resulting file is like 10x bigger than the size of the sum of the other two files. How would I combine the files but not have the file size be so big?