Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I export an mp3 file from an iOS device's iPod library?

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!

like image 769
SundayMonday Avatar asked Aug 05 '11 00:08

SundayMonday


People also ask

How to copy songs from iPod touch to computer?

Click File Sharing, select an app in the list, then do one of the following: Transfer a file from your iPod touch to your computer: Select the file you want to transfer in the list on the right, click “Save to,” select where you want to save the file, then click Save To.

How to copy iPod library into iTunes?

To add some or all of the music from your iPod to your iTunes library, go to either File > Add File to Library or File > Add Folder to Library in iTunes for Windows. If you're using a Mac, go to File > Add to Library. Then select the files or folder you want to add.


1 Answers

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!

like image 82
urish Avatar answered Nov 15 '22 04:11

urish