user3739367
user3739367

Reputation: 4451

How can I convert mp4 video file to mp3 in objective c?

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

Answers (1)

jlw
jlw

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

Related Questions