代码之家  ›  专栏  ›  技术社区  ›  Kieran

SharpFFMpeg ffmpeg转换教程

  •  2
  • Kieran  · 技术社区  · 16 年前

    我想要的是一个很好的教程,或者如何使用SharpFFMpeg,或者是否有一种在c#中使用ffmpeg的简单方法。。。

    如果有一个很好的教程在那里,或者你知道一个简单的方法,请张贴在这里。

    谢谢 基兰

    2 回复  |  直到 16 年前
        1
  •  4
  •   VeXii    16 年前

    这是使用ffmpeg.exe而不是使用sharpffmpeg。

        2
  •  1
  •   Stu Thompson Helter Scelter    16 年前

    运行命令行参数 www.codeproject.com/KB/cs/Execute_Command_in_CSharp.aspx

    提取图像 http://stream0.org/2008/02/howto-extract-images-from-a-vi.html

        protected void BTN_convert_Click(object sender, EventArgs e) {
    
      String runMe = @"C:\Documents and Settings\Wasabi Digital\My Documents\Visual Studio 2008\Projects\Evo\WEB\Bin\ffmpeg.exe";  
      String pathToFiles = @"C:\Documents and Settings\Wasabi Digital\My Documents\Visual Studio 2008\Evo\WEB\test\";    
      String convertVideo = " -i \"" + pathToFiles + "out.wmv\" \"" + pathToFiles + "sample3.flv\" ";
      String makeImages = " -i \"" + pathToFiles + "out.wmv\" -r 1 -ss 00:00:01 -t 00:00:15 -f image2 -s 120x96 \"" + pathToFiles + "images%05d.png\"";
      this.ExecuteCommandSync(runMe,convertVideo);
      this.ExecuteCommandSync(runMe, makeImages);
     }
    

    public void ExecuteCommandSync(String command, String args) {
    
    
     try {   
       System.Diagnostics.ProcessStartInfo procStartInfo =
        new System.Diagnostics.ProcessStartInfo("\""+command+"\"",args);
    
       Process.StandardOutput StreamReader.
       procStartInfo.RedirectStandardOutput = true;
       procStartInfo.UseShellExecute = false;
    
       procStartInfo.CreateNoWindow = true;
    
       System.Diagnostics.Process proc = new System.Diagnostics.Process();
       proc.StartInfo = procStartInfo;
       proc.Start();
    
       string result = proc.StandardOutput.ReadToEnd();
    
       Debug.WriteLine(result);
      } catch (Exception objException) {   
       // Log the exception
      }
    
    推荐文章