Reputation: 4451
I 'm recording a video with AVFoundation framework and save this. I want get the audio file of this video because in avfoundation I record all in the same file, but I don't know how to do this and I don't find never ask about this.
I have find a source code that merge video and audio, but not explain hoe to extract this.
how can I do this? I could change mp4 to mov if this is impossible to convert or more easy..
Thanks!
Upvotes: 2
Views: 1647
Reputation: 3216
You have two options using the AVFoundation
framework.
Use AVAssetReader
+ AVAssetWriter
. Read the audio track sample buffer by sample buffer from the video file and write it out to a new file.
Use AVComposition
+ AVAssetExportSession
. Insert the whole audio track (AVAssetTrack
) from the video file into an AVMutableCompositionTrack
, and export the track to a new file.
Upvotes: 1