Advertisement
Guest User

Untitled

a guest
Aug 24th, 2016
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.56 KB | None | 0 0
  1. [DllImport("User32.dll")]
  2. public static extern bool SetForegroundWindow(IntPtr hWnd);
  3. public void mciConvertWavMP3(string fileName, bool waitFlag)
  4. {
  5.  
  6. string savepath = Server.MapPath(fileName);
  7. string destpath = Server.MapPath(fileName);
  8. string pworkingDir = Server.MapPath("~/ffmpeg/");
  9.  
  10. // string outfile = "-b:a 16 --resample 24 -m j " + savepath + " " + savepath.Replace(".wav", ".mp3") + ""; //--- lame code
  11. // string outfile = "-b 192k -i " + savepath + " " + destpath.Replace(".mp4", ".webm");
  12. // string outfile = "ffmpeg -i " + savepath + " -acodec libvorbis -ac 2 -ab 96k -ar 44100 -b 345k -s 640x360 " + Server.MapPath("output-file.webm");
  13.  
  14. string outfile = "ffmpeg -i "test7.mp4" -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis "" + Server.MapPath("output-file.webm") + """;
  15. // string outfile = "ffmpeg -i ""+fileName+"" -codec:v libvpx -quality good -cpu-used 0 -b:v 600k -qmin 10 -qmax 42 -maxrate 500k -bufsize 1000k -threads 2 -vf scale=-1:480 -an -pass 1 -f webm /dev/null";
  16.  
  17. System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo();
  18. psi.FileName = pworkingDir+"ffmpeg.exe";
  19. psi.Arguments = outfile;
  20. psi.UseShellExecute = true;
  21. psi.CreateNoWindow = false;
  22. System.Diagnostics.Process p = System.Diagnostics.Process.Start(psi);
  23. Thread.Sleep(1000);// utput.webm
  24. if (waitFlag)
  25. {
  26. p.WaitForExit();
  27. // wait for exit of called application
  28. }
  29. }
  30.  
  31. string outfile = "ffmpeg -i "test7.mp4" -c:v libvpx -crf 10 -b:v 1M -c:a libvorbis "" + Server.MapPath("output-file.webm") + """;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement