1
我正在使用AVAssetWriterInput從用戶獲取mp3文件併發送電子郵件(僅限DRM自由)。當使用PCM時,我得到了這個過程,但是當我嘗試mp3,或者m4a或caf時,我得到的文件不起作用,或者我得到空的數據。我認爲這是由於我的輸出設置。下面不使用數據的輸出設置如下。我願意改變這一切。謝謝!AVAssetWriterInput輸出設置不呈現有效NSData
NSDictionary *outputSettings = [NSDictionary dictionaryWithObjectsAndKeys:
[ NSNumber numberWithInt: kAudioFormatMPEG4AAC], AVFormatIDKey,
[ NSNumber numberWithInt: 1 ], AVNumberOfChannelsKey,
[ NSNumber numberWithFloat: 44100.0 ], AVSampleRateKey,
[ NSData dataWithBytes: &channelLayout length: sizeof(AudioChannelLayout) ], AVChannelLayoutKey,
[ NSNumber numberWithInt: 64000 ], AVEncoderBitRateKey,
nil];
非常感謝!我使用AVAssetExportSession工作,但它非常慢。後臺線程需要永久啓動。這是常見的嗎? – nicholjs