ffmpeg 音頻轉碼


使用ffmpeg.exe 將wav音頻文件轉碼為MP3和MP4

1、轉碼為MP3

" -i " + fromFilePath + " -f mp3 -acodec libmp3lame -y  " + toPathFileName;

2、轉碼為ogg

" -i " + fromFilePath + " -f ogg -acodec libvorbis  -y  " + toPathFileName;

 

調用ffmpeg.exe的代碼

using (System.Diagnostics.Process p = new System.Diagnostics.Process())
            {
                p.StartInfo.FileName = ffmpegExePath;
                p.StartInfo.Arguments = Command;
                p.StartInfo.UseShellExecute = false;
                p.StartInfo.RedirectStandardInput = true;
                p.StartInfo.RedirectStandardOutput = true;
                p.StartInfo.RedirectStandardError = true;
                p.StartInfo.CreateNoWindow = false;
                p.Start();
                p.BeginErrorReadLine();
                p.WaitForExit();
                p.Dispose();
                return toPathFileName;
            }

 

LAME

lame是一個有名的開源mp3編碼庫

Vorbis格式


Vorbis
是一個由 Xiph.Org基金會領導的 免費的開源軟件項目。該項目為 有損 音頻壓縮生成 音頻編碼格式和軟件參考編碼器/解碼器( 編解碼器)。Vorbis通常與 Ogg  容器格式 [7]結合使用,因此它通常被稱為 Ogg Vorbis。 
 
 
 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM