2012-05-07 77 views
0

我工作的一個iPhone項目,並要保存,而不是車載mp3文件,我寫了這個代碼保存在擴展的.caf錄像文件:如何將(aiff)文件轉換爲在Windows OS上運行的任何格式(.asf,.asx,.avi,.wav,.wax,.wma,.wm,.wmv)?

NSMutableDictionary* recordSetting = [[NSMutableDictionary alloc] init]; 
    [recordSetting setValue :[NSNumber numberWithInt:kAudioFormatAppleIMA4] forKey:AVFormatIDKey]; 
    [recordSetting setValue:[NSNumber numberWithFloat:44100.0] forKey:AVSampleRateKey]; 
    [recordSetting setValue:[NSNumber numberWithInt: 2] forKey:AVNumberOfChannelsKey]; 
    NSString *recorderFilePath =[NSString stringWithFormat:@"%@/%@.caf", DOCUMENTS_FOLDER,fileName]; 

我想這:

[recordSetting setValue :[NSNumber numberWithInt:kAudioFormatMPEGLayer3] forKey:AVFormatIDKey]; 
NSString *recorderFilePath =[NSString stringWithFormat:@"%@/%@.mp3", DOCUMENTS_FOLDER,fileName]; 

但它沒有保存在MP3格式!它是在目標C可用或有任何第三方的代碼,使的是,我看到的是方法AudioToolbox.framework:

OSStatus AudioConverterConvertBuffer (
AudioConverterRef inAudioConverter, 
UInt32    inInputDataSize, 

const void   *inInputData, 

UInt32    *ioOutputDataSize, 

void    *outOutputData 

); 

任何幫助表示歡迎,感謝。

+1

[在iPhone上將.caf轉換爲.mp3]的可能重複(http://stackoverflow.com/questions/859151/convert-caf-to-mp3-on-the-iphone) –

回答

0

有一個開源項目lame。挑戰將會使它適用於iphone。 This會給ios的交叉編譯帶來方向。

另請注意,它是GPL。

相關問題