2016-10-28 8 views
0

すべてのオーディオをmp3に変換することは可能ですか?すべてのタイプ(オーディオ*)をmp3に変換するには? FFMPEGを使用

System.Diagnostics.Process proc = new System.Diagnostics.Process(); 
        proc.EnableRaisingEvents = false; 
        proc.StartInfo.FileName = @"""C:\ffmpeg\bin\ffmpeg.exe"""; 
        proc.StartInfo.Arguments = "-i C:\\Matheus\\Matheus_Project\\Matheus_Project\\App_Data\\" + User.Identity.Name + "\\" + fileNameAndType + " -acodec libmp3lame -ab 128k C:\\Matheus\\Matheus_Project\\Matheus_Project\\App_Data\\" + User.Identity.Name + "\\" + fileName + ".mp3"; /* use /y to overwrite if there it exists already or will fail */ 
        proc.StartInfo.UseShellExecute = false; 
        proc.StartInfo.CreateNoWindow = false; 
        proc.StartInfo.RedirectStandardOutput = true; 
        proc.StartInfo.RedirectStandardError = true; 
        proc.Start(); 

        var output = proc.StandardOutput.ReadToEnd(); 
        string output_error = proc.StandardError.ReadToEnd(); 

        proc.WaitForExit(); 
        proc.Close(); 

例:mp3にmp3に

  • オーディオ/ X-M4A

  • オーディオ/ MP4 mp3

  • オーディオへの基本的な

  • オーディオ//L24〜mp3

  • mp3へ
  • オーディオ/ミッドmp3へ/ X-aiffの

  • オーディオmp3へ

  • オーディオ/ vnd.rn-のRealAudio mp3へ/ X-mpegurl

  • オーディオ

  • mp3へ

  • オーディオ/ Vorbisのmp3へ

    オーディオ/ oggの

  • mp3へ

    オーディオ/ vnd.wav

任意のアイデア?

+0

しかし、あなたのコードは動作するのでしょうか?...また、このQ&Aをチェックしました:http://stackoverflow.com/questions/3255674/convert-audio-files-to-mp3-using-ffmpeg – Hackerman

答えて

0

公共ボイドConvertWavToMp3(文字列のファイル名) { "FlacRecording" { 文字列Flacfilename = AppDomain.CurrentDomain.BaseDirectory +してみてください。

  ProcessStartInfo psi = new ProcessStartInfo(); 
      psi.UseShellExecute = false; 
      psi.CreateNoWindow = true; 
      psi.WindowStyle = ProcessWindowStyle.Hidden; 
      psi.FileName = AppDomain.CurrentDomain.BaseDirectory + @"lame.exe"; 
      psi.Arguments = "-b" + "128" + " --resample " + "22.05" + " -m j " + 
          "\"" + filename + "\"" + " " + 
          "\"" + Flacfilename + "\\" + Path.GetFileNameWithoutExtension(filename) + ".mp3" + "\""; 


      Process p = Process.Start(psi); 
      p.WaitForExit(); 
      p.Close(); 
      p.Dispose(); 


     } 
     catch (Exception ae) 
     { 
     } 

    } 

lame.exeをダウンロードしてアプリケーションに入れ、wavファイル名でフルパスを渡してabover関数を呼び出します。

関連する問題