diff --git a/butterflow-ui/ButterflowWrapper.cs b/butterflow-ui/ButterflowWrapper.cs index 41f50d5..c9d3564 100644 --- a/butterflow-ui/ButterflowWrapper.cs +++ b/butterflow-ui/ButterflowWrapper.cs @@ -77,11 +77,14 @@ namespace butterflow_ui process.StartInfo.CreateNoWindow = true; process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; + process.StartInfo.RedirectStandardError = true; process.EnableRaisingEvents = true; - process.OutputDataReceived += Process_OutputDataReceived; ; + process.OutputDataReceived += Process_OutputDataReceived; + process.ErrorDataReceived += Process_OutputDataReceived; process.Start(); process.BeginOutputReadLine(); + process.BeginErrorReadLine(); } /// diff --git a/butterflow-ui/Icons.xaml b/butterflow-ui/Icons.xaml index 1118b6a..830cf78 100644 --- a/butterflow-ui/Icons.xaml +++ b/butterflow-ui/Icons.xaml @@ -148,4 +148,13 @@ + + + + + + + + + \ No newline at end of file diff --git a/butterflow-ui/Localization/Localization.Designer.cs b/butterflow-ui/Localization/Localization.Designer.cs index afd0955..4919c59 100644 --- a/butterflow-ui/Localization/Localization.Designer.cs +++ b/butterflow-ui/Localization/Localization.Designer.cs @@ -249,6 +249,15 @@ namespace butterflow_ui.Localization { } } + /// + /// Looks up a localized string similar to Output. + /// + public static string FileOutputGroupBox { + get { + return ResourceManager.GetString("FileOutputGroupBox", resourceCulture); + } + } + /// /// Looks up a localized string similar to Flow Filter. /// @@ -420,6 +429,24 @@ namespace butterflow_ui.Localization { } } + /// + /// Looks up a localized string similar to Process. + /// + public static string ProcessLabel { + get { + return ResourceManager.GetString("ProcessLabel", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Process the video. This may be a long process.. + /// + public static string ProcessTooltip { + get { + return ResourceManager.GetString("ProcessTooltip", resourceCulture); + } + } + /// /// Looks up a localized string similar to Pyramid Scale Factor. /// diff --git a/butterflow-ui/Localization/Localization.resx b/butterflow-ui/Localization/Localization.resx index 8fe7f88..eda7438 100644 --- a/butterflow-ui/Localization/Localization.resx +++ b/butterflow-ui/Localization/Localization.resx @@ -240,6 +240,9 @@ + + Output + Flow Filter @@ -270,6 +273,12 @@ Size of the pixel neighborhood. + + Process + + + Process the video. This may be a long process. + Pyramid Scale Factor diff --git a/butterflow-ui/MainWindow.xaml b/butterflow-ui/MainWindow.xaml index 364caf6..da4e582 100644 --- a/butterflow-ui/MainWindow.xaml +++ b/butterflow-ui/MainWindow.xaml @@ -71,23 +71,43 @@ + + - - - + - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + @@ -115,7 +135,7 @@ - + @@ -288,7 +308,7 @@ - diff --git a/butterflow-ui/MainWindow.xaml.cs b/butterflow-ui/MainWindow.xaml.cs index 158d752..acced8e 100644 --- a/butterflow-ui/MainWindow.xaml.cs +++ b/butterflow-ui/MainWindow.xaml.cs @@ -112,17 +112,30 @@ namespace butterflow_ui if (result.HasValue && result.Value) { this.OptionsConfiguration.VideoInput = ofd.FileName; - - //this.ButterflowWrapper.ConsoleOutputRecieved += (o, ce) => this.txtConsoleOutput.Text = ce.ConsoleOutput; + this.ButterflowWrapper.Probe(ofd.FileName); //Hack to get the first frame to display in the media preview element. - //This also triggers the MediaOpened event so we can get the metadata from the element. mediaPreview.Play(); mediaPreview.PausePlayback(); } } + /// Event handler. Called by btnFileOutputPicker for click events. + /// Source of the event. + /// Routed event information. + private void btnFileOutputPicker_Click(object sender, RoutedEventArgs e) + { + var sfd = new SaveFileDialog(); + sfd.Filter = "MPEG 4|*.mp4"; + + var result = sfd.ShowDialog(this); + if (result.HasValue && result.Value) + { + this.OptionsConfiguration.VideoOutput = sfd.FileName; + } + } + /// Event handler. Called by PlaybackRate radio buttons for checked events. /// Source of the event. /// Routed event information. @@ -268,20 +281,36 @@ namespace butterflow_ui } } - /// Event handler. Called by TextBox for got focus events. + /// Event handler. Called by txtPlaybackRate for got focus events. /// Source of the event. /// Routed event information. - private void TextBox_GotFocus(object sender, RoutedEventArgs e) + private void txtPlaybackRate_GotFocus(object sender, RoutedEventArgs e) { //Clear all the radio buttons because we got focus from the user in the playbackrate textbox. var playbackRateRadioButtons = GetRecursiveChildren(this.butterflowUIWindow); - foreach(var radioButton in playbackRateRadioButtons) + foreach (var radioButton in playbackRateRadioButtons) { radioButton.IsChecked = false; } } + /// Event handler. Called by btnCopyArguments for click events. + /// Source of the event. + /// Routed event information. + private void btnCopyArguments_Click(object sender, RoutedEventArgs e) + { + Clipboard.SetText(this.OptionsConfiguration.CommandLineOutput); + } + + /// Event handler. Called by btnProcess for click events. + /// Source of the event. + /// Routed event information. + private void btnProcess_Click(object sender, RoutedEventArgs e) + { + this.ButterflowWrapper.Run(this.OptionsConfiguration); + } + #endregion } } diff --git a/butterflow-ui/OptionsConfiguration.cs b/butterflow-ui/OptionsConfiguration.cs index e52fb37..5f8dc6a 100644 --- a/butterflow-ui/OptionsConfiguration.cs +++ b/butterflow-ui/OptionsConfiguration.cs @@ -450,8 +450,6 @@ namespace butterflow_ui if (this.KeepAudio) stringBuilder.Append("-audio "); if (this.LosslessQuality) stringBuilder.Append("-l "); - stringBuilder.AppendFormat("\"{0}\"", this.VideoInput); - if (this.Subregions.Any()) { foreach (var anon in this.Subregions.Select((sr, index) => new { Index = index, Subregion = sr })) @@ -487,6 +485,9 @@ namespace butterflow_ui if (this.pixelNeighborhood != DEFAULT_PIXEL_NEIGHBORHOOD) stringBuilder.AppendFormat("--poly-n {0} ", this.PixelNeighborhood); if (this.smoothDerivativeStandardDeviation != DEFAULT_SMOOTH_DERIVATIVE_STANDARD_DEVIATION) stringBuilder.AppendFormat("--poly-s {0} ", this.SmoothDerivativeStandardDeviation); if (this.FlowFilterType != DEFAULT_FLOW_FILTER_TYPE) stringBuilder.AppendFormat("-ff {0} ", this.FlowFilterType); + if (!string.IsNullOrWhiteSpace(this.VideoOutput)) stringBuilder.AppendFormat("-o \"{0}\" ", this.VideoOutput); + + stringBuilder.AppendFormat("\"{0}\"", this.VideoInput); return stringBuilder.ToString(); }