I made a Multipeer Audio Streaming app using the Tony's tutorial. But I can only play .mp3 with 128kbps bit rate. So I need to lower .mp3 with 192kbps or more bit rate to 128kbps. I found a similar solution[here], but it's for encoding mp3 to video.
Please help me how to lower the bitrate.
AVAssetReaderTrackOutput *assetOutput = [AVAssetReaderTrackOutput assetReaderTrackOutputWithTrack:asset.tracks[0] outputSettings:nil];
You should provide outputSettings:
on a server side (phone that streams audio)
So it should look like this.
NSDictionary *settings = @{
AVEncoderBitRateKey : @128000,
AVFormatIDKey : @(kAudioFormatAppleIMA4),
AVNumberOfChannelsKey : @2,
AVLinearPCMBitDepthKey : @16,
AVLinearPCMIsBigEndianKey : @NO,
AVLinearPCMIsFloatKey : @NO
};
AVAssetReaderTrackOutput *assetOutput = [AVAssetReaderTrackOutput assetReaderTrackOutputWithTrack:asset.tracks[0] outputSettings:settings];