NAudio audio file conversion

1. NuGet installs NAudio, the URL of the project and demo: https://github.com/naudio/NAudio

 

Encode to MP3, WMA and AAC with MediaFoundationEncoder

Use MediaFoundationEncoder to encode audio files to MP3, WMA, AAC Demo address:

https://github.com/naudio/NAudio/blob/master/Docs/MediaFoundationEncoder.md

 

 

reference namespace

using NAudio.Wave;

  string fromFilePath = @"F:\Test\ffmpegTest\ffmpegTest\audio.wav";
            string toFilePath = @"F:\Test\ffmpegTest\ffmpegTest\audio.mp3";

            using (var reader = new MediaFoundationReader(fromFilePath))
            {
                MediaFoundationEncoder.EncodeToMp3(reader, toFilePath);
            }

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326173876&siteId=291194637