Domanda

Sto cercando un buon tutorial o come usare SharpFFMpeg o se c'è un modo semplice per usare ffmpeg in c # ...

Vorrei convertire i video. (formato x) in video.flv prendendo screenshot e salvandoli mentre vado.

Se c'è un buon tutorial là fuori o conosci un modo semplice per farlo, pubblicalo qui.

Grazie, Kieran

È stato utile?

Soluzione 2

Esecuzione di args da riga di comando www.codeproject.com/KB/cs/Execute_Command_in_CSharp.aspx

Estrazione di immagini http://stream0.org/2008/02/ HOWTO-Extract-immagini-da-un-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);
 }

E questo è uno snipit di codice preso dal primo link. Le virgolette aggiuntive sull'uso del comando consentono di eseguirlo con spazi nel suo nome. vale a dire " ... / Documenti /..."

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
  }

Altri suggerimenti

Sta usando ffmpeg.exe con c # non usando sharp ffmpeg.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top