Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.90 KB | None | 0 0
  1.  private void RunFFMPEG(string path)
  2.         {
  3.             FileInfo file = new FileInfo(path);
  4.  
  5.             string filename = Path.GetFileNameWithoutExtension(file.FullName);
  6.            
  7.             string resultName = $"Songs\\{filename}";
  8.             string args = $"-i \"{file.FullName}\" -c libvorbis \"{resultName}.ogg\"";
  9.  
  10.             Process ffmpeg = new Process
  11.             {
  12.                 StartInfo =
  13.                 {
  14.                     FileName = @"ffmpeg/ffmpeg.exe",
  15.                     Arguments = args,
  16.                     CreateNoWindow = true,
  17.                     UseShellExecute = false,
  18.                     RedirectStandardOutput = true
  19.                 }
  20.             };
  21.  
  22.             ffmpeg.EnableRaisingEvents = true;
  23.            
  24.             ffmpeg.Exited += (o, e) => { AudioManager.Instance.Music.Filename = filename; };
  25.            
  26.             ffmpeg.Start();
  27.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement