In my iOS application I’m trying to export an mp3 file from the iPod library to the app’s documents directory on the device. Currently I’m trying to use AVAssetExportSession but it’s not working for mp3 files. It works well for m4a files.
-
Is exporting an mp3 file possible using AVAssetExportSession?
-
What is the appropriate outputFileType for AVAssetExportSession? (AVFileTypeAppleM4A works for m4a files)
Thanks!
I am facing the same problem. Unfortunately, non of the iOS frameworks (AVFoundation, CoreMedia, etc) support encoding to MP3.
An answer to a similar question suggest using the Lame Encoder, and another question mentions that some user was able to compile is successfully for iOS (“I have just attempted to build the static library for LAME and confirmed that it ‘works’…”).
Another alternative would be to go with FFMpeg. It seems like some users have successfully compiled it for iOS 4.3 (see this reference).
Take into account that you may have to pay royalties for encoding MP3. Also, the licenses for FFMpeg/Lame may prevent you from using their code in a closed-source application.
Good luck!