cocoaavfoundationcore-audioavassetwriter

AVAssetWriter – Writing an AIFF – Always Rejects the input


Anyone made an AVAssetWriter that successfully writes an AIFF file ? It keeps rejecting the AVAssetWriterInput I am trying to add with these settings:

writerInput audio settings: {
    AVChannelLayoutKey = {empty AudioChannelLayout with kAudioChannelLayoutTag_Stereo};
    AVFormatIDKey = kAudioFormatLinearPCM;
    AVLinearPCMBitDepthKey = 32;
    AVLinearPCMIsBigEndianKey = 0;
    AVLinearPCMIsFloatKey = 0;
    AVLinearPCMIsNonInterleaved = 0;
    AVNumberOfChannelsKey = 2;
    AVSampleRateKey = 48000;
}

For whatever reason I can use the same settings with a AVFileTypeWAVE file instead of AVFileTypeAIFF and it'll work fine.


Solution

  • AIFF is usually big-endian. Try setting AVLinearPCMIsBigEndianKey to 1.