2
我使用AVAssetWriter與這些設置在應用程序中的臨時文件夾輸出wav文件:如何使用AVAssetWriter在ios中寫入正確的WAV音頻?
NSDictionary* outputSettings = [NSDictionary dictionaryWithObjectsAndKeys:
[ NSNumber numberWithInt: kAudioFormatMPEG4AAC], AVFormatIDKey,
[ NSNumber numberWithInt: 2 ], AVNumberOfChannelsKey,
[ NSNumber numberWithFloat: 44100.0 ], AVSampleRateKey,
[ NSData data ], AVChannelLayoutKey,
[ NSNumber numberWithInt: 64000 ], AVEncoderBitRateKey,
nil];
它的輸出看似正常的45MB的.wav文件,但應用程序無法反正讀它。我懷疑文件頭是損壞的,因爲我打開了.avav的audacity(它接受了它沒有問題),並再次用.wav擴展名重新導出它。導出的文件在應用程序中正常工作。
我還用文本編輯器打開了這兩個.wav文件來查看標題,它們有些不同。
任何線索?