Video Transcoding, video
/// <Summary> /// convert to MP4 format /// </summary> /// <param name = "fromFilePath"> </param> /// <returns> </returns> public static string ToMp4 (string fromFilePath) {string ffmpeg = HttpContext. current. server. mapPath ("/") + "ffmpeg \ bin \ ffmpeg.exe"; // path of the ffmpeg execution file: int lastIndexPort = fromFilePath. lastIndexOf (". "); string toPathFileName = fromFilePath. substring (0, lastIndexPort) + ". mp4 "; if ((! System. IO. file. exists (ffmpeg) {return string. empty;} // convert the string Command = "-I \" "+ fromFilePath +" \ "-c: v libx264-strict-2 \ "" + toPathFileName + "\" "; using (System. diagnostics. process p = new System. diagnostics. process () {p. startInfo. fileName = ffmpeg; p. startInfo. arguments = Command; // p. startInfo. workingDirectory = HttpContext. current. server. mapPath ("~ /Temp/"); 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 ;}}