NAudio does not support VBR(Got a frame at sample rate 16000, in an MP3 with sample rate 44100. Mp3FileReader does not support sample rate changes)
See original GitHub issueMy requirement is “change the channel as 1, bitrate as 32kbps and splite the time span the mp3 file as 2 minuts”.
public static Stream ProcessAudioStream(Stream inputStream)
{
Stream fs = new MemoryStream();
Stream outputStream = new MemoryStream();
try
{
Stream tempStream = new MemoryStream();
using (var waveStream = new Mp3FileReader(inputStream))
using (WaveFileWriter waveFileWriter = new WaveFileWriter(tempStream, new Mp3WaveFormat(44100,1,8,32000)))
{
byte[] bytes = new byte[waveStream.Length];
waveStream.Read(bytes, 0, (int)waveStream.Length);
waveFileWriter.Write(bytes, 0, bytes.Length);
waveFileWriter.Flush();
fs = BytesToStream(bytes);
}
fs.Position = 0;
using (var mp3 = new Mp3FileReader(fs))
//Got a frame at sample rate 16000, in an MP3 with sample rate 44100. Mp3FileReader does not support sample rate changes
{
Mp3Frame frame;
while ((frame = mp3.ReadNextFrame()) != null)
{
if ((int)mp3.CurrentTime.TotalSeconds <= 120)//2 mintues
{
`outputStream.Write(frame.RawData,` 0, frame.RawData.Length);
}
}
}
}
catch (Exception e)
{
string msg = e.Message;
}
return outputStream;
}
Mp3FileReader is throwing an exception: Got a frame at sample rate 16000, in an MP3 with sample rate 44100. Mp3FileReader does not support sample rate changes.
Would someone give me some suggestions for this error? thanks In additions, you can click below url to download my source code. Use VS2015 to open the project, thanks. https://pan.baidu.com/s/1qYiEqle
My email is 54373175@qq.com Let me know if you have any comments for this error.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:8 (3 by maintainers)
Top Results From Across the Web
Got a frame at sample rate 44100, in an MP3 with ...
Mp3FileReader is throwing an exception: Got a frame at sample rate 44100, in an MP3 with sample rate 48000. Mp3FileReader does not support...
Read more >Got a frame at sample rate 16000, in an MP3 with ...
Got a frame at sample rate 16000, in an MP3 with sample rate 44100. Mp3filereader does not support sample rate changes.
Read more >NAudio does not support VBR(Got a frame at sample rate ...
Mp3FileReader is throwing an exception: Got a frame at sample rate 16000, in an MP3 with sample rate 44100. Mp3FileReader does not support...
Read more >State of MP3 Playback Support in NAudio
It is theoretically possible within an MP3 file for the sample rate and number of channels to change from frame to frame. However,...
Read more >How to Resample Audio with NAudio
The main takeaway is that if you lower the sample rate, you really ought to use a low pass filter first, to get...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You don’t need the WaveFormatConversionStream - the StreamMediaFoundationReader will already emit PCM
Bug is caused by artwork being present in the ID3 Tags. We will open a separate issue.