en cours args ligne de commande www.codeproject.com/KB/cs/Execute_Command_in_CSharp.aspx
images Extraction 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);
}
Et cela est un code snipit pris du premier lien. Les guillemets supplémentaires autour de l'utilisation de la commande le font fonctionner avec des espaces dans son nom. c'est-à-dire ".../Mes Documents/..."
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
}
J'ai légèrement modifié la commande. Mettre dans les taux d'échantillon aide comme parfois échouait sur certaines vidéos. /* Extrait de http://www.catswhocode.com/blog/19-ffmpeg-commands-for-all-needs */ ffmpeg -i video_origine.avi -ab 56 -ar 44100 -b 200 -r 15 -s 320x240 -f flv video_finale.flv – Kieran
Donc, personne n'utilise réellement l'API SharpFFmpeg? Il semble que ce soit une API vraiment sympa bien que –