2015-04-08 29 views
0

我試圖控制記錄AVRecorder一個.m4a的文件的比特深度:AVRecorder不能設置位深度

NSDictionary *settings = [NSDictionary dictionaryWithObjectsAndKeys: 
          [NSNumber numberWithFloat: 44100.0],     AVSampleRateKey, 
          [NSNumber numberWithInt: kAudioFormatAppleLossless], AVFormatIDKey, 
          [NSNumber numberWithInt: 1],       AVNumberOfChannelsKey, 
          [NSNumber numberWithInt: 8],   AVEncoderBitDepthHintKey, 
          nil]; 

AVEncoderBitDepthHintKey沒有效果,同爲AVEncoderAudioQualityKey

看來,iOS7和8有不同的默認值:iOS7總是給出一個s16p格式(根據ffmpeg)和iOS8一個s32p。

我不想使用除AppleLossless以外的任何其他格式。

回答

1

我不認爲AVEncoderAudioQualityKey適用於kAudioFormatAppleLosslessAVEncoderBitDepthHintKey只是一個提示。

也許你會有更多的運氣通過較低級別的CoreAudio AudioConverter API在ALAC中獲得8位音頻。

+0

謝謝你的回答,你能解釋一下在這種情況下,「提示」究竟是做什麼的嗎? – kursus

+0

這是編碼器可以使用或完全忽略的情況,就像你的情況一樣 –