From 485a814251ec584f889b5309beffdf6a87897979 Mon Sep 17 00:00:00 2001 From: RKrom Date: Thu, 15 Nov 2012 16:38:19 +0000 Subject: [PATCH] Added the possibility for a command after capturing. git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2288 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4 --- Greenshot/Helpers/ScreenCaptureHelper.cs | 29 ++++++++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/Greenshot/Helpers/ScreenCaptureHelper.cs b/Greenshot/Helpers/ScreenCaptureHelper.cs index 96c552424..3c85dd940 100644 --- a/Greenshot/Helpers/ScreenCaptureHelper.cs +++ b/Greenshot/Helpers/ScreenCaptureHelper.cs @@ -285,15 +285,34 @@ namespace Greenshot.Helpers { // free up the Bitmap object GDI32.DeleteObject(hDIBSection); } - if (aviWriter != null) { - aviWriter.Dispose(); - aviWriter = null; - MessageBox.Show("Recording written to " + filename); - } if (disabledDWM) { DWM.EnableComposition(); } + if (aviWriter != null) { + aviWriter.Dispose(); + aviWriter = null; + + string ffmpegexe = PluginUtils.GetExePath("ffmpeg.exe"); + if (ffmpegexe != null) { + try { + string webMFile = filename.Replace(".avi", ".webm"); + ProcessStartInfo processStartInfo = new ProcessStartInfo(ffmpegexe, "-i \"" + filename + "\" -vcodec libvpx -g 30 \"" + webMFile + "\""); + processStartInfo.CreateNoWindow = false; + processStartInfo.RedirectStandardOutput = false; + processStartInfo.UseShellExecute = false; + Process process = Process.Start(processStartInfo); + process.WaitForExit(); + if (process.ExitCode == 0) { + MessageBox.Show("Recording written to " + webMFile); + } + } catch (Exception ex) { + MessageBox.Show("Recording written to " + filename + " couldn't convert due to an error: " + ex.Message); + } + } else { + MessageBox.Show("Recording written to " + filename); + } + } } } }