I have tried to capture audio stream as AMR-NB using the following code:
var capture = new MediaCapture();
await capture.InitializeAsync();
var recordProfile = new MediaEncodingProfile();
Windows.Media.MediaProperties.AudioEncodingProperties audioProp= new AudioEncodingProperties();
audioProp.ChannelCount = 1;
audioProp.BitsPerSample = 16;
audioProp.SampleRate = 8000;
audioProp.Bitrate = 16;
audioProp.Subtype = MediaEncodingSubtypes.AmrNb;
recordProfile.Audio = audioProp;
Windows.Media.MediaProperties.ContainerEncodingProperties containProp = new ContainerEncodingProperties();
containProp.Subtype = MediaEncodingSubtypes.Mpeg4;
recordProfile.Container = containProp;
recordProfile.Video = null;
var file = await KnownFolders.VideosLibrary.CreateFileAsync("captured.mp4",CreationCollisionOption.GenerateUniqueName);
await capture.StartRecordToStorageFileAsync(recordProfile, file);
But I got an exception : "No Transform found for encoding or decoding".
How can i capture audio stream as AMR-NB in Windows Store App?
The "No Transform found for encoding or decoding" error usually means that no codec was found. You would need to provide a codec for it to work. (for instance, if you try to do mp3 encoding in a universal app, it'll work on Win8, but give the same error on WinPhone, because Msft doesn't provide that codec on the phone)
For windows store apps, the supported audio formats can be found here, and the codecs available for us to use during a media capture seem to be limited to these. Anything else it seems we have to provide our own codec.