From 181e50d723258bfa0cdcf02c0a7b2d6ff9f73bf4 Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Sun, 21 Apr 2024 11:56:05 +0200 Subject: [PATCH 1/8] Work on #8230 --- Changelog.txt | 4 +- src/libse/Common/Settings.cs | 8 + .../Forms/Tts/RegenerateAudioClip.Designer.cs | 150 ++++++++++++ src/ui/Forms/Tts/RegenerateAudioClip.cs | 62 +++++ src/ui/Forms/Tts/RegenerateAudioClip.resx | 120 ++++++++++ src/ui/Forms/Tts/ReviewAudioClips.Designer.cs | 216 ++++++++++++++++++ src/ui/Forms/Tts/ReviewAudioClips.cs | 215 +++++++++++++++++ src/ui/Forms/Tts/ReviewAudioClips.resx | 120 ++++++++++ src/ui/Forms/Tts/TextToSpeech.Designer.cs | 156 +++++++------ src/ui/Forms/Tts/TextToSpeech.cs | 93 +++++++- src/ui/Logic/VideoPlayers/LibMpvDynamic.cs | 4 +- src/ui/SubtitleEdit.csproj | 18 ++ 12 files changed, 1082 insertions(+), 84 deletions(-) create mode 100644 src/ui/Forms/Tts/RegenerateAudioClip.Designer.cs create mode 100644 src/ui/Forms/Tts/RegenerateAudioClip.cs create mode 100644 src/ui/Forms/Tts/RegenerateAudioClip.resx create mode 100644 src/ui/Forms/Tts/ReviewAudioClips.Designer.cs create mode 100644 src/ui/Forms/Tts/ReviewAudioClips.cs create mode 100644 src/ui/Forms/Tts/ReviewAudioClips.resx diff --git a/Changelog.txt b/Changelog.txt index 88516b8d8..97eba352a 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -2,8 +2,8 @@ 4.0.6 (xth May 2024) BETA * NEW: - * Add "Text To Speech" - thx darnn - * Add burn-in batch mode - thx Leon + * Add "Text To Speech" - thx darnn/cvrle77/msjsc001 + * Add burn-in batch mode - thx Leon/David * IMPROVED: * Update Portuguese translation - thx hugok79 * Update Bulgarian translation - thx Калин diff --git a/src/libse/Common/Settings.cs b/src/libse/Common/Settings.cs index 15d0d49cd..a6d6ac868 100644 --- a/src/libse/Common/Settings.cs +++ b/src/libse/Common/Settings.cs @@ -191,6 +191,7 @@ namespace Nikse.SubtitleEdit.Core.Common public int AutoTranslateDelaySeconds { get; set; } public string GeminiProApiKey { get; set; } public string TextToSpeechEngine { get; set; } + public string TextToSpeechLastVoice { get; set; } public string TextToSpeechElevenLabsApiKey { get; set; } public bool DisableVidoInfoViaLabel { get; set; } public bool ListViewSyntaxColorDurationSmall { get; set; } @@ -5464,6 +5465,12 @@ $HorzAlign = Center settings.Tools.TextToSpeechEngine = subNode.InnerText; } + subNode = node.SelectSingleNode("TextToSpeechLastVoice"); + if (subNode != null) + { + settings.Tools.TextToSpeechLastVoice = subNode.InnerText; + } + subNode = node.SelectSingleNode("TextToSpeechElevenLabsApiKey"); if (subNode != null) { @@ -11992,6 +11999,7 @@ $HorzAlign = Center textWriter.WriteElementString("AutoTranslateDelaySeconds", settings.Tools.AutoTranslateDelaySeconds.ToString(CultureInfo.InvariantCulture)); textWriter.WriteElementString("GeminiProApiKey", settings.Tools.GeminiProApiKey); textWriter.WriteElementString("TextToSpeechEngine", settings.Tools.TextToSpeechEngine); + textWriter.WriteElementString("TextToSpeechLastVoice", settings.Tools.TextToSpeechLastVoice); textWriter.WriteElementString("TextToSpeechElevenLabsApiKey", settings.Tools.TextToSpeechElevenLabsApiKey); textWriter.WriteElementString("DisableVidoInfoViaLabel", settings.Tools.DisableVidoInfoViaLabel.ToString(CultureInfo.InvariantCulture)); textWriter.WriteElementString("ListViewSyntaxColorDurationSmall", settings.Tools.ListViewSyntaxColorDurationSmall.ToString(CultureInfo.InvariantCulture)); diff --git a/src/ui/Forms/Tts/RegenerateAudioClip.Designer.cs b/src/ui/Forms/Tts/RegenerateAudioClip.Designer.cs new file mode 100644 index 000000000..f08f44cba --- /dev/null +++ b/src/ui/Forms/Tts/RegenerateAudioClip.Designer.cs @@ -0,0 +1,150 @@ +namespace Nikse.SubtitleEdit.Forms.Tts +{ + partial class RegenerateAudioClip + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.buttonCancel = new System.Windows.Forms.Button(); + this.TextBoxReGenerate = new Nikse.SubtitleEdit.Controls.NikseTextBox(); + this.buttonReGenerate = new System.Windows.Forms.Button(); + this.labelVoice = new System.Windows.Forms.Label(); + this.nikseComboBoxVoice = new Nikse.SubtitleEdit.Controls.NikseComboBox(); + this.labelText = new System.Windows.Forms.Label(); + this.SuspendLayout(); + // + // buttonCancel + // + this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonCancel.Location = new System.Drawing.Point(730, 208); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(84, 23); + this.buttonCancel.TabIndex = 7; + this.buttonCancel.Text = "C&ancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); + // + // TextBoxReGenerate + // + this.TextBoxReGenerate.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.TextBoxReGenerate.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.TextBoxReGenerate.Location = new System.Drawing.Point(12, 40); + this.TextBoxReGenerate.Multiline = true; + this.TextBoxReGenerate.Name = "TextBoxReGenerate"; + this.TextBoxReGenerate.Size = new System.Drawing.Size(802, 162); + this.TextBoxReGenerate.TabIndex = 22; + // + // buttonReGenerate + // + this.buttonReGenerate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonReGenerate.Location = new System.Drawing.Point(550, 208); + this.buttonReGenerate.Name = "buttonReGenerate"; + this.buttonReGenerate.Size = new System.Drawing.Size(174, 23); + this.buttonReGenerate.TabIndex = 21; + this.buttonReGenerate.Text = "Regenerate "; + this.buttonReGenerate.UseVisualStyleBackColor = true; + this.buttonReGenerate.Click += new System.EventHandler(this.buttonReGenerate_Click); + // + // labelVoice + // + this.labelVoice.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.labelVoice.AutoSize = true; + this.labelVoice.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.labelVoice.Location = new System.Drawing.Point(153, 213); + this.labelVoice.Name = "labelVoice"; + this.labelVoice.Size = new System.Drawing.Size(34, 13); + this.labelVoice.TabIndex = 24; + this.labelVoice.Text = "Voice"; + // + // nikseComboBoxVoice + // + this.nikseComboBoxVoice.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.nikseComboBoxVoice.BackColor = System.Drawing.SystemColors.Window; + this.nikseComboBoxVoice.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240))))); + this.nikseComboBoxVoice.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179))))); + this.nikseComboBoxVoice.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120))))); + this.nikseComboBoxVoice.ButtonForeColor = System.Drawing.SystemColors.ControlText; + this.nikseComboBoxVoice.ButtonForeColorDown = System.Drawing.Color.Orange; + this.nikseComboBoxVoice.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.nikseComboBoxVoice.DropDownHeight = 400; + this.nikseComboBoxVoice.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.nikseComboBoxVoice.DropDownWidth = 0; + this.nikseComboBoxVoice.FormattingEnabled = false; + this.nikseComboBoxVoice.Location = new System.Drawing.Point(193, 208); + this.nikseComboBoxVoice.MaxLength = 32767; + this.nikseComboBoxVoice.Name = "nikseComboBoxVoice"; + this.nikseComboBoxVoice.SelectedIndex = -1; + this.nikseComboBoxVoice.SelectedItem = null; + this.nikseComboBoxVoice.SelectedText = ""; + this.nikseComboBoxVoice.Size = new System.Drawing.Size(351, 23); + this.nikseComboBoxVoice.TabIndex = 23; + this.nikseComboBoxVoice.UsePopupWindow = false; + // + // labelText + // + this.labelText.AutoSize = true; + this.labelText.Location = new System.Drawing.Point(13, 21); + this.labelText.Name = "labelText"; + this.labelText.Size = new System.Drawing.Size(28, 13); + this.labelText.TabIndex = 25; + this.labelText.Text = "Text"; + // + // RegenerateAudioClip + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(826, 243); + this.Controls.Add(this.labelText); + this.Controls.Add(this.labelVoice); + this.Controls.Add(this.nikseComboBoxVoice); + this.Controls.Add(this.TextBoxReGenerate); + this.Controls.Add(this.buttonReGenerate); + this.Controls.Add(this.buttonCancel); + this.KeyPreview = true; + this.MinimumSize = new System.Drawing.Size(600, 250); + this.Name = "RegenerateAudioClip"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Regenerate audio clip"; + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + private System.Windows.Forms.Button buttonCancel; + private Controls.NikseTextBox TextBoxReGenerate; + private System.Windows.Forms.Button buttonReGenerate; + private System.Windows.Forms.Label labelVoice; + private Controls.NikseComboBox nikseComboBoxVoice; + private System.Windows.Forms.Label labelText; + } +} \ No newline at end of file diff --git a/src/ui/Forms/Tts/RegenerateAudioClip.cs b/src/ui/Forms/Tts/RegenerateAudioClip.cs new file mode 100644 index 000000000..2905c6c7a --- /dev/null +++ b/src/ui/Forms/Tts/RegenerateAudioClip.cs @@ -0,0 +1,62 @@ +using Nikse.SubtitleEdit.Core.Common; +using Nikse.SubtitleEdit.Logic; +using System; +using System.Windows.Forms; + +namespace Nikse.SubtitleEdit.Forms.Tts +{ + public partial class RegenerateAudioClip : Form + { + public string NewAudioFileName { get; set; } + + private readonly TextToSpeech _textToSpeech; + private readonly Subtitle _subtitle; + private readonly int _index; + + public RegenerateAudioClip(TextToSpeech textToSpeech, Subtitle subtitle, int idx) + { + UiUtil.PreInitialize(this); + InitializeComponent(); + UiUtil.FixFonts(this); + + _subtitle = subtitle; + _textToSpeech = textToSpeech; + _index = idx; + + buttonCancel.Text = LanguageSettings.Current.General.Cancel; + UiUtil.FixLargeFonts(this, buttonCancel); + + TextBoxReGenerate.Text = subtitle.Paragraphs[idx].Text; + textToSpeech.SetCurrentVoices(nikseComboBoxVoice); + } + + private async void buttonReGenerate_Click(object sender, EventArgs e) + { + var paragraph = _subtitle.Paragraphs[_index]; + paragraph.Text = TextBoxReGenerate.Text.Trim(); + + try + { + Cursor = Cursors.WaitCursor; + buttonReGenerate.Enabled = false; + var fileName = await _textToSpeech.GenerateAudio(paragraph, nikseComboBoxVoice.Text); + if (!string.IsNullOrEmpty(fileName)) + { + NewAudioFileName = fileName; + Cursor = Cursors.Default; + DialogResult = DialogResult.OK; + } + } + finally + { + Cursor = Cursors.Default; + buttonReGenerate.Enabled = true; + } + } + + private void buttonCancel_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.Cancel; + } + } +} diff --git a/src/ui/Forms/Tts/RegenerateAudioClip.resx b/src/ui/Forms/Tts/RegenerateAudioClip.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/src/ui/Forms/Tts/RegenerateAudioClip.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src/ui/Forms/Tts/ReviewAudioClips.Designer.cs b/src/ui/Forms/Tts/ReviewAudioClips.Designer.cs new file mode 100644 index 000000000..b8c127d12 --- /dev/null +++ b/src/ui/Forms/Tts/ReviewAudioClips.Designer.cs @@ -0,0 +1,216 @@ +namespace Nikse.SubtitleEdit.Forms.Tts +{ + sealed partial class ReviewAudioClips + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.listView1 = new System.Windows.Forms.ListView(); + this.columnHeaderInclude = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeaderNo = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeaderVoice = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeaderCps = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeaderText = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.buttonOK = new System.Windows.Forms.Button(); + this.labelInfo = new System.Windows.Forms.Label(); + this.buttonPlay = new System.Windows.Forms.Button(); + this.labelParagraphInfo = new System.Windows.Forms.Label(); + this.checkBoxContinuePlay = new System.Windows.Forms.CheckBox(); + this.buttonStop = new System.Windows.Forms.Button(); + this.buttonReGenerate = new System.Windows.Forms.Button(); + this.SuspendLayout(); + // + // listView1 + // + this.listView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.listView1.CheckBoxes = true; + this.listView1.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeaderInclude, + this.columnHeaderNo, + this.columnHeaderVoice, + this.columnHeaderCps, + this.columnHeaderText}); + this.listView1.FullRowSelect = true; + this.listView1.HideSelection = false; + this.listView1.Location = new System.Drawing.Point(12, 52); + this.listView1.MultiSelect = false; + this.listView1.Name = "listView1"; + this.listView1.Size = new System.Drawing.Size(684, 319); + this.listView1.TabIndex = 0; + this.listView1.UseCompatibleStateImageBehavior = false; + this.listView1.View = System.Windows.Forms.View.Details; + this.listView1.SelectedIndexChanged += new System.EventHandler(this.listView1_SelectedIndexChanged); + this.listView1.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listView1_KeyDown); + // + // columnHeaderInclude + // + this.columnHeaderInclude.Text = "Include"; + // + // columnHeaderNo + // + this.columnHeaderNo.Text = "#"; + this.columnHeaderNo.Width = 50; + // + // columnHeaderVoice + // + this.columnHeaderVoice.Text = "Voice"; + this.columnHeaderVoice.Width = 120; + // + // columnHeaderCps + // + this.columnHeaderCps.Text = "CPS"; + // + // columnHeaderText + // + this.columnHeaderText.Text = "Text"; + this.columnHeaderText.Width = 460; + // + // buttonOK + // + this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonOK.Location = new System.Drawing.Point(795, 413); + this.buttonOK.Name = "buttonOK"; + this.buttonOK.Size = new System.Drawing.Size(87, 23); + this.buttonOK.TabIndex = 5; + this.buttonOK.Text = "&OK"; + this.buttonOK.UseVisualStyleBackColor = true; + this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); + // + // labelInfo + // + this.labelInfo.AutoSize = true; + this.labelInfo.Location = new System.Drawing.Point(12, 33); + this.labelInfo.Name = "labelInfo"; + this.labelInfo.Size = new System.Drawing.Size(219, 13); + this.labelInfo.TabIndex = 8; + this.labelInfo.Text = "Review and un-include unwanted audio clips"; + // + // buttonPlay + // + this.buttonPlay.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonPlay.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonPlay.Location = new System.Drawing.Point(702, 295); + this.buttonPlay.Name = "buttonPlay"; + this.buttonPlay.Size = new System.Drawing.Size(180, 23); + this.buttonPlay.TabIndex = 9; + this.buttonPlay.Text = "Play"; + this.buttonPlay.UseVisualStyleBackColor = true; + this.buttonPlay.Click += new System.EventHandler(this.buttonPlay_Click); + // + // labelParagraphInfo + // + this.labelParagraphInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.labelParagraphInfo.AutoSize = true; + this.labelParagraphInfo.Location = new System.Drawing.Point(12, 383); + this.labelParagraphInfo.Name = "labelParagraphInfo"; + this.labelParagraphInfo.Size = new System.Drawing.Size(76, 13); + this.labelParagraphInfo.TabIndex = 10; + this.labelParagraphInfo.Text = "Paragraph info"; + // + // checkBoxContinuePlay + // + this.checkBoxContinuePlay.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.checkBoxContinuePlay.AutoSize = true; + this.checkBoxContinuePlay.Location = new System.Drawing.Point(703, 353); + this.checkBoxContinuePlay.Name = "checkBoxContinuePlay"; + this.checkBoxContinuePlay.Size = new System.Drawing.Size(92, 17); + this.checkBoxContinuePlay.TabIndex = 11; + this.checkBoxContinuePlay.Text = "Auto continue"; + this.checkBoxContinuePlay.UseVisualStyleBackColor = true; + // + // buttonStop + // + this.buttonStop.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonStop.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonStop.Location = new System.Drawing.Point(703, 324); + this.buttonStop.Name = "buttonStop"; + this.buttonStop.Size = new System.Drawing.Size(179, 23); + this.buttonStop.TabIndex = 12; + this.buttonStop.Text = "Stop "; + this.buttonStop.UseVisualStyleBackColor = true; + this.buttonStop.Click += new System.EventHandler(this.buttonStop_Click); + // + // buttonReGenerate + // + this.buttonReGenerate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonReGenerate.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonReGenerate.Location = new System.Drawing.Point(703, 249); + this.buttonReGenerate.Name = "buttonReGenerate"; + this.buttonReGenerate.Size = new System.Drawing.Size(180, 23); + this.buttonReGenerate.TabIndex = 13; + this.buttonReGenerate.Text = "Regenerate"; + this.buttonReGenerate.UseVisualStyleBackColor = true; + this.buttonReGenerate.Click += new System.EventHandler(this.buttonReGenerate_Click); + // + // ReviewAudioClips + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(894, 448); + this.Controls.Add(this.buttonReGenerate); + this.Controls.Add(this.buttonStop); + this.Controls.Add(this.checkBoxContinuePlay); + this.Controls.Add(this.labelParagraphInfo); + this.Controls.Add(this.buttonPlay); + this.Controls.Add(this.labelInfo); + this.Controls.Add(this.buttonOK); + this.Controls.Add(this.listView1); + this.KeyPreview = true; + this.MinimumSize = new System.Drawing.Size(800, 450); + this.Name = "ReviewAudioClips"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Review audio clips"; + this.Load += new System.EventHandler(this.VoicePreviewList_Load); + this.Shown += new System.EventHandler(this.VoicePreviewList_Shown); + this.ResizeEnd += new System.EventHandler(this.VoicePreviewList_ResizeEnd); + this.Resize += new System.EventHandler(this.VoicePreviewList_Resize); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.ListView listView1; + private System.Windows.Forms.Button buttonOK; + private System.Windows.Forms.Label labelInfo; + private System.Windows.Forms.ColumnHeader columnHeaderInclude; + private System.Windows.Forms.ColumnHeader columnHeaderNo; + private System.Windows.Forms.ColumnHeader columnHeaderVoice; + private System.Windows.Forms.ColumnHeader columnHeaderCps; + private System.Windows.Forms.ColumnHeader columnHeaderText; + private System.Windows.Forms.Button buttonPlay; + private System.Windows.Forms.Label labelParagraphInfo; + private System.Windows.Forms.CheckBox checkBoxContinuePlay; + private System.Windows.Forms.Button buttonStop; + private System.Windows.Forms.Button buttonReGenerate; + } +} \ No newline at end of file diff --git a/src/ui/Forms/Tts/ReviewAudioClips.cs b/src/ui/Forms/Tts/ReviewAudioClips.cs new file mode 100644 index 000000000..4250dc722 --- /dev/null +++ b/src/ui/Forms/Tts/ReviewAudioClips.cs @@ -0,0 +1,215 @@ +using Nikse.SubtitleEdit.Core.Common; +using Nikse.SubtitleEdit.Logic; +using Nikse.SubtitleEdit.Logic.VideoPlayers; +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Windows.Forms; + +namespace Nikse.SubtitleEdit.Forms.Tts +{ + public sealed partial class ReviewAudioClips : Form + { + public List SkipIndices { get; set; } + + private readonly Subtitle _subtitle; + private readonly TextToSpeech _textToSpeech; + private readonly List _fileNames; + private bool _abortPlay; + private LibMpvDynamic _libMpv; + private Timer _mpvDoneTimer; + + public ReviewAudioClips(TextToSpeech textToSpeech, Subtitle subtitle, List fileNames) + { + UiUtil.PreInitialize(this); + InitializeComponent(); + UiUtil.FixFonts(this); + buttonOK.Text = LanguageSettings.Current.General.Ok; + UiUtil.FixLargeFonts(this, buttonOK); + + _textToSpeech = textToSpeech; + _subtitle = subtitle; + _fileNames = fileNames; + + SkipIndices = new List(); + + listView1.BeginUpdate(); + foreach (var p in subtitle.Paragraphs) + { + var item = new ListViewItem { Tag = p, Checked = true }; + item.SubItems.Add(p.Number.ToString(CultureInfo.InvariantCulture)); + item.SubItems.Add(_textToSpeech.GetParagraphAudio(p)); + item.SubItems.Add(Utilities.GetCharactersPerSecond(p).ToString("0.#", CultureInfo.InvariantCulture)); + item.SubItems.Add(p.Text); + listView1.Items.Add(item); + } + listView1.EndUpdate(); + + if (listView1.Items.Count > 0) + { + listView1.Items[0].Selected = true; + } + + labelParagraphInfo.Text = string.Empty; + } + + private void buttonOK_Click(object sender, EventArgs e) + { + _libMpv?.Stop(); + for (var index = 0; index < listView1.Items.Count; index++) + { + if (!listView1.Items[index].Checked) + { + SkipIndices.Add(index); + } + } + + DialogResult = DialogResult.OK; + } + + private void VoicePreviewList_Load(object sender, EventArgs e) + { + listView1.AutoSizeLastColumn(); + } + + private void VoicePreviewList_ResizeEnd(object sender, EventArgs e) + { + listView1.AutoSizeLastColumn(); + } + + private void VoicePreviewList_Resize(object sender, EventArgs e) + { + listView1.AutoSizeLastColumn(); + } + + private void Play(bool noAutoContinue = false) + { + if (listView1.SelectedItems.Count == 0) + { + return; + } + + var idx = listView1.SelectedItems[0].Index; + var waveFileName = _fileNames[idx]; + + if (_libMpv != null) + { + _libMpv.Initialize( + null, + waveFileName, + (sender, args) => + { + _libMpv.Play(); + }, + null); + if (checkBoxContinuePlay.Checked && !noAutoContinue) + { + _mpvDoneTimer.Start(); + } + } + else + { + using (var soundPlayer = new System.Media.SoundPlayer(waveFileName)) + { + soundPlayer.PlaySync(); + } + + if (!noAutoContinue) + { + PlayNext(idx); + } + } + } + + private void PlayNext(int idx) + { + if (checkBoxContinuePlay.Checked && !_abortPlay && idx < listView1.Items.Count - 1) + { + listView1.Items[idx].Selected = false; + listView1.Items[idx + 1].Selected = true; + listView1.Items[idx + 1].Focused = true; + listView1.Items[idx + 1].EnsureVisible(); + TaskDelayHelper.RunDelayed(TimeSpan.FromMilliseconds(10), () => Play()); + Application.DoEvents(); + } + } + + private void listView1_SelectedIndexChanged(object sender, EventArgs e) + { + if (listView1.SelectedItems.Count == 0) + { + labelParagraphInfo.Text = string.Empty; + return; + } + + var idx = listView1.SelectedItems[0].Index; + var p = _subtitle.Paragraphs[idx]; + labelParagraphInfo.Text = p.StartTime.ToDisplayString() + " --> " + p.EndTime.ToDisplayString() + " : " + p.Duration.ToShortDisplayString(); + } + + private void buttonPlay_Click(object sender, EventArgs e) + { + _abortPlay = false; + Play(); + } + + private void buttonStop_Click(object sender, EventArgs e) + { + _libMpv?.Stop(); + _abortPlay = true; + } + + private void VoicePreviewList_Shown(object sender, EventArgs e) + { + if (LibMpvDynamic.IsInstalled) + { + _libMpv = new LibMpvDynamic(); + _mpvDoneTimer = new Timer(); + _mpvDoneTimer.Interval = 100; + _mpvDoneTimer.Tick += (o, args) => + { + if (listView1.SelectedItems.Count == 0) + { + return; + } + + var idx = listView1.SelectedItems[0].Index; + if (_libMpv.IsPaused && _libMpv.CurrentPosition > _libMpv.Duration - 1) + { + _mpvDoneTimer.Stop(); + PlayNext(idx); + } + }; + } + } + + private void listView1_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Space || e.KeyCode == Keys.P || e.KeyCode == Keys.Play) + { + e.SuppressKeyPress = true; + TaskDelayHelper.RunDelayed(TimeSpan.FromMilliseconds(1), () => Play()); + } + } + + private void buttonReGenerate_Click(object sender, EventArgs e) + { + if (listView1.SelectedItems.Count == 0) + { + return; + } + + var idx = listView1.SelectedItems[0].Index; + using (var form = new RegenerateAudioClip(_textToSpeech, _subtitle, idx)) + { + var dr = form.ShowDialog(this); + if (dr == DialogResult.OK) + { + _fileNames[idx] = form.NewAudioFileName; + listView1.Items[idx].SubItems[4].Text = _subtitle.Paragraphs[idx].Text; + Play(true); + } + } + } + } +} diff --git a/src/ui/Forms/Tts/ReviewAudioClips.resx b/src/ui/Forms/Tts/ReviewAudioClips.resx new file mode 100644 index 000000000..1af7de150 --- /dev/null +++ b/src/ui/Forms/Tts/ReviewAudioClips.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/src/ui/Forms/Tts/TextToSpeech.Designer.cs b/src/ui/Forms/Tts/TextToSpeech.Designer.cs index 3ff3d44bb..fa33f5a00 100644 --- a/src/ui/Forms/Tts/TextToSpeech.Designer.cs +++ b/src/ui/Forms/Tts/TextToSpeech.Designer.cs @@ -35,19 +35,20 @@ this.progressBar1 = new System.Windows.Forms.ProgressBar(); this.labelEngine = new System.Windows.Forms.Label(); this.groupBoxMsSettings = new System.Windows.Forms.GroupBox(); + this.checkBoxShowPreview = new System.Windows.Forms.CheckBox(); this.labelApiKey = new System.Windows.Forms.Label(); - this.nikseTextBoxApiKey = new Nikse.SubtitleEdit.Controls.NikseTextBox(); - this.TextBoxTest = new Nikse.SubtitleEdit.Controls.NikseTextBox(); this.buttonTestVoice = new System.Windows.Forms.Button(); this.checkBoxAddToVideoFile = new System.Windows.Forms.CheckBox(); this.labelVoice = new System.Windows.Forms.Label(); - this.nikseComboBoxVoice = new Nikse.SubtitleEdit.Controls.NikseComboBox(); - this.nikseComboBoxEngine = new Nikse.SubtitleEdit.Controls.NikseComboBox(); this.listViewActors = new System.Windows.Forms.ListView(); this.columnHeaderActor = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeaderVoice = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.contextMenuStripActors = new System.Windows.Forms.ContextMenuStrip(this.components); this.labelActors = new System.Windows.Forms.Label(); + this.nikseTextBoxApiKey = new Nikse.SubtitleEdit.Controls.NikseTextBox(); + this.TextBoxTest = new Nikse.SubtitleEdit.Controls.NikseTextBox(); + this.nikseComboBoxVoice = new Nikse.SubtitleEdit.Controls.NikseComboBox(); + this.nikseComboBoxEngine = new Nikse.SubtitleEdit.Controls.NikseComboBox(); this.groupBoxMsSettings.SuspendLayout(); this.SuspendLayout(); // @@ -109,6 +110,7 @@ // this.groupBoxMsSettings.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); + this.groupBoxMsSettings.Controls.Add(this.checkBoxShowPreview); this.groupBoxMsSettings.Controls.Add(this.labelApiKey); this.groupBoxMsSettings.Controls.Add(this.nikseTextBoxApiKey); this.groupBoxMsSettings.Controls.Add(this.TextBoxTest); @@ -125,6 +127,19 @@ this.groupBoxMsSettings.TabStop = false; this.groupBoxMsSettings.Text = "Settings"; // + // checkBoxShowPreview + // + this.checkBoxShowPreview.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.checkBoxShowPreview.AutoSize = true; + this.checkBoxShowPreview.Checked = true; + this.checkBoxShowPreview.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxShowPreview.Location = new System.Drawing.Point(17, 350); + this.checkBoxShowPreview.Name = "checkBoxShowPreview"; + this.checkBoxShowPreview.Size = new System.Drawing.Size(115, 17); + this.checkBoxShowPreview.TabIndex = 25; + this.checkBoxShowPreview.Text = "Review audio clips"; + this.checkBoxShowPreview.UseVisualStyleBackColor = true; + // // labelApiKey // this.labelApiKey.AutoSize = true; @@ -135,28 +150,6 @@ this.labelApiKey.TabIndex = 28; this.labelApiKey.Text = "API key"; // - // nikseTextBoxApiKey - // - this.nikseTextBoxApiKey.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.nikseTextBoxApiKey.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); - this.nikseTextBoxApiKey.Location = new System.Drawing.Point(17, 258); - this.nikseTextBoxApiKey.Name = "nikseTextBoxApiKey"; - this.nikseTextBoxApiKey.Size = new System.Drawing.Size(351, 20); - this.nikseTextBoxApiKey.TabIndex = 27; - // - // TextBoxTest - // - this.TextBoxTest.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.TextBoxTest.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); - this.TextBoxTest.Location = new System.Drawing.Point(17, 187); - this.TextBoxTest.Name = "TextBoxTest"; - this.TextBoxTest.Size = new System.Drawing.Size(351, 20); - this.TextBoxTest.TabIndex = 20; - this.TextBoxTest.Text = "Hello, how are you?"; - this.TextBoxTest.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TextBoxTest_KeyDown); - // // buttonTestVoice // this.buttonTestVoice.Location = new System.Drawing.Point(17, 158); @@ -190,6 +183,72 @@ this.labelVoice.TabIndex = 16; this.labelVoice.Text = "Voice"; // + // listViewActors + // + this.listViewActors.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.listViewActors.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeaderActor, + this.columnHeaderVoice}); + this.listViewActors.ContextMenuStrip = this.contextMenuStripActors; + this.listViewActors.FullRowSelect = true; + this.listViewActors.GridLines = true; + this.listViewActors.HideSelection = false; + this.listViewActors.Location = new System.Drawing.Point(412, 42); + this.listViewActors.Name = "listViewActors"; + this.listViewActors.Size = new System.Drawing.Size(430, 375); + this.listViewActors.TabIndex = 40; + this.listViewActors.UseCompatibleStateImageBehavior = false; + this.listViewActors.View = System.Windows.Forms.View.Details; + // + // columnHeaderActor + // + this.columnHeaderActor.Text = "Actor"; + this.columnHeaderActor.Width = 200; + // + // columnHeaderVoice + // + this.columnHeaderVoice.Text = "Voice"; + this.columnHeaderVoice.Width = 200; + // + // contextMenuStripActors + // + this.contextMenuStripActors.Name = "contextMenuStripActors"; + this.contextMenuStripActors.Size = new System.Drawing.Size(61, 4); + // + // labelActors + // + this.labelActors.AutoSize = true; + this.labelActors.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.labelActors.Location = new System.Drawing.Point(412, 20); + this.labelActors.Name = "labelActors"; + this.labelActors.Size = new System.Drawing.Size(170, 13); + this.labelActors.TabIndex = 19; + this.labelActors.Text = "Right-click to assign actor to voice"; + // + // nikseTextBoxApiKey + // + this.nikseTextBoxApiKey.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.nikseTextBoxApiKey.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.nikseTextBoxApiKey.Location = new System.Drawing.Point(17, 258); + this.nikseTextBoxApiKey.Name = "nikseTextBoxApiKey"; + this.nikseTextBoxApiKey.Size = new System.Drawing.Size(351, 20); + this.nikseTextBoxApiKey.TabIndex = 27; + // + // TextBoxTest + // + this.TextBoxTest.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.TextBoxTest.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.TextBoxTest.Location = new System.Drawing.Point(17, 187); + this.TextBoxTest.Name = "TextBoxTest"; + this.TextBoxTest.Size = new System.Drawing.Size(351, 20); + this.TextBoxTest.TabIndex = 20; + this.TextBoxTest.Text = "Hello, how are you?"; + this.TextBoxTest.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TextBoxTest_KeyDown); + // // nikseComboBoxVoice // this.nikseComboBoxVoice.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) @@ -243,50 +302,6 @@ this.nikseComboBoxEngine.UsePopupWindow = false; this.nikseComboBoxEngine.SelectedIndexChanged += new System.EventHandler(this.nikseComboBoxEngine_SelectedIndexChanged); // - // listViewActors - // - this.listViewActors.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.listViewActors.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.columnHeaderActor, - this.columnHeaderVoice}); - this.listViewActors.ContextMenuStrip = this.contextMenuStripActors; - this.listViewActors.FullRowSelect = true; - this.listViewActors.GridLines = true; - this.listViewActors.HideSelection = false; - this.listViewActors.Location = new System.Drawing.Point(412, 42); - this.listViewActors.Name = "listViewActors"; - this.listViewActors.Size = new System.Drawing.Size(430, 375); - this.listViewActors.TabIndex = 40; - this.listViewActors.UseCompatibleStateImageBehavior = false; - this.listViewActors.View = System.Windows.Forms.View.Details; - // - // columnHeaderActor - // - this.columnHeaderActor.Text = "Actor"; - this.columnHeaderActor.Width = 200; - // - // columnHeaderVoice - // - this.columnHeaderVoice.Text = "Voice"; - this.columnHeaderVoice.Width = 200; - // - // contextMenuStripActors - // - this.contextMenuStripActors.Name = "contextMenuStripActors"; - this.contextMenuStripActors.Size = new System.Drawing.Size(61, 4); - // - // labelActors - // - this.labelActors.AutoSize = true; - this.labelActors.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.labelActors.Location = new System.Drawing.Point(412, 20); - this.labelActors.Name = "labelActors"; - this.labelActors.Size = new System.Drawing.Size(170, 13); - this.labelActors.TabIndex = 19; - this.labelActors.Text = "Right-click to assign actor to voice"; - // // TextToSpeech // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -338,5 +353,6 @@ private System.Windows.Forms.Label labelActors; private System.Windows.Forms.Label labelApiKey; private Controls.NikseTextBox nikseTextBoxApiKey; + private System.Windows.Forms.CheckBox checkBoxShowPreview; } } \ No newline at end of file diff --git a/src/ui/Forms/Tts/TextToSpeech.cs b/src/ui/Forms/Tts/TextToSpeech.cs index 1b8d5cfb6..04017fe44 100644 --- a/src/ui/Forms/Tts/TextToSpeech.cs +++ b/src/ui/Forms/Tts/TextToSpeech.cs @@ -14,6 +14,7 @@ using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; +using Nikse.SubtitleEdit.Controls; using MessageBox = Nikse.SubtitleEdit.Forms.SeMsgBox.MessageBox; namespace Nikse.SubtitleEdit.Forms.Tts @@ -29,7 +30,8 @@ namespace Nikse.SubtitleEdit.Forms.Tts private bool _abort; private readonly List _actors; private readonly List _engines; - private readonly List _elevelLabVoices; + private readonly List _elevenLabVoices; + private bool _actorsOn; public class ActorAndVoice { @@ -68,11 +70,11 @@ namespace Nikse.SubtitleEdit.Forms.Tts InitializeComponent(); UiUtil.FixFonts(this); - _subtitle = subtitle; + _subtitle = new Subtitle(subtitle, false); _subtitleFormat = subtitleFormat; _videoFileName = videoFileName; _videoInfo = videoInfo; - _elevelLabVoices = new List(); + _elevenLabVoices = new List(); _actors = _subtitle.Paragraphs .Where(p => !string.IsNullOrEmpty(p.Actor)) .Select(p => p.Actor) @@ -135,6 +137,8 @@ namespace Nikse.SubtitleEdit.Forms.Tts MinimumSize = new Size(w, MinimumSize.Height); Width = w; } + + nikseComboBoxVoice.Text = Configuration.Settings.Tools.TextToSpeechLastVoice; } private void SetActor(ActorAndVoice actor) @@ -196,6 +200,25 @@ namespace Nikse.SubtitleEdit.Forms.Tts return; } + if (checkBoxShowPreview.Checked) + { + using (var form = new ReviewAudioClips(this, _subtitle, fileNames)) + { + var dr = form.ShowDialog(this); + if (dr != DialogResult.OK) + { + _abort = true; + HandleAbort(); + return; + } + + foreach (var idx in form.SkipIndices) + { + fileNames[idx] = null; // skip these files + } + } + } + var tempAudioFile = MergeAudioParagraphs(fileNames); if (_abort) { @@ -778,8 +801,6 @@ namespace Nikse.SubtitleEdit.Forms.Tts } var httpClient = new HttpClient(); - //httpClient.BaseAddress = new Uri("https://api.elevenlabs.io/v1/text-to-speech/"); - httpClient.DefaultRequestHeaders.TryAddWithoutValidation("Content-Type", "application/json"); httpClient.DefaultRequestHeaders.TryAddWithoutValidation("accept", "audio/mpeg"); httpClient.DefaultRequestHeaders.TryAddWithoutValidation("xi-api-key", nikseTextBoxApiKey.Text.Trim()); @@ -788,7 +809,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts progressBar1.Maximum = subtitle.Paragraphs.Count; progressBar1.Visible = showProgressBar; - var voices = _elevelLabVoices; + var voices = _elevenLabVoices; var v = nikseComboBoxVoice.Text; for (var index = 0; index < subtitle.Paragraphs.Count; index++) @@ -920,12 +941,12 @@ namespace Nikse.SubtitleEdit.Forms.Tts labelApiKey.Visible = true; nikseTextBoxApiKey.Visible = true; - if (_elevelLabVoices.Count == 0) + if (_elevenLabVoices.Count == 0) { - _elevelLabVoices.AddRange(GetElevelLabVoices()); + _elevenLabVoices.AddRange(GetElevelLabVoices()); } - foreach (var voice in _elevelLabVoices) + foreach (var voice in _elevenLabVoices) { nikseComboBoxVoice.Items.Add(voice.ToString()); } @@ -1002,7 +1023,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts } else if (engine.Id == TextToSpeechEngineId.ElevenLabs) { - var voices = _elevelLabVoices; + var voices = _elevenLabVoices; foreach (var voiceLanguage in voices .GroupBy(p => p.Language) .OrderBy(p => p.Key)) @@ -1063,6 +1084,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts labelActors.Visible = true; listViewActors.Visible = true; + _actorsOn = true; } } } @@ -1152,6 +1174,21 @@ namespace Nikse.SubtitleEdit.Forms.Tts listViewActors.AutoSizeLastColumn(); } + public async Task GenerateAudio(Paragraph p, string voice) + { + nikseComboBoxVoice.Text = voice; + var sub = new Subtitle(); + sub.Paragraphs.Add(p); + var waveFileNameOnly = Guid.NewGuid() + ".wav"; + var ok = await GenerateParagraphAudio(sub, false, waveFileNameOnly); + if (!ok) + { + return null; + } + + return Path.Combine(_waveFolder, waveFileNameOnly); + } + private async void buttonTestVoice_Click(object sender, EventArgs e) { try @@ -1235,6 +1272,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts } Configuration.Settings.Tools.TextToSpeechEngine = engine.Id.ToString(); + Configuration.Settings.Tools.TextToSpeechLastVoice = nikseComboBoxVoice.Text; } private void TextToSpeech_KeyDown(object sender, KeyEventArgs e) @@ -1253,5 +1291,40 @@ namespace Nikse.SubtitleEdit.Forms.Tts buttonTestVoice_Click(null, null); } } + + public string GetParagraphAudio(Paragraph paragraph) + { + if (_actorsOn) + { + var engine = _engines.First(p => p.Index == nikseComboBoxEngine.SelectedIndex); + + if (engine.Id == TextToSpeechEngineId.Piper) + { + var voices = PiperModels.GetVoices(); + var voice = voices.First(x => x.ToString() == nikseComboBoxVoice.Text); + if (_actorAndVoices.Count > 0 && !string.IsNullOrEmpty(paragraph.Actor)) + { + var f = _actorAndVoices.FirstOrDefault(x => x.Actor == paragraph.Actor); + if (f != null && !string.IsNullOrEmpty(f.Voice)) + { + return voices[f.VoiceIndex].Voice; + } + } + } + } + + return nikseComboBoxVoice.Text; + } + + public void SetCurrentVoices(NikseComboBox nikseComboBox) + { + nikseComboBox.Items.Clear(); + foreach (var voice in nikseComboBoxVoice.Items) + { + nikseComboBox.Items.Add(voice.ToString()); + } + + nikseComboBox.SelectedIndex = nikseComboBoxVoice.SelectedIndex; + } } } \ No newline at end of file diff --git a/src/ui/Logic/VideoPlayers/LibMpvDynamic.cs b/src/ui/Logic/VideoPlayers/LibMpvDynamic.cs index 90038427a..ae57320ef 100644 --- a/src/ui/Logic/VideoPlayers/LibMpvDynamic.cs +++ b/src/ui/Logic/VideoPlayers/LibMpvDynamic.cs @@ -851,9 +851,9 @@ namespace Nikse.SubtitleEdit.Logic.VideoPlayers } } Application.DoEvents(); - OnVideoLoaded?.Invoke(this, null); - Application.DoEvents(); Pause(); + Application.DoEvents(); + OnVideoLoaded?.Invoke(this, null); } public override void DisposeVideoPlayer() diff --git a/src/ui/SubtitleEdit.csproj b/src/ui/SubtitleEdit.csproj index adb7d4c66..c388c26fe 100644 --- a/src/ui/SubtitleEdit.csproj +++ b/src/ui/SubtitleEdit.csproj @@ -686,6 +686,12 @@ PiperDownload.cs + + Form + + + RegenerateAudioClip.cs + Form @@ -1416,6 +1422,12 @@ TransportStreamSubtitleChooser.cs + + Form + + + ReviewAudioClips.cs + Form @@ -1960,6 +1972,9 @@ PiperDownload.cs + + RegenerateAudioClip.cs + TextToSpeech.cs @@ -2312,6 +2327,9 @@ TransportStreamSubtitleChooser.cs + + ReviewAudioClips.cs + UnknownSubtitle.cs Designer From fcd567c5ac9b20e64cff29119a5591a0b3188072 Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Sun, 21 Apr 2024 12:09:55 +0200 Subject: [PATCH 2/8] Minor fixes for #8210 - thx Leon :) --- src/ui/Forms/GenerateVideoWithHardSubs.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/ui/Forms/GenerateVideoWithHardSubs.cs b/src/ui/Forms/GenerateVideoWithHardSubs.cs index a7cc847b2..6ea7b209f 100644 --- a/src/ui/Forms/GenerateVideoWithHardSubs.cs +++ b/src/ui/Forms/GenerateVideoWithHardSubs.cs @@ -42,8 +42,8 @@ namespace Nikse.SubtitleEdit.Forms public bool BatchMode { get; set; } public string BatchInfo { get; set; } private readonly List _batchVideoAndSubList; - private const int ListViewBatchSubItemIndexColumnSubtitleFile = 2; - private const int ListViewBatchSubItemIndexColumnStatus = 3; + private const int ListViewBatchSubItemIndexColumnSubtitleFile = 3; + private const int ListViewBatchSubItemIndexColumnStatus = 4; public class BatchVideoAndSub { @@ -437,6 +437,8 @@ namespace Nikse.SubtitleEdit.Forms Stopwatch stopWatch; if (BatchMode) { + listViewBatch.SelectedIndices.Clear(); + stopWatch = Stopwatch.StartNew(); var sbInfo = new StringBuilder(); sbInfo.AppendLine($"Input for convert: {_batchVideoAndSubList.Count} video files:"); @@ -469,9 +471,9 @@ namespace Nikse.SubtitleEdit.Forms } } - if (File.Exists(VideoFileName)) - { - } + listViewBatch.Items[index].Selected = true; + listViewBatch.Items[index].Focused = true; + listViewBatch.Items[index].EnsureVisible(); if (ConvertVideo(oldFontSizeEnabled, videoAndSub.VideoFileName, subtitle)) { From 0791ee5899dba99279cab9f7194f49c43880b32e Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Sun, 21 Apr 2024 12:42:07 +0200 Subject: [PATCH 3/8] Allow keeping source resolution - thx David :) Work on #8210 --- .../GenerateVideoWithHardSubs.Designer.cs | 289 +++++++++--------- src/ui/Forms/GenerateVideoWithHardSubs.cs | 15 +- 2 files changed, 163 insertions(+), 141 deletions(-) diff --git a/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs b/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs index 8cb8114da..3513e2bdc 100644 --- a/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs +++ b/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs @@ -37,20 +37,6 @@ namespace Nikse.SubtitleEdit.Forms this.buttonCancel = new System.Windows.Forms.Button(); this.timer1 = new System.Windows.Forms.Timer(this.components); this.groupBoxSettings = new System.Windows.Forms.GroupBox(); - this.listViewBatch = new System.Windows.Forms.ListView(); - this.columnHeaderVideoFile = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeaderResolution = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeaderSize = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeaderSubtitleFile = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.columnHeaderStatus = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.contextMenuStripBatch = new System.Windows.Forms.ContextMenuStrip(this.components); - this.addFilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); - this.pickSubtitleFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.removeSubtitleFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); - this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); - this.clearToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.buttonClear = new System.Windows.Forms.Button(); this.panelForeColor = new System.Windows.Forms.Panel(); this.buttonRemoveFile = new System.Windows.Forms.Button(); @@ -109,6 +95,20 @@ namespace Nikse.SubtitleEdit.Forms this.labelFileName = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.numericUpDownFontSize = new Nikse.SubtitleEdit.Controls.NikseUpDown(); this.labelFontSize = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.listViewBatch = new System.Windows.Forms.ListView(); + this.columnHeaderVideoFile = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeaderResolution = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeaderSize = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeaderSubtitleFile = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.columnHeaderStatus = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.contextMenuStripBatch = new System.Windows.Forms.ContextMenuStrip(this.components); + this.addFilesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator(); + this.pickSubtitleFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.removeSubtitleFileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); + this.deleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.clearToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.buttonPreview = new System.Windows.Forms.Button(); this.linkLabelHelp = new System.Windows.Forms.LinkLabel(); this.contextMenuStripRes = new System.Windows.Forms.ContextMenuStrip(this.components); @@ -132,12 +132,13 @@ namespace Nikse.SubtitleEdit.Forms this.labelProgress = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.labelPleaseWait = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.textBoxLog = new Nikse.SubtitleEdit.Controls.NikseTextBox(); + this.useSourceResoluton0x0ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.contextMenuStripGenerate.SuspendLayout(); this.groupBoxSettings.SuspendLayout(); - this.contextMenuStripBatch.SuspendLayout(); this.groupBoxCut.SuspendLayout(); this.groupBoxVideo.SuspendLayout(); this.groupBoxAudio.SuspendLayout(); + this.contextMenuStripBatch.SuspendLayout(); this.contextMenuStripRes.SuspendLayout(); this.SuspendLayout(); // @@ -233,115 +234,6 @@ namespace Nikse.SubtitleEdit.Forms this.groupBoxSettings.TabStop = false; this.groupBoxSettings.Text = "Settings"; // - // listViewBatch - // - this.listViewBatch.AllowDrop = true; - this.listViewBatch.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.listViewBatch.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.columnHeaderVideoFile, - this.columnHeaderResolution, - this.columnHeaderSize, - this.columnHeaderSubtitleFile, - this.columnHeaderStatus}); - this.listViewBatch.ContextMenuStrip = this.contextMenuStripBatch; - this.listViewBatch.FullRowSelect = true; - this.listViewBatch.HideSelection = false; - this.listViewBatch.Location = new System.Drawing.Point(6, 316); - this.listViewBatch.Name = "listViewBatch"; - this.listViewBatch.Size = new System.Drawing.Size(852, 191); - this.listViewBatch.TabIndex = 3; - this.listViewBatch.UseCompatibleStateImageBehavior = false; - this.listViewBatch.View = System.Windows.Forms.View.Details; - this.listViewBatch.DragDrop += new System.Windows.Forms.DragEventHandler(this.listViewBatch_DragDrop); - this.listViewBatch.DragEnter += new System.Windows.Forms.DragEventHandler(this.listViewBatch_DragEnter); - this.listViewBatch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listViewBatch_KeyDown); - // - // columnHeaderVideoFile - // - this.columnHeaderVideoFile.Text = "Video file"; - this.columnHeaderVideoFile.Width = 420; - // - // columnHeaderResolution - // - this.columnHeaderResolution.Text = "Resolution"; - this.columnHeaderResolution.Width = 80; - // - // columnHeaderSize - // - this.columnHeaderSize.Text = "Size"; - this.columnHeaderSize.Width = 80; - // - // columnHeaderSubtitleFile - // - this.columnHeaderSubtitleFile.Text = "Subtitle file"; - this.columnHeaderSubtitleFile.Width = 180; - // - // columnHeaderStatus - // - this.columnHeaderStatus.Text = "Status"; - this.columnHeaderStatus.Width = 80; - // - // contextMenuStripBatch - // - this.contextMenuStripBatch.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.addFilesToolStripMenuItem, - this.toolStripSeparator2, - this.pickSubtitleFileToolStripMenuItem, - this.removeSubtitleFileToolStripMenuItem, - this.toolStripSeparator1, - this.deleteToolStripMenuItem, - this.clearToolStripMenuItem}); - this.contextMenuStripBatch.Name = "contextMenuStripBatch"; - this.contextMenuStripBatch.Size = new System.Drawing.Size(179, 126); - this.contextMenuStripBatch.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripBatch_Opening); - // - // addFilesToolStripMenuItem - // - this.addFilesToolStripMenuItem.Name = "addFilesToolStripMenuItem"; - this.addFilesToolStripMenuItem.Size = new System.Drawing.Size(178, 22); - this.addFilesToolStripMenuItem.Text = "Add video files..."; - this.addFilesToolStripMenuItem.Click += new System.EventHandler(this.addFilesToolStripMenuItem_Click); - // - // toolStripSeparator2 - // - this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(175, 6); - // - // pickSubtitleFileToolStripMenuItem - // - this.pickSubtitleFileToolStripMenuItem.Name = "pickSubtitleFileToolStripMenuItem"; - this.pickSubtitleFileToolStripMenuItem.Size = new System.Drawing.Size(178, 22); - this.pickSubtitleFileToolStripMenuItem.Text = "Pick subtitle file..."; - this.pickSubtitleFileToolStripMenuItem.Click += new System.EventHandler(this.pickSubtitleFileToolStripMenuItem_Click); - // - // removeSubtitleFileToolStripMenuItem - // - this.removeSubtitleFileToolStripMenuItem.Name = "removeSubtitleFileToolStripMenuItem"; - this.removeSubtitleFileToolStripMenuItem.Size = new System.Drawing.Size(178, 22); - this.removeSubtitleFileToolStripMenuItem.Text = "Remove subtitle file"; - this.removeSubtitleFileToolStripMenuItem.Click += new System.EventHandler(this.removeSubtitleFileToolStripMenuItem_Click); - // - // toolStripSeparator1 - // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(175, 6); - // - // deleteToolStripMenuItem - // - this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem"; - this.deleteToolStripMenuItem.Size = new System.Drawing.Size(178, 22); - this.deleteToolStripMenuItem.Text = "Delete"; - this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click); - // - // clearToolStripMenuItem - // - this.clearToolStripMenuItem.Name = "clearToolStripMenuItem"; - this.clearToolStripMenuItem.Size = new System.Drawing.Size(178, 22); - this.clearToolStripMenuItem.Text = "Clear"; - this.clearToolStripMenuItem.Click += new System.EventHandler(this.clearToolStripMenuItem_Click); - // // buttonClear // this.buttonClear.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); @@ -1397,6 +1289,115 @@ namespace Nikse.SubtitleEdit.Forms this.labelFontSize.TabIndex = 0; this.labelFontSize.Text = "Font size"; // + // listViewBatch + // + this.listViewBatch.AllowDrop = true; + this.listViewBatch.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.listViewBatch.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeaderVideoFile, + this.columnHeaderResolution, + this.columnHeaderSize, + this.columnHeaderSubtitleFile, + this.columnHeaderStatus}); + this.listViewBatch.ContextMenuStrip = this.contextMenuStripBatch; + this.listViewBatch.FullRowSelect = true; + this.listViewBatch.HideSelection = false; + this.listViewBatch.Location = new System.Drawing.Point(6, 316); + this.listViewBatch.Name = "listViewBatch"; + this.listViewBatch.Size = new System.Drawing.Size(852, 191); + this.listViewBatch.TabIndex = 3; + this.listViewBatch.UseCompatibleStateImageBehavior = false; + this.listViewBatch.View = System.Windows.Forms.View.Details; + this.listViewBatch.DragDrop += new System.Windows.Forms.DragEventHandler(this.listViewBatch_DragDrop); + this.listViewBatch.DragEnter += new System.Windows.Forms.DragEventHandler(this.listViewBatch_DragEnter); + this.listViewBatch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listViewBatch_KeyDown); + // + // columnHeaderVideoFile + // + this.columnHeaderVideoFile.Text = "Video file"; + this.columnHeaderVideoFile.Width = 420; + // + // columnHeaderResolution + // + this.columnHeaderResolution.Text = "Resolution"; + this.columnHeaderResolution.Width = 80; + // + // columnHeaderSize + // + this.columnHeaderSize.Text = "Size"; + this.columnHeaderSize.Width = 80; + // + // columnHeaderSubtitleFile + // + this.columnHeaderSubtitleFile.Text = "Subtitle file"; + this.columnHeaderSubtitleFile.Width = 180; + // + // columnHeaderStatus + // + this.columnHeaderStatus.Text = "Status"; + this.columnHeaderStatus.Width = 80; + // + // contextMenuStripBatch + // + this.contextMenuStripBatch.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.addFilesToolStripMenuItem, + this.toolStripSeparator2, + this.pickSubtitleFileToolStripMenuItem, + this.removeSubtitleFileToolStripMenuItem, + this.toolStripSeparator1, + this.deleteToolStripMenuItem, + this.clearToolStripMenuItem}); + this.contextMenuStripBatch.Name = "contextMenuStripBatch"; + this.contextMenuStripBatch.Size = new System.Drawing.Size(179, 126); + this.contextMenuStripBatch.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripBatch_Opening); + // + // addFilesToolStripMenuItem + // + this.addFilesToolStripMenuItem.Name = "addFilesToolStripMenuItem"; + this.addFilesToolStripMenuItem.Size = new System.Drawing.Size(178, 22); + this.addFilesToolStripMenuItem.Text = "Add video files..."; + this.addFilesToolStripMenuItem.Click += new System.EventHandler(this.addFilesToolStripMenuItem_Click); + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(175, 6); + // + // pickSubtitleFileToolStripMenuItem + // + this.pickSubtitleFileToolStripMenuItem.Name = "pickSubtitleFileToolStripMenuItem"; + this.pickSubtitleFileToolStripMenuItem.Size = new System.Drawing.Size(178, 22); + this.pickSubtitleFileToolStripMenuItem.Text = "Pick subtitle file..."; + this.pickSubtitleFileToolStripMenuItem.Click += new System.EventHandler(this.pickSubtitleFileToolStripMenuItem_Click); + // + // removeSubtitleFileToolStripMenuItem + // + this.removeSubtitleFileToolStripMenuItem.Name = "removeSubtitleFileToolStripMenuItem"; + this.removeSubtitleFileToolStripMenuItem.Size = new System.Drawing.Size(178, 22); + this.removeSubtitleFileToolStripMenuItem.Text = "Remove subtitle file"; + this.removeSubtitleFileToolStripMenuItem.Click += new System.EventHandler(this.removeSubtitleFileToolStripMenuItem_Click); + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(175, 6); + // + // deleteToolStripMenuItem + // + this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem"; + this.deleteToolStripMenuItem.Size = new System.Drawing.Size(178, 22); + this.deleteToolStripMenuItem.Text = "Delete"; + this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click); + // + // clearToolStripMenuItem + // + this.clearToolStripMenuItem.Name = "clearToolStripMenuItem"; + this.clearToolStripMenuItem.Size = new System.Drawing.Size(178, 22); + this.clearToolStripMenuItem.Text = "Clear"; + this.clearToolStripMenuItem.Click += new System.EventHandler(this.clearToolStripMenuItem_Click); + // // buttonPreview // this.buttonPreview.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); @@ -1423,6 +1424,7 @@ namespace Nikse.SubtitleEdit.Forms // contextMenuStripRes // this.contextMenuStripRes.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.useSourceResoluton0x0ToolStripMenuItem, this.x2160ToolStripMenuItem, this.uHD3840x2160ToolStripMenuItem, this.k2048x1080ToolStripMenuItem, @@ -1438,103 +1440,103 @@ namespace Nikse.SubtitleEdit.Forms this.x352ToolStripMenuItem, this.x272ToolStripMenuItem}); this.contextMenuStripRes.Name = "contextMenuStripRes"; - this.contextMenuStripRes.Size = new System.Drawing.Size(204, 312); + this.contextMenuStripRes.Size = new System.Drawing.Size(214, 356); // // x2160ToolStripMenuItem // this.x2160ToolStripMenuItem.Name = "x2160ToolStripMenuItem"; - this.x2160ToolStripMenuItem.Size = new System.Drawing.Size(203, 22); + this.x2160ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); this.x2160ToolStripMenuItem.Text = "4K (4096x2160)"; this.x2160ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // // uHD3840x2160ToolStripMenuItem // this.uHD3840x2160ToolStripMenuItem.Name = "uHD3840x2160ToolStripMenuItem"; - this.uHD3840x2160ToolStripMenuItem.Size = new System.Drawing.Size(203, 22); + this.uHD3840x2160ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); this.uHD3840x2160ToolStripMenuItem.Text = "UHD (3840x2160)"; this.uHD3840x2160ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // // k2048x1080ToolStripMenuItem // this.k2048x1080ToolStripMenuItem.Name = "k2048x1080ToolStripMenuItem"; - this.k2048x1080ToolStripMenuItem.Size = new System.Drawing.Size(203, 22); + this.k2048x1080ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); this.k2048x1080ToolStripMenuItem.Text = "2K (2048x1080)"; this.k2048x1080ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // // dCI2KScope2048x858ToolStripMenuItem // this.dCI2KScope2048x858ToolStripMenuItem.Name = "dCI2KScope2048x858ToolStripMenuItem"; - this.dCI2KScope2048x858ToolStripMenuItem.Size = new System.Drawing.Size(203, 22); + this.dCI2KScope2048x858ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); this.dCI2KScope2048x858ToolStripMenuItem.Text = "DCI 2K Scope (2048x858)"; this.dCI2KScope2048x858ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // // dCI2KFlat1998x1080ToolStripMenuItem // this.dCI2KFlat1998x1080ToolStripMenuItem.Name = "dCI2KFlat1998x1080ToolStripMenuItem"; - this.dCI2KFlat1998x1080ToolStripMenuItem.Size = new System.Drawing.Size(203, 22); + this.dCI2KFlat1998x1080ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); this.dCI2KFlat1998x1080ToolStripMenuItem.Text = "DCI 2K Flat (1998x1080)"; this.dCI2KFlat1998x1080ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // // p1920x1080ToolStripMenuItem // this.p1920x1080ToolStripMenuItem.Name = "p1920x1080ToolStripMenuItem"; - this.p1920x1080ToolStripMenuItem.Size = new System.Drawing.Size(203, 22); + this.p1920x1080ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); this.p1920x1080ToolStripMenuItem.Text = "1080p (1920x1080)"; this.p1920x1080ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // // x1080ToolStripMenuItem // this.x1080ToolStripMenuItem.Name = "x1080ToolStripMenuItem"; - this.x1080ToolStripMenuItem.Size = new System.Drawing.Size(203, 22); + this.x1080ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); this.x1080ToolStripMenuItem.Text = "1440x1080"; this.x1080ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // // p1280x720ToolStripMenuItem // this.p1280x720ToolStripMenuItem.Name = "p1280x720ToolStripMenuItem"; - this.p1280x720ToolStripMenuItem.Size = new System.Drawing.Size(203, 22); + this.p1280x720ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); this.p1280x720ToolStripMenuItem.Text = "720p (1280x720)"; this.p1280x720ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // // x720ToolStripMenuItem // this.x720ToolStripMenuItem.Name = "x720ToolStripMenuItem"; - this.x720ToolStripMenuItem.Size = new System.Drawing.Size(203, 22); + this.x720ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); this.x720ToolStripMenuItem.Text = "960x720"; this.x720ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // // p848x480ToolStripMenuItem // this.p848x480ToolStripMenuItem.Name = "p848x480ToolStripMenuItem"; - this.p848x480ToolStripMenuItem.Size = new System.Drawing.Size(203, 22); + this.p848x480ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); this.p848x480ToolStripMenuItem.Text = "480p (848x480)"; this.p848x480ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // // pAL720x576ToolStripMenuItem // this.pAL720x576ToolStripMenuItem.Name = "pAL720x576ToolStripMenuItem"; - this.pAL720x576ToolStripMenuItem.Size = new System.Drawing.Size(203, 22); + this.pAL720x576ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); this.pAL720x576ToolStripMenuItem.Text = "PAL (720x576)"; this.pAL720x576ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // // nTSC720x480ToolStripMenuItem // this.nTSC720x480ToolStripMenuItem.Name = "nTSC720x480ToolStripMenuItem"; - this.nTSC720x480ToolStripMenuItem.Size = new System.Drawing.Size(203, 22); + this.nTSC720x480ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); this.nTSC720x480ToolStripMenuItem.Text = "NTSC (720x480)"; this.nTSC720x480ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // // x352ToolStripMenuItem // this.x352ToolStripMenuItem.Name = "x352ToolStripMenuItem"; - this.x352ToolStripMenuItem.Size = new System.Drawing.Size(203, 22); + this.x352ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); this.x352ToolStripMenuItem.Text = "640x352"; this.x352ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // // x272ToolStripMenuItem // this.x272ToolStripMenuItem.Name = "x272ToolStripMenuItem"; - this.x272ToolStripMenuItem.Size = new System.Drawing.Size(203, 22); + this.x272ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); this.x272ToolStripMenuItem.Text = "640x272"; this.x272ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // @@ -1600,6 +1602,12 @@ namespace Nikse.SubtitleEdit.Forms this.textBoxLog.Size = new System.Drawing.Size(188, 26); this.textBoxLog.TabIndex = 31; // + // useSourceResoluton0x0ToolStripMenuItem + // + this.useSourceResoluton0x0ToolStripMenuItem.Name = "useSourceResoluton0x0ToolStripMenuItem"; + this.useSourceResoluton0x0ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.useSourceResoluton0x0ToolStripMenuItem.Text = "Use source resoluton (0x0)"; + // // GenerateVideoWithHardSubs // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -1631,13 +1639,13 @@ namespace Nikse.SubtitleEdit.Forms this.contextMenuStripGenerate.ResumeLayout(false); this.groupBoxSettings.ResumeLayout(false); this.groupBoxSettings.PerformLayout(); - this.contextMenuStripBatch.ResumeLayout(false); this.groupBoxCut.ResumeLayout(false); this.groupBoxCut.PerformLayout(); this.groupBoxVideo.ResumeLayout(false); this.groupBoxVideo.PerformLayout(); this.groupBoxAudio.ResumeLayout(false); this.groupBoxAudio.PerformLayout(); + this.contextMenuStripBatch.ResumeLayout(false); this.contextMenuStripRes.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -1748,5 +1756,6 @@ namespace Nikse.SubtitleEdit.Forms private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; private System.Windows.Forms.ToolStripMenuItem removeSubtitleFileToolStripMenuItem; private System.Windows.Forms.ColumnHeader columnHeaderResolution; + private System.Windows.Forms.ToolStripMenuItem useSourceResoluton0x0ToolStripMenuItem; } } \ No newline at end of file diff --git a/src/ui/Forms/GenerateVideoWithHardSubs.cs b/src/ui/Forms/GenerateVideoWithHardSubs.cs index 6ea7b209f..ddf436a05 100644 --- a/src/ui/Forms/GenerateVideoWithHardSubs.cs +++ b/src/ui/Forms/GenerateVideoWithHardSubs.cs @@ -316,9 +316,12 @@ namespace Nikse.SubtitleEdit.Forms buttonAddFile.Visible = BatchMode; var audioTracks = _mediaInfo.Tracks.Where(p => p.TrackType == FfmpegTrackType.Audio).ToList(); + useSourceResoluton0x0ToolStripMenuItem.Visible = BatchMode; if (BatchMode) { listViewAudioTracks.Visible = false; + numericUpDownWidth.Value = 0; + numericUpDownHeight.Value = 0; } else if (audioTracks.Count > 1) { @@ -437,6 +440,7 @@ namespace Nikse.SubtitleEdit.Forms Stopwatch stopWatch; if (BatchMode) { + var useSourceResolution = numericUpDownWidth.Value == 0 && numericUpDownHeight.Value == 0; listViewBatch.SelectedIndices.Clear(); stopWatch = Stopwatch.StartNew(); @@ -449,6 +453,12 @@ namespace Nikse.SubtitleEdit.Forms { var videoAndSub = _batchVideoAndSubList[index]; _videoInfo = UiUtil.GetVideoInfo(videoAndSub.VideoFileName); + if (useSourceResolution) + { + numericUpDownWidth.Value = _videoInfo.Width; + numericUpDownHeight.Value = _videoInfo.Height; + } + var subtitle = new Subtitle(); if (!string.IsNullOrEmpty(videoAndSub.SubtitleFileName) & File.Exists(videoAndSub.SubtitleFileName)) { @@ -705,7 +715,10 @@ namespace Nikse.SubtitleEdit.Forms fileName += ".burn-in"; - fileName += $".{numericUpDownWidth.Value}x{numericUpDownHeight.Value}"; + if (numericUpDownWidth.Value > 0 && numericUpDownHeight.Value > 0) + { + fileName += $".{numericUpDownWidth.Value}x{numericUpDownHeight.Value}"; + } if (comboBoxVideoEncoding.Text == "libx265" || comboBoxVideoEncoding.Text == "hevc_nvenc" || comboBoxVideoEncoding.Text == "hevc_amf") { From 6fadc4a81fb4e435ae179b605ae54348f2039c7a Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Sun, 21 Apr 2024 13:07:17 +0200 Subject: [PATCH 4/8] Add output file suffix - thx Leon :) Related to #8210 --- .../GenerateVideoWithHardSubs.Designer.cs | 986 +++++++++--------- src/ui/Forms/GenerateVideoWithHardSubs.cs | 24 +- 2 files changed, 524 insertions(+), 486 deletions(-) diff --git a/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs b/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs index 3513e2bdc..6d768312e 100644 --- a/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs +++ b/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs @@ -44,57 +44,20 @@ namespace Nikse.SubtitleEdit.Forms this.buttonAddFile = new System.Windows.Forms.Button(); this.panelOutlineColor = new System.Windows.Forms.Panel(); this.buttonOutlineColor = new System.Windows.Forms.Button(); - this.videoPlayerContainer1 = new Nikse.SubtitleEdit.Controls.VideoPlayerContainer(); this.groupBoxCut = new System.Windows.Forms.GroupBox(); this.buttonCutTo = new System.Windows.Forms.Button(); this.buttonCutFrom = new System.Windows.Forms.Button(); - this.numericUpDownCutToSeconds = new Nikse.SubtitleEdit.Controls.NikseUpDown(); - this.numericUpDownCutToMinutes = new Nikse.SubtitleEdit.Controls.NikseUpDown(); - this.numericUpDownCutToHours = new Nikse.SubtitleEdit.Controls.NikseUpDown(); - this.numericUpDownCutFromSeconds = new Nikse.SubtitleEdit.Controls.NikseUpDown(); - this.numericUpDownCutFromMinutes = new Nikse.SubtitleEdit.Controls.NikseUpDown(); - this.numericUpDownCutFromHours = new Nikse.SubtitleEdit.Controls.NikseUpDown(); - this.labelCutTo = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.labelCutFrom = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.checkBoxCut = new System.Windows.Forms.CheckBox(); - this.labelVideoBitrate = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.checkBoxBox = new System.Windows.Forms.CheckBox(); this.checkBoxAlignRight = new System.Windows.Forms.CheckBox(); - this.labelInfo = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.checkBoxRightToLeft = new System.Windows.Forms.CheckBox(); - this.comboBoxSubtitleFont = new Nikse.SubtitleEdit.Controls.NikseComboBox(); - this.labelSubtitleFont = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.groupBoxVideo = new System.Windows.Forms.GroupBox(); - this.labelCrfHint = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.buttonVideoChooseStandardRes = new System.Windows.Forms.Button(); - this.labelResolution = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.numericUpDownWidth = new Nikse.SubtitleEdit.Controls.NikseUpDown(); - this.numericUpDownHeight = new Nikse.SubtitleEdit.Controls.NikseUpDown(); - this.labelX = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.labelPreset = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.comboBoxTune = new Nikse.SubtitleEdit.Controls.NikseComboBox(); - this.comboBoxPreset = new Nikse.SubtitleEdit.Controls.NikseComboBox(); - this.labelTune = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.labelCRF = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.comboBoxVideoEncoding = new Nikse.SubtitleEdit.Controls.NikseComboBox(); - this.comboBoxCrf = new Nikse.SubtitleEdit.Controls.NikseComboBox(); - this.labelVideoEncoding = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.groupBoxAudio = new System.Windows.Forms.GroupBox(); this.listViewAudioTracks = new System.Windows.Forms.ListView(); this.columnHeaderAudioTrack = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); - this.labelAudioEnc = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.comboBoxAudioBitRate = new Nikse.SubtitleEdit.Controls.NikseComboBox(); - this.comboBoxAudioEnc = new Nikse.SubtitleEdit.Controls.NikseComboBox(); - this.labelAudioBitRate = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.checkBoxMakeStereo = new System.Windows.Forms.CheckBox(); - this.labelAudioSampleRate = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.comboBoxAudioSampleRate = new Nikse.SubtitleEdit.Controls.NikseComboBox(); - this.numericUpDownTargetFileSize = new Nikse.SubtitleEdit.Controls.NikseUpDown(); - this.labelFileSize = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.checkBoxTargetFileSize = new System.Windows.Forms.CheckBox(); - this.labelFileName = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.numericUpDownFontSize = new Nikse.SubtitleEdit.Controls.NikseUpDown(); - this.labelFontSize = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.listViewBatch = new System.Windows.Forms.ListView(); this.columnHeaderVideoFile = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeaderResolution = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); @@ -127,12 +90,51 @@ namespace Nikse.SubtitleEdit.Forms this.x352ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.x272ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.buttonMode = new System.Windows.Forms.Button(); + this.useSourceResoluton0x0ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.labelPreviewPleaseWait = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.videoPlayerContainer1 = new Nikse.SubtitleEdit.Controls.VideoPlayerContainer(); + this.numericUpDownCutToSeconds = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.numericUpDownCutToMinutes = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.numericUpDownCutToHours = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.numericUpDownCutFromSeconds = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.numericUpDownCutFromMinutes = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.numericUpDownCutFromHours = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.labelCutTo = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.labelCutFrom = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.labelVideoBitrate = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.labelInfo = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.comboBoxSubtitleFont = new Nikse.SubtitleEdit.Controls.NikseComboBox(); + this.labelSubtitleFont = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.labelCrfHint = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.labelResolution = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.numericUpDownWidth = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.numericUpDownHeight = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.labelX = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.labelPreset = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.comboBoxTune = new Nikse.SubtitleEdit.Controls.NikseComboBox(); + this.comboBoxPreset = new Nikse.SubtitleEdit.Controls.NikseComboBox(); + this.labelTune = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.labelCRF = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.comboBoxVideoEncoding = new Nikse.SubtitleEdit.Controls.NikseComboBox(); + this.comboBoxCrf = new Nikse.SubtitleEdit.Controls.NikseComboBox(); + this.labelVideoEncoding = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.labelAudioEnc = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.comboBoxAudioBitRate = new Nikse.SubtitleEdit.Controls.NikseComboBox(); + this.comboBoxAudioEnc = new Nikse.SubtitleEdit.Controls.NikseComboBox(); + this.labelAudioBitRate = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.labelAudioSampleRate = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.comboBoxAudioSampleRate = new Nikse.SubtitleEdit.Controls.NikseComboBox(); + this.numericUpDownTargetFileSize = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.labelFileSize = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.labelFileName = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.numericUpDownFontSize = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.labelFontSize = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.labelPass = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.labelProgress = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.labelPleaseWait = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.textBoxLog = new Nikse.SubtitleEdit.Controls.NikseTextBox(); - this.useSourceResoluton0x0ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.nikseLabelSuffix = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.nikseTextBoxSuffix = new Nikse.SubtitleEdit.Controls.NikseTextBox(); this.contextMenuStripGenerate.SuspendLayout(); this.groupBoxSettings.SuspendLayout(); this.groupBoxCut.SuspendLayout(); @@ -202,6 +204,8 @@ namespace Nikse.SubtitleEdit.Forms this.groupBoxSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxSettings.Controls.Add(this.nikseTextBoxSuffix); + this.groupBoxSettings.Controls.Add(this.nikseLabelSuffix); this.groupBoxSettings.Controls.Add(this.buttonClear); this.groupBoxSettings.Controls.Add(this.panelForeColor); this.groupBoxSettings.Controls.Add(this.buttonRemoveFile); @@ -305,31 +309,6 @@ namespace Nikse.SubtitleEdit.Forms this.buttonOutlineColor.UseVisualStyleBackColor = true; this.buttonOutlineColor.Click += new System.EventHandler(this.buttonOutlineColor_Click); // - // videoPlayerContainer1 - // - this.videoPlayerContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.videoPlayerContainer1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(18)))), ((int)(((byte)(18)))), ((int)(((byte)(18))))); - this.videoPlayerContainer1.Chapters = null; - this.videoPlayerContainer1.CurrentPosition = 0D; - this.videoPlayerContainer1.FontSizeFactor = 1F; - this.videoPlayerContainer1.LastParagraph = null; - this.videoPlayerContainer1.Location = new System.Drawing.Point(430, 313); - this.videoPlayerContainer1.Name = "videoPlayerContainer1"; - this.videoPlayerContainer1.ShowFullscreenButton = true; - this.videoPlayerContainer1.ShowMuteButton = true; - this.videoPlayerContainer1.ShowStopButton = true; - this.videoPlayerContainer1.Size = new System.Drawing.Size(431, 226); - this.videoPlayerContainer1.SubtitleText = ""; - this.videoPlayerContainer1.TabIndex = 110; - this.videoPlayerContainer1.TextRightToLeft = System.Windows.Forms.RightToLeft.No; - this.videoPlayerContainer1.UsingFrontCenterAudioChannelOnly = false; - this.videoPlayerContainer1.VideoHeight = 0; - this.videoPlayerContainer1.VideoPlayer = null; - this.videoPlayerContainer1.VideoWidth = 0; - this.videoPlayerContainer1.Volume = 0D; - // // groupBoxCut // this.groupBoxCut.Controls.Add(this.buttonCutTo); @@ -369,6 +348,451 @@ namespace Nikse.SubtitleEdit.Forms this.buttonCutFrom.UseVisualStyleBackColor = true; this.buttonCutFrom.Click += new System.EventHandler(this.buttonCutFrom_Click); // + // checkBoxCut + // + this.checkBoxCut.AutoSize = true; + this.checkBoxCut.Location = new System.Drawing.Point(12, 36); + this.checkBoxCut.Name = "checkBoxCut"; + this.checkBoxCut.Size = new System.Drawing.Size(42, 17); + this.checkBoxCut.TabIndex = 0; + this.checkBoxCut.Text = "Cut"; + this.checkBoxCut.UseVisualStyleBackColor = true; + this.checkBoxCut.CheckedChanged += new System.EventHandler(this.checkBoxCut_CheckedChanged); + // + // checkBoxBox + // + this.checkBoxBox.AutoSize = true; + this.checkBoxBox.Location = new System.Drawing.Point(226, 27); + this.checkBoxBox.Name = "checkBoxBox"; + this.checkBoxBox.Size = new System.Drawing.Size(44, 17); + this.checkBoxBox.TabIndex = 2; + this.checkBoxBox.Text = "Box"; + this.checkBoxBox.UseVisualStyleBackColor = true; + this.checkBoxBox.CheckedChanged += new System.EventHandler(this.checkBoxBox_CheckedChanged); + // + // checkBoxAlignRight + // + this.checkBoxAlignRight.AutoSize = true; + this.checkBoxAlignRight.Location = new System.Drawing.Point(217, 114); + this.checkBoxAlignRight.Name = "checkBoxAlignRight"; + this.checkBoxAlignRight.Size = new System.Drawing.Size(72, 17); + this.checkBoxAlignRight.TabIndex = 10; + this.checkBoxAlignRight.Text = "Align right"; + this.checkBoxAlignRight.UseVisualStyleBackColor = true; + this.checkBoxAlignRight.CheckedChanged += new System.EventHandler(this.checkBoxAlignRight_CheckedChanged); + // + // checkBoxRightToLeft + // + this.checkBoxRightToLeft.AutoSize = true; + this.checkBoxRightToLeft.Location = new System.Drawing.Point(120, 114); + this.checkBoxRightToLeft.Name = "checkBoxRightToLeft"; + this.checkBoxRightToLeft.Size = new System.Drawing.Size(80, 17); + this.checkBoxRightToLeft.TabIndex = 9; + this.checkBoxRightToLeft.Text = "Right to left"; + this.checkBoxRightToLeft.UseVisualStyleBackColor = true; + this.checkBoxRightToLeft.CheckedChanged += new System.EventHandler(this.checkBoxRightToLeft_CheckedChanged); + // + // groupBoxVideo + // + this.groupBoxVideo.Controls.Add(this.labelCrfHint); + this.groupBoxVideo.Controls.Add(this.buttonVideoChooseStandardRes); + this.groupBoxVideo.Controls.Add(this.labelResolution); + this.groupBoxVideo.Controls.Add(this.numericUpDownWidth); + this.groupBoxVideo.Controls.Add(this.numericUpDownHeight); + this.groupBoxVideo.Controls.Add(this.labelX); + this.groupBoxVideo.Controls.Add(this.labelPreset); + this.groupBoxVideo.Controls.Add(this.comboBoxTune); + this.groupBoxVideo.Controls.Add(this.comboBoxPreset); + this.groupBoxVideo.Controls.Add(this.labelTune); + this.groupBoxVideo.Controls.Add(this.labelCRF); + this.groupBoxVideo.Controls.Add(this.comboBoxVideoEncoding); + this.groupBoxVideo.Controls.Add(this.comboBoxCrf); + this.groupBoxVideo.Controls.Add(this.labelVideoEncoding); + this.groupBoxVideo.Location = new System.Drawing.Point(6, 141); + this.groupBoxVideo.Name = "groupBoxVideo"; + this.groupBoxVideo.Size = new System.Drawing.Size(406, 166); + this.groupBoxVideo.TabIndex = 70; + this.groupBoxVideo.TabStop = false; + this.groupBoxVideo.Text = "Video"; + // + // buttonVideoChooseStandardRes + // + this.buttonVideoChooseStandardRes.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.buttonVideoChooseStandardRes.Location = new System.Drawing.Point(257, 15); + this.buttonVideoChooseStandardRes.Name = "buttonVideoChooseStandardRes"; + this.buttonVideoChooseStandardRes.Size = new System.Drawing.Size(69, 23); + this.buttonVideoChooseStandardRes.TabIndex = 3; + this.buttonVideoChooseStandardRes.Text = "..."; + this.buttonVideoChooseStandardRes.UseVisualStyleBackColor = true; + this.buttonVideoChooseStandardRes.Click += new System.EventHandler(this.buttonVideoChooseStandardRes_Click); + // + // groupBoxAudio + // + this.groupBoxAudio.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxAudio.Controls.Add(this.listViewAudioTracks); + this.groupBoxAudio.Controls.Add(this.labelAudioEnc); + this.groupBoxAudio.Controls.Add(this.comboBoxAudioBitRate); + this.groupBoxAudio.Controls.Add(this.comboBoxAudioEnc); + this.groupBoxAudio.Controls.Add(this.labelAudioBitRate); + this.groupBoxAudio.Controls.Add(this.checkBoxMakeStereo); + this.groupBoxAudio.Controls.Add(this.labelAudioSampleRate); + this.groupBoxAudio.Controls.Add(this.comboBoxAudioSampleRate); + this.groupBoxAudio.Location = new System.Drawing.Point(430, 141); + this.groupBoxAudio.Name = "groupBoxAudio"; + this.groupBoxAudio.Size = new System.Drawing.Size(425, 166); + this.groupBoxAudio.TabIndex = 90; + this.groupBoxAudio.TabStop = false; + this.groupBoxAudio.Text = "Audio"; + // + // listViewAudioTracks + // + this.listViewAudioTracks.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.listViewAudioTracks.CheckBoxes = true; + this.listViewAudioTracks.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeaderAudioTrack}); + this.listViewAudioTracks.HideSelection = false; + this.listViewAudioTracks.Location = new System.Drawing.Point(229, 29); + this.listViewAudioTracks.Name = "listViewAudioTracks"; + this.listViewAudioTracks.Size = new System.Drawing.Size(190, 122); + this.listViewAudioTracks.TabIndex = 45; + this.listViewAudioTracks.UseCompatibleStateImageBehavior = false; + this.listViewAudioTracks.View = System.Windows.Forms.View.Details; + // + // columnHeaderAudioTrack + // + this.columnHeaderAudioTrack.Text = "Audio tracks"; + this.columnHeaderAudioTrack.Width = 160; + // + // checkBoxMakeStereo + // + this.checkBoxMakeStereo.AutoSize = true; + this.checkBoxMakeStereo.Checked = true; + this.checkBoxMakeStereo.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxMakeStereo.Location = new System.Drawing.Point(91, 58); + this.checkBoxMakeStereo.Name = "checkBoxMakeStereo"; + this.checkBoxMakeStereo.Size = new System.Drawing.Size(57, 17); + this.checkBoxMakeStereo.TabIndex = 2; + this.checkBoxMakeStereo.Text = "Stereo"; + this.checkBoxMakeStereo.UseVisualStyleBackColor = true; + // + // checkBoxTargetFileSize + // + this.checkBoxTargetFileSize.AutoSize = true; + this.checkBoxTargetFileSize.Location = new System.Drawing.Point(22, 327); + this.checkBoxTargetFileSize.Name = "checkBoxTargetFileSize"; + this.checkBoxTargetFileSize.Size = new System.Drawing.Size(192, 17); + this.checkBoxTargetFileSize.TabIndex = 100; + this.checkBoxTargetFileSize.Text = "Target file size (two pass encoding)"; + this.checkBoxTargetFileSize.UseVisualStyleBackColor = true; + this.checkBoxTargetFileSize.CheckedChanged += new System.EventHandler(this.checkBoxTargetFileSize_CheckedChanged); + // + // listViewBatch + // + this.listViewBatch.AllowDrop = true; + this.listViewBatch.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.listViewBatch.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeaderVideoFile, + this.columnHeaderResolution, + this.columnHeaderSize, + this.columnHeaderSubtitleFile, + this.columnHeaderStatus}); + this.listViewBatch.ContextMenuStrip = this.contextMenuStripBatch; + this.listViewBatch.FullRowSelect = true; + this.listViewBatch.HideSelection = false; + this.listViewBatch.Location = new System.Drawing.Point(6, 316); + this.listViewBatch.Name = "listViewBatch"; + this.listViewBatch.Size = new System.Drawing.Size(852, 191); + this.listViewBatch.TabIndex = 3; + this.listViewBatch.UseCompatibleStateImageBehavior = false; + this.listViewBatch.View = System.Windows.Forms.View.Details; + this.listViewBatch.DragDrop += new System.Windows.Forms.DragEventHandler(this.listViewBatch_DragDrop); + this.listViewBatch.DragEnter += new System.Windows.Forms.DragEventHandler(this.listViewBatch_DragEnter); + this.listViewBatch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listViewBatch_KeyDown); + // + // columnHeaderVideoFile + // + this.columnHeaderVideoFile.Text = "Video file"; + this.columnHeaderVideoFile.Width = 420; + // + // columnHeaderResolution + // + this.columnHeaderResolution.Text = "Resolution"; + this.columnHeaderResolution.Width = 80; + // + // columnHeaderSize + // + this.columnHeaderSize.Text = "Size"; + this.columnHeaderSize.Width = 80; + // + // columnHeaderSubtitleFile + // + this.columnHeaderSubtitleFile.Text = "Subtitle file"; + this.columnHeaderSubtitleFile.Width = 180; + // + // columnHeaderStatus + // + this.columnHeaderStatus.Text = "Status"; + this.columnHeaderStatus.Width = 80; + // + // contextMenuStripBatch + // + this.contextMenuStripBatch.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.addFilesToolStripMenuItem, + this.toolStripSeparator2, + this.pickSubtitleFileToolStripMenuItem, + this.removeSubtitleFileToolStripMenuItem, + this.toolStripSeparator1, + this.deleteToolStripMenuItem, + this.clearToolStripMenuItem}); + this.contextMenuStripBatch.Name = "contextMenuStripBatch"; + this.contextMenuStripBatch.Size = new System.Drawing.Size(179, 126); + this.contextMenuStripBatch.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripBatch_Opening); + // + // addFilesToolStripMenuItem + // + this.addFilesToolStripMenuItem.Name = "addFilesToolStripMenuItem"; + this.addFilesToolStripMenuItem.Size = new System.Drawing.Size(178, 22); + this.addFilesToolStripMenuItem.Text = "Add video files..."; + this.addFilesToolStripMenuItem.Click += new System.EventHandler(this.addFilesToolStripMenuItem_Click); + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(175, 6); + // + // pickSubtitleFileToolStripMenuItem + // + this.pickSubtitleFileToolStripMenuItem.Name = "pickSubtitleFileToolStripMenuItem"; + this.pickSubtitleFileToolStripMenuItem.Size = new System.Drawing.Size(178, 22); + this.pickSubtitleFileToolStripMenuItem.Text = "Pick subtitle file..."; + this.pickSubtitleFileToolStripMenuItem.Click += new System.EventHandler(this.pickSubtitleFileToolStripMenuItem_Click); + // + // removeSubtitleFileToolStripMenuItem + // + this.removeSubtitleFileToolStripMenuItem.Name = "removeSubtitleFileToolStripMenuItem"; + this.removeSubtitleFileToolStripMenuItem.Size = new System.Drawing.Size(178, 22); + this.removeSubtitleFileToolStripMenuItem.Text = "Remove subtitle file"; + this.removeSubtitleFileToolStripMenuItem.Click += new System.EventHandler(this.removeSubtitleFileToolStripMenuItem_Click); + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(175, 6); + // + // deleteToolStripMenuItem + // + this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem"; + this.deleteToolStripMenuItem.Size = new System.Drawing.Size(178, 22); + this.deleteToolStripMenuItem.Text = "Delete"; + this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click); + // + // clearToolStripMenuItem + // + this.clearToolStripMenuItem.Name = "clearToolStripMenuItem"; + this.clearToolStripMenuItem.Size = new System.Drawing.Size(178, 22); + this.clearToolStripMenuItem.Text = "Clear"; + this.clearToolStripMenuItem.Click += new System.EventHandler(this.clearToolStripMenuItem_Click); + // + // buttonPreview + // + this.buttonPreview.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonPreview.Location = new System.Drawing.Point(621, 586); + this.buttonPreview.Name = "buttonPreview"; + this.buttonPreview.Size = new System.Drawing.Size(121, 23); + this.buttonPreview.TabIndex = 130; + this.buttonPreview.Text = "Preview"; + this.buttonPreview.UseVisualStyleBackColor = true; + this.buttonPreview.Click += new System.EventHandler(this.buttonPreview_Click); + // + // linkLabelHelp + // + this.linkLabelHelp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.linkLabelHelp.AutoSize = true; + this.linkLabelHelp.Location = new System.Drawing.Point(844, 563); + this.linkLabelHelp.Name = "linkLabelHelp"; + this.linkLabelHelp.Size = new System.Drawing.Size(29, 13); + this.linkLabelHelp.TabIndex = 120; + this.linkLabelHelp.TabStop = true; + this.linkLabelHelp.Text = "Help"; + this.linkLabelHelp.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelHelp_LinkClicked); + // + // contextMenuStripRes + // + this.contextMenuStripRes.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.useSourceResoluton0x0ToolStripMenuItem, + this.x2160ToolStripMenuItem, + this.uHD3840x2160ToolStripMenuItem, + this.k2048x1080ToolStripMenuItem, + this.dCI2KScope2048x858ToolStripMenuItem, + this.dCI2KFlat1998x1080ToolStripMenuItem, + this.p1920x1080ToolStripMenuItem, + this.x1080ToolStripMenuItem, + this.p1280x720ToolStripMenuItem, + this.x720ToolStripMenuItem, + this.p848x480ToolStripMenuItem, + this.pAL720x576ToolStripMenuItem, + this.nTSC720x480ToolStripMenuItem, + this.x352ToolStripMenuItem, + this.x272ToolStripMenuItem}); + this.contextMenuStripRes.Name = "contextMenuStripRes"; + this.contextMenuStripRes.Size = new System.Drawing.Size(214, 334); + // + // x2160ToolStripMenuItem + // + this.x2160ToolStripMenuItem.Name = "x2160ToolStripMenuItem"; + this.x2160ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.x2160ToolStripMenuItem.Text = "4K (4096x2160)"; + this.x2160ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + // + // uHD3840x2160ToolStripMenuItem + // + this.uHD3840x2160ToolStripMenuItem.Name = "uHD3840x2160ToolStripMenuItem"; + this.uHD3840x2160ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.uHD3840x2160ToolStripMenuItem.Text = "UHD (3840x2160)"; + this.uHD3840x2160ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + // + // k2048x1080ToolStripMenuItem + // + this.k2048x1080ToolStripMenuItem.Name = "k2048x1080ToolStripMenuItem"; + this.k2048x1080ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.k2048x1080ToolStripMenuItem.Text = "2K (2048x1080)"; + this.k2048x1080ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + // + // dCI2KScope2048x858ToolStripMenuItem + // + this.dCI2KScope2048x858ToolStripMenuItem.Name = "dCI2KScope2048x858ToolStripMenuItem"; + this.dCI2KScope2048x858ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.dCI2KScope2048x858ToolStripMenuItem.Text = "DCI 2K Scope (2048x858)"; + this.dCI2KScope2048x858ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + // + // dCI2KFlat1998x1080ToolStripMenuItem + // + this.dCI2KFlat1998x1080ToolStripMenuItem.Name = "dCI2KFlat1998x1080ToolStripMenuItem"; + this.dCI2KFlat1998x1080ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.dCI2KFlat1998x1080ToolStripMenuItem.Text = "DCI 2K Flat (1998x1080)"; + this.dCI2KFlat1998x1080ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + // + // p1920x1080ToolStripMenuItem + // + this.p1920x1080ToolStripMenuItem.Name = "p1920x1080ToolStripMenuItem"; + this.p1920x1080ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.p1920x1080ToolStripMenuItem.Text = "1080p (1920x1080)"; + this.p1920x1080ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + // + // x1080ToolStripMenuItem + // + this.x1080ToolStripMenuItem.Name = "x1080ToolStripMenuItem"; + this.x1080ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.x1080ToolStripMenuItem.Text = "1440x1080"; + this.x1080ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + // + // p1280x720ToolStripMenuItem + // + this.p1280x720ToolStripMenuItem.Name = "p1280x720ToolStripMenuItem"; + this.p1280x720ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.p1280x720ToolStripMenuItem.Text = "720p (1280x720)"; + this.p1280x720ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + // + // x720ToolStripMenuItem + // + this.x720ToolStripMenuItem.Name = "x720ToolStripMenuItem"; + this.x720ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.x720ToolStripMenuItem.Text = "960x720"; + this.x720ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + // + // p848x480ToolStripMenuItem + // + this.p848x480ToolStripMenuItem.Name = "p848x480ToolStripMenuItem"; + this.p848x480ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.p848x480ToolStripMenuItem.Text = "480p (848x480)"; + this.p848x480ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + // + // pAL720x576ToolStripMenuItem + // + this.pAL720x576ToolStripMenuItem.Name = "pAL720x576ToolStripMenuItem"; + this.pAL720x576ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.pAL720x576ToolStripMenuItem.Text = "PAL (720x576)"; + this.pAL720x576ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + // + // nTSC720x480ToolStripMenuItem + // + this.nTSC720x480ToolStripMenuItem.Name = "nTSC720x480ToolStripMenuItem"; + this.nTSC720x480ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.nTSC720x480ToolStripMenuItem.Text = "NTSC (720x480)"; + this.nTSC720x480ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + // + // x352ToolStripMenuItem + // + this.x352ToolStripMenuItem.Name = "x352ToolStripMenuItem"; + this.x352ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.x352ToolStripMenuItem.Text = "640x352"; + this.x352ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + // + // x272ToolStripMenuItem + // + this.x272ToolStripMenuItem.Name = "x272ToolStripMenuItem"; + this.x272ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.x272ToolStripMenuItem.Text = "640x272"; + this.x272ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + // + // buttonMode + // + this.buttonMode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonMode.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonMode.Location = new System.Drawing.Point(748, 586); + this.buttonMode.Name = "buttonMode"; + this.buttonMode.Size = new System.Drawing.Size(125, 23); + this.buttonMode.TabIndex = 143; + this.buttonMode.Text = "Batch mode"; + this.buttonMode.UseVisualStyleBackColor = true; + this.buttonMode.Click += new System.EventHandler(this.buttonMode_Click); + // + // useSourceResoluton0x0ToolStripMenuItem + // + this.useSourceResoluton0x0ToolStripMenuItem.Name = "useSourceResoluton0x0ToolStripMenuItem"; + this.useSourceResoluton0x0ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.useSourceResoluton0x0ToolStripMenuItem.Text = "Use source resoluton (0x0)"; + // + // labelPreviewPleaseWait + // + this.labelPreviewPleaseWait.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.labelPreviewPleaseWait.AutoSize = true; + this.labelPreviewPleaseWait.Location = new System.Drawing.Point(668, 570); + this.labelPreviewPleaseWait.Name = "labelPreviewPleaseWait"; + this.labelPreviewPleaseWait.Size = new System.Drawing.Size(70, 13); + this.labelPreviewPleaseWait.TabIndex = 48; + this.labelPreviewPleaseWait.Text = "Please wait..."; + // + // videoPlayerContainer1 + // + this.videoPlayerContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.videoPlayerContainer1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(18)))), ((int)(((byte)(18)))), ((int)(((byte)(18))))); + this.videoPlayerContainer1.Chapters = null; + this.videoPlayerContainer1.CurrentPosition = 0D; + this.videoPlayerContainer1.FontSizeFactor = 1F; + this.videoPlayerContainer1.LastParagraph = null; + this.videoPlayerContainer1.Location = new System.Drawing.Point(430, 313); + this.videoPlayerContainer1.Name = "videoPlayerContainer1"; + this.videoPlayerContainer1.ShowFullscreenButton = true; + this.videoPlayerContainer1.ShowMuteButton = true; + this.videoPlayerContainer1.ShowStopButton = true; + this.videoPlayerContainer1.Size = new System.Drawing.Size(431, 226); + this.videoPlayerContainer1.SubtitleText = ""; + this.videoPlayerContainer1.TabIndex = 110; + this.videoPlayerContainer1.TextRightToLeft = System.Windows.Forms.RightToLeft.No; + this.videoPlayerContainer1.UsingFrontCenterAudioChannelOnly = false; + this.videoPlayerContainer1.VideoHeight = 0; + this.videoPlayerContainer1.VideoPlayer = null; + this.videoPlayerContainer1.VideoWidth = 0; + this.videoPlayerContainer1.Volume = 0D; + // // numericUpDownCutToSeconds // this.numericUpDownCutToSeconds.BackColor = System.Drawing.SystemColors.Window; @@ -609,17 +1033,6 @@ namespace Nikse.SubtitleEdit.Forms this.labelCutFrom.TabIndex = 14; this.labelCutFrom.Text = "From"; // - // checkBoxCut - // - this.checkBoxCut.AutoSize = true; - this.checkBoxCut.Location = new System.Drawing.Point(12, 36); - this.checkBoxCut.Name = "checkBoxCut"; - this.checkBoxCut.Size = new System.Drawing.Size(42, 17); - this.checkBoxCut.TabIndex = 0; - this.checkBoxCut.Text = "Cut"; - this.checkBoxCut.UseVisualStyleBackColor = true; - this.checkBoxCut.CheckedChanged += new System.EventHandler(this.checkBoxCut_CheckedChanged); - // // labelVideoBitrate // this.labelVideoBitrate.AutoSize = true; @@ -629,28 +1042,6 @@ namespace Nikse.SubtitleEdit.Forms this.labelVideoBitrate.TabIndex = 14; this.labelVideoBitrate.Text = "labelVideoBitrate"; // - // checkBoxBox - // - this.checkBoxBox.AutoSize = true; - this.checkBoxBox.Location = new System.Drawing.Point(226, 27); - this.checkBoxBox.Name = "checkBoxBox"; - this.checkBoxBox.Size = new System.Drawing.Size(44, 17); - this.checkBoxBox.TabIndex = 2; - this.checkBoxBox.Text = "Box"; - this.checkBoxBox.UseVisualStyleBackColor = true; - this.checkBoxBox.CheckedChanged += new System.EventHandler(this.checkBoxBox_CheckedChanged); - // - // checkBoxAlignRight - // - this.checkBoxAlignRight.AutoSize = true; - this.checkBoxAlignRight.Location = new System.Drawing.Point(217, 114); - this.checkBoxAlignRight.Name = "checkBoxAlignRight"; - this.checkBoxAlignRight.Size = new System.Drawing.Size(72, 17); - this.checkBoxAlignRight.TabIndex = 10; - this.checkBoxAlignRight.Text = "Align right"; - this.checkBoxAlignRight.UseVisualStyleBackColor = true; - this.checkBoxAlignRight.CheckedChanged += new System.EventHandler(this.checkBoxAlignRight_CheckedChanged); - // // labelInfo // this.labelInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); @@ -661,17 +1052,6 @@ namespace Nikse.SubtitleEdit.Forms this.labelInfo.TabIndex = 1; this.labelInfo.Text = "Info"; // - // checkBoxRightToLeft - // - this.checkBoxRightToLeft.AutoSize = true; - this.checkBoxRightToLeft.Location = new System.Drawing.Point(120, 114); - this.checkBoxRightToLeft.Name = "checkBoxRightToLeft"; - this.checkBoxRightToLeft.Size = new System.Drawing.Size(80, 17); - this.checkBoxRightToLeft.TabIndex = 9; - this.checkBoxRightToLeft.Text = "Right to left"; - this.checkBoxRightToLeft.UseVisualStyleBackColor = true; - this.checkBoxRightToLeft.CheckedChanged += new System.EventHandler(this.checkBoxRightToLeft_CheckedChanged); - // // comboBoxSubtitleFont // this.comboBoxSubtitleFont.BackColor = System.Drawing.SystemColors.Window; @@ -705,29 +1085,6 @@ namespace Nikse.SubtitleEdit.Forms this.labelSubtitleFont.TabIndex = 7; this.labelSubtitleFont.Text = "Subtitle font"; // - // groupBoxVideo - // - this.groupBoxVideo.Controls.Add(this.labelCrfHint); - this.groupBoxVideo.Controls.Add(this.buttonVideoChooseStandardRes); - this.groupBoxVideo.Controls.Add(this.labelResolution); - this.groupBoxVideo.Controls.Add(this.numericUpDownWidth); - this.groupBoxVideo.Controls.Add(this.numericUpDownHeight); - this.groupBoxVideo.Controls.Add(this.labelX); - this.groupBoxVideo.Controls.Add(this.labelPreset); - this.groupBoxVideo.Controls.Add(this.comboBoxTune); - this.groupBoxVideo.Controls.Add(this.comboBoxPreset); - this.groupBoxVideo.Controls.Add(this.labelTune); - this.groupBoxVideo.Controls.Add(this.labelCRF); - this.groupBoxVideo.Controls.Add(this.comboBoxVideoEncoding); - this.groupBoxVideo.Controls.Add(this.comboBoxCrf); - this.groupBoxVideo.Controls.Add(this.labelVideoEncoding); - this.groupBoxVideo.Location = new System.Drawing.Point(6, 141); - this.groupBoxVideo.Name = "groupBoxVideo"; - this.groupBoxVideo.Size = new System.Drawing.Size(406, 166); - this.groupBoxVideo.TabIndex = 70; - this.groupBoxVideo.TabStop = false; - this.groupBoxVideo.Text = "Video"; - // // labelCrfHint // this.labelCrfHint.AutoSize = true; @@ -739,18 +1096,6 @@ namespace Nikse.SubtitleEdit.Forms this.labelCrfHint.TabIndex = 32; this.labelCrfHint.Text = "Hint"; // - // buttonVideoChooseStandardRes - // - this.buttonVideoChooseStandardRes.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.buttonVideoChooseStandardRes.Location = new System.Drawing.Point(257, 15); - this.buttonVideoChooseStandardRes.Name = "buttonVideoChooseStandardRes"; - this.buttonVideoChooseStandardRes.Size = new System.Drawing.Size(69, 23); - this.buttonVideoChooseStandardRes.TabIndex = 3; - this.buttonVideoChooseStandardRes.Text = "..."; - this.buttonVideoChooseStandardRes.UseVisualStyleBackColor = true; - this.buttonVideoChooseStandardRes.Click += new System.EventHandler(this.buttonVideoChooseStandardRes_Click); - // // labelResolution // this.labelResolution.AutoSize = true; @@ -1011,45 +1356,6 @@ namespace Nikse.SubtitleEdit.Forms this.labelVideoEncoding.TabIndex = 3; this.labelVideoEncoding.Text = "Video enc"; // - // groupBoxAudio - // - this.groupBoxAudio.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupBoxAudio.Controls.Add(this.listViewAudioTracks); - this.groupBoxAudio.Controls.Add(this.labelAudioEnc); - this.groupBoxAudio.Controls.Add(this.comboBoxAudioBitRate); - this.groupBoxAudio.Controls.Add(this.comboBoxAudioEnc); - this.groupBoxAudio.Controls.Add(this.labelAudioBitRate); - this.groupBoxAudio.Controls.Add(this.checkBoxMakeStereo); - this.groupBoxAudio.Controls.Add(this.labelAudioSampleRate); - this.groupBoxAudio.Controls.Add(this.comboBoxAudioSampleRate); - this.groupBoxAudio.Location = new System.Drawing.Point(430, 141); - this.groupBoxAudio.Name = "groupBoxAudio"; - this.groupBoxAudio.Size = new System.Drawing.Size(425, 166); - this.groupBoxAudio.TabIndex = 90; - this.groupBoxAudio.TabStop = false; - this.groupBoxAudio.Text = "Audio"; - // - // listViewAudioTracks - // - this.listViewAudioTracks.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.listViewAudioTracks.CheckBoxes = true; - this.listViewAudioTracks.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.columnHeaderAudioTrack}); - this.listViewAudioTracks.HideSelection = false; - this.listViewAudioTracks.Location = new System.Drawing.Point(229, 29); - this.listViewAudioTracks.Name = "listViewAudioTracks"; - this.listViewAudioTracks.Size = new System.Drawing.Size(190, 122); - this.listViewAudioTracks.TabIndex = 45; - this.listViewAudioTracks.UseCompatibleStateImageBehavior = false; - this.listViewAudioTracks.View = System.Windows.Forms.View.Details; - // - // columnHeaderAudioTrack - // - this.columnHeaderAudioTrack.Text = "Audio tracks"; - this.columnHeaderAudioTrack.Width = 160; - // // labelAudioEnc // this.labelAudioEnc.AutoSize = true; @@ -1125,18 +1431,6 @@ namespace Nikse.SubtitleEdit.Forms this.labelAudioBitRate.TabIndex = 4; this.labelAudioBitRate.Text = "Bit rate"; // - // checkBoxMakeStereo - // - this.checkBoxMakeStereo.AutoSize = true; - this.checkBoxMakeStereo.Checked = true; - this.checkBoxMakeStereo.CheckState = System.Windows.Forms.CheckState.Checked; - this.checkBoxMakeStereo.Location = new System.Drawing.Point(91, 58); - this.checkBoxMakeStereo.Name = "checkBoxMakeStereo"; - this.checkBoxMakeStereo.Size = new System.Drawing.Size(57, 17); - this.checkBoxMakeStereo.TabIndex = 2; - this.checkBoxMakeStereo.Text = "Stereo"; - this.checkBoxMakeStereo.UseVisualStyleBackColor = true; - // // labelAudioSampleRate // this.labelAudioSampleRate.AutoSize = true; @@ -1222,17 +1516,6 @@ namespace Nikse.SubtitleEdit.Forms this.labelFileSize.TabIndex = 12; this.labelFileSize.Text = "File size in MB"; // - // checkBoxTargetFileSize - // - this.checkBoxTargetFileSize.AutoSize = true; - this.checkBoxTargetFileSize.Location = new System.Drawing.Point(22, 327); - this.checkBoxTargetFileSize.Name = "checkBoxTargetFileSize"; - this.checkBoxTargetFileSize.Size = new System.Drawing.Size(192, 17); - this.checkBoxTargetFileSize.TabIndex = 100; - this.checkBoxTargetFileSize.Text = "Target file size (two pass encoding)"; - this.checkBoxTargetFileSize.UseVisualStyleBackColor = true; - this.checkBoxTargetFileSize.CheckedChanged += new System.EventHandler(this.checkBoxTargetFileSize_CheckedChanged); - // // labelFileName // this.labelFileName.AutoSize = true; @@ -1289,279 +1572,6 @@ namespace Nikse.SubtitleEdit.Forms this.labelFontSize.TabIndex = 0; this.labelFontSize.Text = "Font size"; // - // listViewBatch - // - this.listViewBatch.AllowDrop = true; - this.listViewBatch.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.listViewBatch.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.columnHeaderVideoFile, - this.columnHeaderResolution, - this.columnHeaderSize, - this.columnHeaderSubtitleFile, - this.columnHeaderStatus}); - this.listViewBatch.ContextMenuStrip = this.contextMenuStripBatch; - this.listViewBatch.FullRowSelect = true; - this.listViewBatch.HideSelection = false; - this.listViewBatch.Location = new System.Drawing.Point(6, 316); - this.listViewBatch.Name = "listViewBatch"; - this.listViewBatch.Size = new System.Drawing.Size(852, 191); - this.listViewBatch.TabIndex = 3; - this.listViewBatch.UseCompatibleStateImageBehavior = false; - this.listViewBatch.View = System.Windows.Forms.View.Details; - this.listViewBatch.DragDrop += new System.Windows.Forms.DragEventHandler(this.listViewBatch_DragDrop); - this.listViewBatch.DragEnter += new System.Windows.Forms.DragEventHandler(this.listViewBatch_DragEnter); - this.listViewBatch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listViewBatch_KeyDown); - // - // columnHeaderVideoFile - // - this.columnHeaderVideoFile.Text = "Video file"; - this.columnHeaderVideoFile.Width = 420; - // - // columnHeaderResolution - // - this.columnHeaderResolution.Text = "Resolution"; - this.columnHeaderResolution.Width = 80; - // - // columnHeaderSize - // - this.columnHeaderSize.Text = "Size"; - this.columnHeaderSize.Width = 80; - // - // columnHeaderSubtitleFile - // - this.columnHeaderSubtitleFile.Text = "Subtitle file"; - this.columnHeaderSubtitleFile.Width = 180; - // - // columnHeaderStatus - // - this.columnHeaderStatus.Text = "Status"; - this.columnHeaderStatus.Width = 80; - // - // contextMenuStripBatch - // - this.contextMenuStripBatch.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.addFilesToolStripMenuItem, - this.toolStripSeparator2, - this.pickSubtitleFileToolStripMenuItem, - this.removeSubtitleFileToolStripMenuItem, - this.toolStripSeparator1, - this.deleteToolStripMenuItem, - this.clearToolStripMenuItem}); - this.contextMenuStripBatch.Name = "contextMenuStripBatch"; - this.contextMenuStripBatch.Size = new System.Drawing.Size(179, 126); - this.contextMenuStripBatch.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripBatch_Opening); - // - // addFilesToolStripMenuItem - // - this.addFilesToolStripMenuItem.Name = "addFilesToolStripMenuItem"; - this.addFilesToolStripMenuItem.Size = new System.Drawing.Size(178, 22); - this.addFilesToolStripMenuItem.Text = "Add video files..."; - this.addFilesToolStripMenuItem.Click += new System.EventHandler(this.addFilesToolStripMenuItem_Click); - // - // toolStripSeparator2 - // - this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(175, 6); - // - // pickSubtitleFileToolStripMenuItem - // - this.pickSubtitleFileToolStripMenuItem.Name = "pickSubtitleFileToolStripMenuItem"; - this.pickSubtitleFileToolStripMenuItem.Size = new System.Drawing.Size(178, 22); - this.pickSubtitleFileToolStripMenuItem.Text = "Pick subtitle file..."; - this.pickSubtitleFileToolStripMenuItem.Click += new System.EventHandler(this.pickSubtitleFileToolStripMenuItem_Click); - // - // removeSubtitleFileToolStripMenuItem - // - this.removeSubtitleFileToolStripMenuItem.Name = "removeSubtitleFileToolStripMenuItem"; - this.removeSubtitleFileToolStripMenuItem.Size = new System.Drawing.Size(178, 22); - this.removeSubtitleFileToolStripMenuItem.Text = "Remove subtitle file"; - this.removeSubtitleFileToolStripMenuItem.Click += new System.EventHandler(this.removeSubtitleFileToolStripMenuItem_Click); - // - // toolStripSeparator1 - // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(175, 6); - // - // deleteToolStripMenuItem - // - this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem"; - this.deleteToolStripMenuItem.Size = new System.Drawing.Size(178, 22); - this.deleteToolStripMenuItem.Text = "Delete"; - this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click); - // - // clearToolStripMenuItem - // - this.clearToolStripMenuItem.Name = "clearToolStripMenuItem"; - this.clearToolStripMenuItem.Size = new System.Drawing.Size(178, 22); - this.clearToolStripMenuItem.Text = "Clear"; - this.clearToolStripMenuItem.Click += new System.EventHandler(this.clearToolStripMenuItem_Click); - // - // buttonPreview - // - this.buttonPreview.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonPreview.Location = new System.Drawing.Point(621, 586); - this.buttonPreview.Name = "buttonPreview"; - this.buttonPreview.Size = new System.Drawing.Size(121, 23); - this.buttonPreview.TabIndex = 130; - this.buttonPreview.Text = "Preview"; - this.buttonPreview.UseVisualStyleBackColor = true; - this.buttonPreview.Click += new System.EventHandler(this.buttonPreview_Click); - // - // linkLabelHelp - // - this.linkLabelHelp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.linkLabelHelp.AutoSize = true; - this.linkLabelHelp.Location = new System.Drawing.Point(844, 563); - this.linkLabelHelp.Name = "linkLabelHelp"; - this.linkLabelHelp.Size = new System.Drawing.Size(29, 13); - this.linkLabelHelp.TabIndex = 120; - this.linkLabelHelp.TabStop = true; - this.linkLabelHelp.Text = "Help"; - this.linkLabelHelp.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelHelp_LinkClicked); - // - // contextMenuStripRes - // - this.contextMenuStripRes.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.useSourceResoluton0x0ToolStripMenuItem, - this.x2160ToolStripMenuItem, - this.uHD3840x2160ToolStripMenuItem, - this.k2048x1080ToolStripMenuItem, - this.dCI2KScope2048x858ToolStripMenuItem, - this.dCI2KFlat1998x1080ToolStripMenuItem, - this.p1920x1080ToolStripMenuItem, - this.x1080ToolStripMenuItem, - this.p1280x720ToolStripMenuItem, - this.x720ToolStripMenuItem, - this.p848x480ToolStripMenuItem, - this.pAL720x576ToolStripMenuItem, - this.nTSC720x480ToolStripMenuItem, - this.x352ToolStripMenuItem, - this.x272ToolStripMenuItem}); - this.contextMenuStripRes.Name = "contextMenuStripRes"; - this.contextMenuStripRes.Size = new System.Drawing.Size(214, 356); - // - // x2160ToolStripMenuItem - // - this.x2160ToolStripMenuItem.Name = "x2160ToolStripMenuItem"; - this.x2160ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.x2160ToolStripMenuItem.Text = "4K (4096x2160)"; - this.x2160ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); - // - // uHD3840x2160ToolStripMenuItem - // - this.uHD3840x2160ToolStripMenuItem.Name = "uHD3840x2160ToolStripMenuItem"; - this.uHD3840x2160ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.uHD3840x2160ToolStripMenuItem.Text = "UHD (3840x2160)"; - this.uHD3840x2160ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); - // - // k2048x1080ToolStripMenuItem - // - this.k2048x1080ToolStripMenuItem.Name = "k2048x1080ToolStripMenuItem"; - this.k2048x1080ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.k2048x1080ToolStripMenuItem.Text = "2K (2048x1080)"; - this.k2048x1080ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); - // - // dCI2KScope2048x858ToolStripMenuItem - // - this.dCI2KScope2048x858ToolStripMenuItem.Name = "dCI2KScope2048x858ToolStripMenuItem"; - this.dCI2KScope2048x858ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.dCI2KScope2048x858ToolStripMenuItem.Text = "DCI 2K Scope (2048x858)"; - this.dCI2KScope2048x858ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); - // - // dCI2KFlat1998x1080ToolStripMenuItem - // - this.dCI2KFlat1998x1080ToolStripMenuItem.Name = "dCI2KFlat1998x1080ToolStripMenuItem"; - this.dCI2KFlat1998x1080ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.dCI2KFlat1998x1080ToolStripMenuItem.Text = "DCI 2K Flat (1998x1080)"; - this.dCI2KFlat1998x1080ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); - // - // p1920x1080ToolStripMenuItem - // - this.p1920x1080ToolStripMenuItem.Name = "p1920x1080ToolStripMenuItem"; - this.p1920x1080ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.p1920x1080ToolStripMenuItem.Text = "1080p (1920x1080)"; - this.p1920x1080ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); - // - // x1080ToolStripMenuItem - // - this.x1080ToolStripMenuItem.Name = "x1080ToolStripMenuItem"; - this.x1080ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.x1080ToolStripMenuItem.Text = "1440x1080"; - this.x1080ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); - // - // p1280x720ToolStripMenuItem - // - this.p1280x720ToolStripMenuItem.Name = "p1280x720ToolStripMenuItem"; - this.p1280x720ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.p1280x720ToolStripMenuItem.Text = "720p (1280x720)"; - this.p1280x720ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); - // - // x720ToolStripMenuItem - // - this.x720ToolStripMenuItem.Name = "x720ToolStripMenuItem"; - this.x720ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.x720ToolStripMenuItem.Text = "960x720"; - this.x720ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); - // - // p848x480ToolStripMenuItem - // - this.p848x480ToolStripMenuItem.Name = "p848x480ToolStripMenuItem"; - this.p848x480ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.p848x480ToolStripMenuItem.Text = "480p (848x480)"; - this.p848x480ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); - // - // pAL720x576ToolStripMenuItem - // - this.pAL720x576ToolStripMenuItem.Name = "pAL720x576ToolStripMenuItem"; - this.pAL720x576ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.pAL720x576ToolStripMenuItem.Text = "PAL (720x576)"; - this.pAL720x576ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); - // - // nTSC720x480ToolStripMenuItem - // - this.nTSC720x480ToolStripMenuItem.Name = "nTSC720x480ToolStripMenuItem"; - this.nTSC720x480ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.nTSC720x480ToolStripMenuItem.Text = "NTSC (720x480)"; - this.nTSC720x480ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); - // - // x352ToolStripMenuItem - // - this.x352ToolStripMenuItem.Name = "x352ToolStripMenuItem"; - this.x352ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.x352ToolStripMenuItem.Text = "640x352"; - this.x352ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); - // - // x272ToolStripMenuItem - // - this.x272ToolStripMenuItem.Name = "x272ToolStripMenuItem"; - this.x272ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.x272ToolStripMenuItem.Text = "640x272"; - this.x272ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); - // - // buttonMode - // - this.buttonMode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonMode.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.buttonMode.Location = new System.Drawing.Point(748, 586); - this.buttonMode.Name = "buttonMode"; - this.buttonMode.Size = new System.Drawing.Size(125, 23); - this.buttonMode.TabIndex = 143; - this.buttonMode.Text = "Batch mode"; - this.buttonMode.UseVisualStyleBackColor = true; - this.buttonMode.Click += new System.EventHandler(this.buttonMode_Click); - // - // labelPreviewPleaseWait - // - this.labelPreviewPleaseWait.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.labelPreviewPleaseWait.AutoSize = true; - this.labelPreviewPleaseWait.Location = new System.Drawing.Point(668, 570); - this.labelPreviewPleaseWait.Name = "labelPreviewPleaseWait"; - this.labelPreviewPleaseWait.Size = new System.Drawing.Size(70, 13); - this.labelPreviewPleaseWait.TabIndex = 48; - this.labelPreviewPleaseWait.Text = "Please wait..."; - // // labelPass // this.labelPass.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); @@ -1602,11 +1612,23 @@ namespace Nikse.SubtitleEdit.Forms this.textBoxLog.Size = new System.Drawing.Size(188, 26); this.textBoxLog.TabIndex = 31; // - // useSourceResoluton0x0ToolStripMenuItem + // nikseLabelSuffix // - this.useSourceResoluton0x0ToolStripMenuItem.Name = "useSourceResoluton0x0ToolStripMenuItem"; - this.useSourceResoluton0x0ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.useSourceResoluton0x0ToolStripMenuItem.Text = "Use source resoluton (0x0)"; + this.nikseLabelSuffix.AutoSize = true; + this.nikseLabelSuffix.Location = new System.Drawing.Point(260, 518); + this.nikseLabelSuffix.Name = "nikseLabelSuffix"; + this.nikseLabelSuffix.Size = new System.Drawing.Size(33, 13); + this.nikseLabelSuffix.TabIndex = 147; + this.nikseLabelSuffix.Text = "Suffix"; + // + // nikseTextBoxSuffix + // + this.nikseTextBoxSuffix.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.nikseTextBoxSuffix.Location = new System.Drawing.Point(299, 515); + this.nikseTextBoxSuffix.Name = "nikseTextBoxSuffix"; + this.nikseTextBoxSuffix.Size = new System.Drawing.Size(100, 20); + this.nikseTextBoxSuffix.TabIndex = 148; + this.nikseTextBoxSuffix.Text = "_input"; // // GenerateVideoWithHardSubs // @@ -1757,5 +1779,7 @@ namespace Nikse.SubtitleEdit.Forms private System.Windows.Forms.ToolStripMenuItem removeSubtitleFileToolStripMenuItem; private System.Windows.Forms.ColumnHeader columnHeaderResolution; private System.Windows.Forms.ToolStripMenuItem useSourceResoluton0x0ToolStripMenuItem; + private Controls.NikseLabel nikseLabelSuffix; + private Controls.NikseTextBox nikseTextBoxSuffix; } } \ No newline at end of file diff --git a/src/ui/Forms/GenerateVideoWithHardSubs.cs b/src/ui/Forms/GenerateVideoWithHardSubs.cs index ddf436a05..1aa902015 100644 --- a/src/ui/Forms/GenerateVideoWithHardSubs.cs +++ b/src/ui/Forms/GenerateVideoWithHardSubs.cs @@ -314,6 +314,8 @@ namespace Nikse.SubtitleEdit.Forms buttonRemoveFile.Visible = BatchMode; buttonClear.Visible = BatchMode; buttonAddFile.Visible = BatchMode; + nikseLabelSuffix.Visible = BatchMode; + nikseTextBoxSuffix.Visible = BatchMode; var audioTracks = _mediaInfo.Tracks.Where(p => p.TrackType == FfmpegTrackType.Audio).ToList(); useSourceResoluton0x0ToolStripMenuItem.Visible = BatchMode; @@ -445,7 +447,7 @@ namespace Nikse.SubtitleEdit.Forms stopWatch = Stopwatch.StartNew(); var sbInfo = new StringBuilder(); - sbInfo.AppendLine($"Input for convert: {_batchVideoAndSubList.Count} video files:"); + sbInfo.AppendLine("Conversion report:"); sbInfo.AppendLine(); var okCount = 0; var failCount = 0; @@ -468,12 +470,12 @@ namespace Nikse.SubtitleEdit.Forms var path = Path.GetDirectoryName(videoAndSub.VideoFileName); var nameNoExt = Path.GetFileNameWithoutExtension(videoAndSub.VideoFileName); var ext = Path.GetExtension(videoAndSub.VideoFileName); - VideoFileName = Path.Combine(path, $"{nameNoExt.TrimEnd('.', '.')}_new{ext}"); + VideoFileName = Path.Combine(path, $"{nameNoExt.TrimEnd('.', '.')}{nikseTextBoxSuffix.Text}{ext}"); if (File.Exists(VideoFileName)) { for (var i = 2; i < int.MaxValue; i++) { - VideoFileName = Path.Combine(path, $"{nameNoExt.TrimEnd('.', '.')}_new_{i}{ext}"); + VideoFileName = Path.Combine(path, $"{nameNoExt.TrimEnd('.', '.')}{nikseTextBoxSuffix.Text}_{i}{ext}"); if (!File.Exists(VideoFileName)) { break; @@ -500,10 +502,20 @@ namespace Nikse.SubtitleEdit.Forms } sbInfo.AppendLine(); - sbInfo.AppendLine($"Video files converted in {stopWatch.Elapsed}: {okCount}"); + + var timeString = $"{stopWatch.Elapsed.Hours + stopWatch.Elapsed.Days * 24:00}:{stopWatch.Elapsed.Minutes:00}:{stopWatch.Elapsed.Seconds:00}"; + if (okCount == 1) + { + sbInfo.AppendLine($"One video file converted in {timeString}"); + } + else + { + sbInfo.AppendLine($"{okCount} video files converted in {timeString}"); + } + if (failCount > 0) { - sbInfo.AppendLine($"Video files failed: {failCount}"); + sbInfo.AppendLine($"{failCount} video file(s) failed!"); } BatchInfo = sbInfo.ToString(); @@ -1989,6 +2001,8 @@ namespace Nikse.SubtitleEdit.Forms buttonAddFile.Visible = BatchMode; buttonRemoveFile.Visible = BatchMode; buttonClear.Visible = BatchMode; + nikseLabelSuffix.Visible = BatchMode; + nikseTextBoxSuffix.Visible = BatchMode; buttonMode.Text = BatchMode ? LanguageSettings.Current.Split.Basic : LanguageSettings.Current.AudioToText.BatchMode; From e85d51d95d047bfee7355661fcc9d60927459f26 Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Sun, 21 Apr 2024 14:20:10 +0200 Subject: [PATCH 5/8] Add outpt file settings - thx David/Leon :) Work #8210 --- src/libse/Common/Settings.cs | 25 + .../GenerateVideoWithHardSubs.Designer.cs | 1000 ++++++++--------- src/ui/Forms/GenerateVideoWithHardSubs.cs | 25 +- ...nerateVideoWithHardSubsOutFile.Designer.cs | 183 +++ .../Forms/GenerateVideoWithHardSubsOutFile.cs | 130 +++ .../GenerateVideoWithHardSubsOutFile.resx | 123 ++ src/ui/SubtitleEdit.csproj | 9 + 7 files changed, 984 insertions(+), 511 deletions(-) create mode 100644 src/ui/Forms/GenerateVideoWithHardSubsOutFile.Designer.cs create mode 100644 src/ui/Forms/GenerateVideoWithHardSubsOutFile.cs create mode 100644 src/ui/Forms/GenerateVideoWithHardSubsOutFile.resx diff --git a/src/libse/Common/Settings.cs b/src/libse/Common/Settings.cs index a6d6ac868..480f57244 100644 --- a/src/libse/Common/Settings.cs +++ b/src/libse/Common/Settings.cs @@ -481,6 +481,9 @@ namespace Nikse.SubtitleEdit.Core.Common public string GenVideoEmbedOutputSuffix { get; set; } public string GenVideoEmbedOutputReplace { get; set; } public bool GenVideoDeleteInputVideoFile { get; set; } + public bool GenVideoUseOutputFolder { get; set; } + public string GenVideoOutputFolder { get; set; } + public string GenVideoOutputFileSuffix { get; set; } public bool VoskPostProcessing { get; set; } public string VoskModel { get; set; } @@ -734,6 +737,7 @@ namespace Nikse.SubtitleEdit.Core.Common GenVideoNonAssaTextColor = Color.White; GenVideoEmbedOutputSuffix = "embed"; GenVideoEmbedOutputReplace = "embed" + Environment.NewLine + "SoftSub" + Environment.NewLine + "SoftSubbed"; + GenVideoOutputFileSuffix = "_new"; VoskPostProcessing = true; WhisperChoice = Configuration.IsRunningOnWindows ? AudioToText.WhisperChoice.PurfviewFasterWhisper : AudioToText.WhisperChoice.OpenAi; WhisperDeleteTempFiles = true; @@ -7183,6 +7187,24 @@ $HorzAlign = Center settings.Tools.GenVideoDeleteInputVideoFile = Convert.ToBoolean(subNode.InnerText, CultureInfo.InvariantCulture); } + subNode = node.SelectSingleNode("GenVideoUseOutputFolder"); + if (subNode != null) + { + settings.Tools.GenVideoUseOutputFolder = Convert.ToBoolean(subNode.InnerText, CultureInfo.InvariantCulture); + } + + subNode = node.SelectSingleNode("GenVideoOutputFolder"); + if (subNode != null) + { + settings.Tools.GenVideoOutputFolder = subNode.InnerText; + } + + subNode = node.SelectSingleNode("GenVideoOutputFileSuffix"); + if (subNode != null) + { + settings.Tools.GenVideoOutputFileSuffix = subNode.InnerText; + } + subNode = node.SelectSingleNode("VoskPostProcessing"); if (subNode != null) @@ -12283,6 +12305,9 @@ $HorzAlign = Center textWriter.WriteElementString("GenVideoEmbedOutputSuffix", settings.Tools.GenVideoEmbedOutputSuffix); textWriter.WriteElementString("GenVideoEmbedOutputReplace", settings.Tools.GenVideoEmbedOutputReplace); textWriter.WriteElementString("GenVideoDeleteInputVideoFile", settings.Tools.GenVideoDeleteInputVideoFile.ToString(CultureInfo.InvariantCulture)); + textWriter.WriteElementString("GenVideoUseOutputFolder", settings.Tools.GenVideoUseOutputFolder.ToString(CultureInfo.InvariantCulture)); + textWriter.WriteElementString("GenVideoOutputFileSuffix", settings.Tools.GenVideoOutputFolder); + textWriter.WriteElementString("GenVideoOutputFileSuffix", settings.Tools.GenVideoOutputFileSuffix); textWriter.WriteElementString("VoskPostProcessing", settings.Tools.VoskPostProcessing.ToString(CultureInfo.InvariantCulture)); textWriter.WriteElementString("VoskModel", settings.Tools.VoskModel); textWriter.WriteElementString("WhisperChoice", settings.Tools.WhisperChoice); diff --git a/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs b/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs index 6d768312e..9645427b6 100644 --- a/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs +++ b/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs @@ -44,20 +44,57 @@ namespace Nikse.SubtitleEdit.Forms this.buttonAddFile = new System.Windows.Forms.Button(); this.panelOutlineColor = new System.Windows.Forms.Panel(); this.buttonOutlineColor = new System.Windows.Forms.Button(); + this.videoPlayerContainer1 = new Nikse.SubtitleEdit.Controls.VideoPlayerContainer(); this.groupBoxCut = new System.Windows.Forms.GroupBox(); this.buttonCutTo = new System.Windows.Forms.Button(); this.buttonCutFrom = new System.Windows.Forms.Button(); + this.numericUpDownCutToSeconds = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.numericUpDownCutToMinutes = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.numericUpDownCutToHours = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.numericUpDownCutFromSeconds = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.numericUpDownCutFromMinutes = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.numericUpDownCutFromHours = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.labelCutTo = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.labelCutFrom = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.checkBoxCut = new System.Windows.Forms.CheckBox(); + this.labelVideoBitrate = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.checkBoxBox = new System.Windows.Forms.CheckBox(); this.checkBoxAlignRight = new System.Windows.Forms.CheckBox(); + this.labelInfo = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.checkBoxRightToLeft = new System.Windows.Forms.CheckBox(); + this.comboBoxSubtitleFont = new Nikse.SubtitleEdit.Controls.NikseComboBox(); + this.labelSubtitleFont = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.groupBoxVideo = new System.Windows.Forms.GroupBox(); + this.labelCrfHint = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.buttonVideoChooseStandardRes = new System.Windows.Forms.Button(); + this.labelResolution = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.numericUpDownWidth = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.numericUpDownHeight = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.labelX = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.labelPreset = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.comboBoxTune = new Nikse.SubtitleEdit.Controls.NikseComboBox(); + this.comboBoxPreset = new Nikse.SubtitleEdit.Controls.NikseComboBox(); + this.labelTune = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.labelCRF = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.comboBoxVideoEncoding = new Nikse.SubtitleEdit.Controls.NikseComboBox(); + this.comboBoxCrf = new Nikse.SubtitleEdit.Controls.NikseComboBox(); + this.labelVideoEncoding = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.groupBoxAudio = new System.Windows.Forms.GroupBox(); this.listViewAudioTracks = new System.Windows.Forms.ListView(); this.columnHeaderAudioTrack = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.labelAudioEnc = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.comboBoxAudioBitRate = new Nikse.SubtitleEdit.Controls.NikseComboBox(); + this.comboBoxAudioEnc = new Nikse.SubtitleEdit.Controls.NikseComboBox(); + this.labelAudioBitRate = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.checkBoxMakeStereo = new System.Windows.Forms.CheckBox(); + this.labelAudioSampleRate = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.comboBoxAudioSampleRate = new Nikse.SubtitleEdit.Controls.NikseComboBox(); + this.numericUpDownTargetFileSize = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.labelFileSize = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.checkBoxTargetFileSize = new System.Windows.Forms.CheckBox(); + this.labelFileName = new Nikse.SubtitleEdit.Controls.NikseLabel(); + this.numericUpDownFontSize = new Nikse.SubtitleEdit.Controls.NikseUpDown(); + this.labelFontSize = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.listViewBatch = new System.Windows.Forms.ListView(); this.columnHeaderVideoFile = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.columnHeaderResolution = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); @@ -75,6 +112,7 @@ namespace Nikse.SubtitleEdit.Forms this.buttonPreview = new System.Windows.Forms.Button(); this.linkLabelHelp = new System.Windows.Forms.LinkLabel(); this.contextMenuStripRes = new System.Windows.Forms.ContextMenuStrip(this.components); + this.useSourceResoluton0x0ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.x2160ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.uHD3840x2160ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.k2048x1080ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -90,51 +128,12 @@ namespace Nikse.SubtitleEdit.Forms this.x352ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.x272ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.buttonMode = new System.Windows.Forms.Button(); - this.useSourceResoluton0x0ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.labelPreviewPleaseWait = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.videoPlayerContainer1 = new Nikse.SubtitleEdit.Controls.VideoPlayerContainer(); - this.numericUpDownCutToSeconds = new Nikse.SubtitleEdit.Controls.NikseUpDown(); - this.numericUpDownCutToMinutes = new Nikse.SubtitleEdit.Controls.NikseUpDown(); - this.numericUpDownCutToHours = new Nikse.SubtitleEdit.Controls.NikseUpDown(); - this.numericUpDownCutFromSeconds = new Nikse.SubtitleEdit.Controls.NikseUpDown(); - this.numericUpDownCutFromMinutes = new Nikse.SubtitleEdit.Controls.NikseUpDown(); - this.numericUpDownCutFromHours = new Nikse.SubtitleEdit.Controls.NikseUpDown(); - this.labelCutTo = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.labelCutFrom = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.labelVideoBitrate = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.labelInfo = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.comboBoxSubtitleFont = new Nikse.SubtitleEdit.Controls.NikseComboBox(); - this.labelSubtitleFont = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.labelCrfHint = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.labelResolution = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.numericUpDownWidth = new Nikse.SubtitleEdit.Controls.NikseUpDown(); - this.numericUpDownHeight = new Nikse.SubtitleEdit.Controls.NikseUpDown(); - this.labelX = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.labelPreset = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.comboBoxTune = new Nikse.SubtitleEdit.Controls.NikseComboBox(); - this.comboBoxPreset = new Nikse.SubtitleEdit.Controls.NikseComboBox(); - this.labelTune = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.labelCRF = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.comboBoxVideoEncoding = new Nikse.SubtitleEdit.Controls.NikseComboBox(); - this.comboBoxCrf = new Nikse.SubtitleEdit.Controls.NikseComboBox(); - this.labelVideoEncoding = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.labelAudioEnc = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.comboBoxAudioBitRate = new Nikse.SubtitleEdit.Controls.NikseComboBox(); - this.comboBoxAudioEnc = new Nikse.SubtitleEdit.Controls.NikseComboBox(); - this.labelAudioBitRate = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.labelAudioSampleRate = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.comboBoxAudioSampleRate = new Nikse.SubtitleEdit.Controls.NikseComboBox(); - this.numericUpDownTargetFileSize = new Nikse.SubtitleEdit.Controls.NikseUpDown(); - this.labelFileSize = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.labelFileName = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.numericUpDownFontSize = new Nikse.SubtitleEdit.Controls.NikseUpDown(); - this.labelFontSize = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.labelPass = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.labelProgress = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.labelPleaseWait = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.textBoxLog = new Nikse.SubtitleEdit.Controls.NikseTextBox(); - this.nikseLabelSuffix = new Nikse.SubtitleEdit.Controls.NikseLabel(); - this.nikseTextBoxSuffix = new Nikse.SubtitleEdit.Controls.NikseTextBox(); + this.buttonOutputFileSettings = new System.Windows.Forms.Button(); this.contextMenuStripGenerate.SuspendLayout(); this.groupBoxSettings.SuspendLayout(); this.groupBoxCut.SuspendLayout(); @@ -204,8 +203,7 @@ namespace Nikse.SubtitleEdit.Forms this.groupBoxSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.groupBoxSettings.Controls.Add(this.nikseTextBoxSuffix); - this.groupBoxSettings.Controls.Add(this.nikseLabelSuffix); + this.groupBoxSettings.Controls.Add(this.buttonOutputFileSettings); this.groupBoxSettings.Controls.Add(this.buttonClear); this.groupBoxSettings.Controls.Add(this.panelForeColor); this.groupBoxSettings.Controls.Add(this.buttonRemoveFile); @@ -309,6 +307,31 @@ namespace Nikse.SubtitleEdit.Forms this.buttonOutlineColor.UseVisualStyleBackColor = true; this.buttonOutlineColor.Click += new System.EventHandler(this.buttonOutlineColor_Click); // + // videoPlayerContainer1 + // + this.videoPlayerContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.videoPlayerContainer1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(18)))), ((int)(((byte)(18)))), ((int)(((byte)(18))))); + this.videoPlayerContainer1.Chapters = null; + this.videoPlayerContainer1.CurrentPosition = 0D; + this.videoPlayerContainer1.FontSizeFactor = 1F; + this.videoPlayerContainer1.LastParagraph = null; + this.videoPlayerContainer1.Location = new System.Drawing.Point(430, 313); + this.videoPlayerContainer1.Name = "videoPlayerContainer1"; + this.videoPlayerContainer1.ShowFullscreenButton = true; + this.videoPlayerContainer1.ShowMuteButton = true; + this.videoPlayerContainer1.ShowStopButton = true; + this.videoPlayerContainer1.Size = new System.Drawing.Size(431, 226); + this.videoPlayerContainer1.SubtitleText = ""; + this.videoPlayerContainer1.TabIndex = 110; + this.videoPlayerContainer1.TextRightToLeft = System.Windows.Forms.RightToLeft.No; + this.videoPlayerContainer1.UsingFrontCenterAudioChannelOnly = false; + this.videoPlayerContainer1.VideoHeight = 0; + this.videoPlayerContainer1.VideoPlayer = null; + this.videoPlayerContainer1.VideoWidth = 0; + this.videoPlayerContainer1.Volume = 0D; + // // groupBoxCut // this.groupBoxCut.Controls.Add(this.buttonCutTo); @@ -348,451 +371,6 @@ namespace Nikse.SubtitleEdit.Forms this.buttonCutFrom.UseVisualStyleBackColor = true; this.buttonCutFrom.Click += new System.EventHandler(this.buttonCutFrom_Click); // - // checkBoxCut - // - this.checkBoxCut.AutoSize = true; - this.checkBoxCut.Location = new System.Drawing.Point(12, 36); - this.checkBoxCut.Name = "checkBoxCut"; - this.checkBoxCut.Size = new System.Drawing.Size(42, 17); - this.checkBoxCut.TabIndex = 0; - this.checkBoxCut.Text = "Cut"; - this.checkBoxCut.UseVisualStyleBackColor = true; - this.checkBoxCut.CheckedChanged += new System.EventHandler(this.checkBoxCut_CheckedChanged); - // - // checkBoxBox - // - this.checkBoxBox.AutoSize = true; - this.checkBoxBox.Location = new System.Drawing.Point(226, 27); - this.checkBoxBox.Name = "checkBoxBox"; - this.checkBoxBox.Size = new System.Drawing.Size(44, 17); - this.checkBoxBox.TabIndex = 2; - this.checkBoxBox.Text = "Box"; - this.checkBoxBox.UseVisualStyleBackColor = true; - this.checkBoxBox.CheckedChanged += new System.EventHandler(this.checkBoxBox_CheckedChanged); - // - // checkBoxAlignRight - // - this.checkBoxAlignRight.AutoSize = true; - this.checkBoxAlignRight.Location = new System.Drawing.Point(217, 114); - this.checkBoxAlignRight.Name = "checkBoxAlignRight"; - this.checkBoxAlignRight.Size = new System.Drawing.Size(72, 17); - this.checkBoxAlignRight.TabIndex = 10; - this.checkBoxAlignRight.Text = "Align right"; - this.checkBoxAlignRight.UseVisualStyleBackColor = true; - this.checkBoxAlignRight.CheckedChanged += new System.EventHandler(this.checkBoxAlignRight_CheckedChanged); - // - // checkBoxRightToLeft - // - this.checkBoxRightToLeft.AutoSize = true; - this.checkBoxRightToLeft.Location = new System.Drawing.Point(120, 114); - this.checkBoxRightToLeft.Name = "checkBoxRightToLeft"; - this.checkBoxRightToLeft.Size = new System.Drawing.Size(80, 17); - this.checkBoxRightToLeft.TabIndex = 9; - this.checkBoxRightToLeft.Text = "Right to left"; - this.checkBoxRightToLeft.UseVisualStyleBackColor = true; - this.checkBoxRightToLeft.CheckedChanged += new System.EventHandler(this.checkBoxRightToLeft_CheckedChanged); - // - // groupBoxVideo - // - this.groupBoxVideo.Controls.Add(this.labelCrfHint); - this.groupBoxVideo.Controls.Add(this.buttonVideoChooseStandardRes); - this.groupBoxVideo.Controls.Add(this.labelResolution); - this.groupBoxVideo.Controls.Add(this.numericUpDownWidth); - this.groupBoxVideo.Controls.Add(this.numericUpDownHeight); - this.groupBoxVideo.Controls.Add(this.labelX); - this.groupBoxVideo.Controls.Add(this.labelPreset); - this.groupBoxVideo.Controls.Add(this.comboBoxTune); - this.groupBoxVideo.Controls.Add(this.comboBoxPreset); - this.groupBoxVideo.Controls.Add(this.labelTune); - this.groupBoxVideo.Controls.Add(this.labelCRF); - this.groupBoxVideo.Controls.Add(this.comboBoxVideoEncoding); - this.groupBoxVideo.Controls.Add(this.comboBoxCrf); - this.groupBoxVideo.Controls.Add(this.labelVideoEncoding); - this.groupBoxVideo.Location = new System.Drawing.Point(6, 141); - this.groupBoxVideo.Name = "groupBoxVideo"; - this.groupBoxVideo.Size = new System.Drawing.Size(406, 166); - this.groupBoxVideo.TabIndex = 70; - this.groupBoxVideo.TabStop = false; - this.groupBoxVideo.Text = "Video"; - // - // buttonVideoChooseStandardRes - // - this.buttonVideoChooseStandardRes.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.buttonVideoChooseStandardRes.Location = new System.Drawing.Point(257, 15); - this.buttonVideoChooseStandardRes.Name = "buttonVideoChooseStandardRes"; - this.buttonVideoChooseStandardRes.Size = new System.Drawing.Size(69, 23); - this.buttonVideoChooseStandardRes.TabIndex = 3; - this.buttonVideoChooseStandardRes.Text = "..."; - this.buttonVideoChooseStandardRes.UseVisualStyleBackColor = true; - this.buttonVideoChooseStandardRes.Click += new System.EventHandler(this.buttonVideoChooseStandardRes_Click); - // - // groupBoxAudio - // - this.groupBoxAudio.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.groupBoxAudio.Controls.Add(this.listViewAudioTracks); - this.groupBoxAudio.Controls.Add(this.labelAudioEnc); - this.groupBoxAudio.Controls.Add(this.comboBoxAudioBitRate); - this.groupBoxAudio.Controls.Add(this.comboBoxAudioEnc); - this.groupBoxAudio.Controls.Add(this.labelAudioBitRate); - this.groupBoxAudio.Controls.Add(this.checkBoxMakeStereo); - this.groupBoxAudio.Controls.Add(this.labelAudioSampleRate); - this.groupBoxAudio.Controls.Add(this.comboBoxAudioSampleRate); - this.groupBoxAudio.Location = new System.Drawing.Point(430, 141); - this.groupBoxAudio.Name = "groupBoxAudio"; - this.groupBoxAudio.Size = new System.Drawing.Size(425, 166); - this.groupBoxAudio.TabIndex = 90; - this.groupBoxAudio.TabStop = false; - this.groupBoxAudio.Text = "Audio"; - // - // listViewAudioTracks - // - this.listViewAudioTracks.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.listViewAudioTracks.CheckBoxes = true; - this.listViewAudioTracks.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.columnHeaderAudioTrack}); - this.listViewAudioTracks.HideSelection = false; - this.listViewAudioTracks.Location = new System.Drawing.Point(229, 29); - this.listViewAudioTracks.Name = "listViewAudioTracks"; - this.listViewAudioTracks.Size = new System.Drawing.Size(190, 122); - this.listViewAudioTracks.TabIndex = 45; - this.listViewAudioTracks.UseCompatibleStateImageBehavior = false; - this.listViewAudioTracks.View = System.Windows.Forms.View.Details; - // - // columnHeaderAudioTrack - // - this.columnHeaderAudioTrack.Text = "Audio tracks"; - this.columnHeaderAudioTrack.Width = 160; - // - // checkBoxMakeStereo - // - this.checkBoxMakeStereo.AutoSize = true; - this.checkBoxMakeStereo.Checked = true; - this.checkBoxMakeStereo.CheckState = System.Windows.Forms.CheckState.Checked; - this.checkBoxMakeStereo.Location = new System.Drawing.Point(91, 58); - this.checkBoxMakeStereo.Name = "checkBoxMakeStereo"; - this.checkBoxMakeStereo.Size = new System.Drawing.Size(57, 17); - this.checkBoxMakeStereo.TabIndex = 2; - this.checkBoxMakeStereo.Text = "Stereo"; - this.checkBoxMakeStereo.UseVisualStyleBackColor = true; - // - // checkBoxTargetFileSize - // - this.checkBoxTargetFileSize.AutoSize = true; - this.checkBoxTargetFileSize.Location = new System.Drawing.Point(22, 327); - this.checkBoxTargetFileSize.Name = "checkBoxTargetFileSize"; - this.checkBoxTargetFileSize.Size = new System.Drawing.Size(192, 17); - this.checkBoxTargetFileSize.TabIndex = 100; - this.checkBoxTargetFileSize.Text = "Target file size (two pass encoding)"; - this.checkBoxTargetFileSize.UseVisualStyleBackColor = true; - this.checkBoxTargetFileSize.CheckedChanged += new System.EventHandler(this.checkBoxTargetFileSize_CheckedChanged); - // - // listViewBatch - // - this.listViewBatch.AllowDrop = true; - this.listViewBatch.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.listViewBatch.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { - this.columnHeaderVideoFile, - this.columnHeaderResolution, - this.columnHeaderSize, - this.columnHeaderSubtitleFile, - this.columnHeaderStatus}); - this.listViewBatch.ContextMenuStrip = this.contextMenuStripBatch; - this.listViewBatch.FullRowSelect = true; - this.listViewBatch.HideSelection = false; - this.listViewBatch.Location = new System.Drawing.Point(6, 316); - this.listViewBatch.Name = "listViewBatch"; - this.listViewBatch.Size = new System.Drawing.Size(852, 191); - this.listViewBatch.TabIndex = 3; - this.listViewBatch.UseCompatibleStateImageBehavior = false; - this.listViewBatch.View = System.Windows.Forms.View.Details; - this.listViewBatch.DragDrop += new System.Windows.Forms.DragEventHandler(this.listViewBatch_DragDrop); - this.listViewBatch.DragEnter += new System.Windows.Forms.DragEventHandler(this.listViewBatch_DragEnter); - this.listViewBatch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listViewBatch_KeyDown); - // - // columnHeaderVideoFile - // - this.columnHeaderVideoFile.Text = "Video file"; - this.columnHeaderVideoFile.Width = 420; - // - // columnHeaderResolution - // - this.columnHeaderResolution.Text = "Resolution"; - this.columnHeaderResolution.Width = 80; - // - // columnHeaderSize - // - this.columnHeaderSize.Text = "Size"; - this.columnHeaderSize.Width = 80; - // - // columnHeaderSubtitleFile - // - this.columnHeaderSubtitleFile.Text = "Subtitle file"; - this.columnHeaderSubtitleFile.Width = 180; - // - // columnHeaderStatus - // - this.columnHeaderStatus.Text = "Status"; - this.columnHeaderStatus.Width = 80; - // - // contextMenuStripBatch - // - this.contextMenuStripBatch.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.addFilesToolStripMenuItem, - this.toolStripSeparator2, - this.pickSubtitleFileToolStripMenuItem, - this.removeSubtitleFileToolStripMenuItem, - this.toolStripSeparator1, - this.deleteToolStripMenuItem, - this.clearToolStripMenuItem}); - this.contextMenuStripBatch.Name = "contextMenuStripBatch"; - this.contextMenuStripBatch.Size = new System.Drawing.Size(179, 126); - this.contextMenuStripBatch.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripBatch_Opening); - // - // addFilesToolStripMenuItem - // - this.addFilesToolStripMenuItem.Name = "addFilesToolStripMenuItem"; - this.addFilesToolStripMenuItem.Size = new System.Drawing.Size(178, 22); - this.addFilesToolStripMenuItem.Text = "Add video files..."; - this.addFilesToolStripMenuItem.Click += new System.EventHandler(this.addFilesToolStripMenuItem_Click); - // - // toolStripSeparator2 - // - this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(175, 6); - // - // pickSubtitleFileToolStripMenuItem - // - this.pickSubtitleFileToolStripMenuItem.Name = "pickSubtitleFileToolStripMenuItem"; - this.pickSubtitleFileToolStripMenuItem.Size = new System.Drawing.Size(178, 22); - this.pickSubtitleFileToolStripMenuItem.Text = "Pick subtitle file..."; - this.pickSubtitleFileToolStripMenuItem.Click += new System.EventHandler(this.pickSubtitleFileToolStripMenuItem_Click); - // - // removeSubtitleFileToolStripMenuItem - // - this.removeSubtitleFileToolStripMenuItem.Name = "removeSubtitleFileToolStripMenuItem"; - this.removeSubtitleFileToolStripMenuItem.Size = new System.Drawing.Size(178, 22); - this.removeSubtitleFileToolStripMenuItem.Text = "Remove subtitle file"; - this.removeSubtitleFileToolStripMenuItem.Click += new System.EventHandler(this.removeSubtitleFileToolStripMenuItem_Click); - // - // toolStripSeparator1 - // - this.toolStripSeparator1.Name = "toolStripSeparator1"; - this.toolStripSeparator1.Size = new System.Drawing.Size(175, 6); - // - // deleteToolStripMenuItem - // - this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem"; - this.deleteToolStripMenuItem.Size = new System.Drawing.Size(178, 22); - this.deleteToolStripMenuItem.Text = "Delete"; - this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click); - // - // clearToolStripMenuItem - // - this.clearToolStripMenuItem.Name = "clearToolStripMenuItem"; - this.clearToolStripMenuItem.Size = new System.Drawing.Size(178, 22); - this.clearToolStripMenuItem.Text = "Clear"; - this.clearToolStripMenuItem.Click += new System.EventHandler(this.clearToolStripMenuItem_Click); - // - // buttonPreview - // - this.buttonPreview.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonPreview.Location = new System.Drawing.Point(621, 586); - this.buttonPreview.Name = "buttonPreview"; - this.buttonPreview.Size = new System.Drawing.Size(121, 23); - this.buttonPreview.TabIndex = 130; - this.buttonPreview.Text = "Preview"; - this.buttonPreview.UseVisualStyleBackColor = true; - this.buttonPreview.Click += new System.EventHandler(this.buttonPreview_Click); - // - // linkLabelHelp - // - this.linkLabelHelp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.linkLabelHelp.AutoSize = true; - this.linkLabelHelp.Location = new System.Drawing.Point(844, 563); - this.linkLabelHelp.Name = "linkLabelHelp"; - this.linkLabelHelp.Size = new System.Drawing.Size(29, 13); - this.linkLabelHelp.TabIndex = 120; - this.linkLabelHelp.TabStop = true; - this.linkLabelHelp.Text = "Help"; - this.linkLabelHelp.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelHelp_LinkClicked); - // - // contextMenuStripRes - // - this.contextMenuStripRes.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.useSourceResoluton0x0ToolStripMenuItem, - this.x2160ToolStripMenuItem, - this.uHD3840x2160ToolStripMenuItem, - this.k2048x1080ToolStripMenuItem, - this.dCI2KScope2048x858ToolStripMenuItem, - this.dCI2KFlat1998x1080ToolStripMenuItem, - this.p1920x1080ToolStripMenuItem, - this.x1080ToolStripMenuItem, - this.p1280x720ToolStripMenuItem, - this.x720ToolStripMenuItem, - this.p848x480ToolStripMenuItem, - this.pAL720x576ToolStripMenuItem, - this.nTSC720x480ToolStripMenuItem, - this.x352ToolStripMenuItem, - this.x272ToolStripMenuItem}); - this.contextMenuStripRes.Name = "contextMenuStripRes"; - this.contextMenuStripRes.Size = new System.Drawing.Size(214, 334); - // - // x2160ToolStripMenuItem - // - this.x2160ToolStripMenuItem.Name = "x2160ToolStripMenuItem"; - this.x2160ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.x2160ToolStripMenuItem.Text = "4K (4096x2160)"; - this.x2160ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); - // - // uHD3840x2160ToolStripMenuItem - // - this.uHD3840x2160ToolStripMenuItem.Name = "uHD3840x2160ToolStripMenuItem"; - this.uHD3840x2160ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.uHD3840x2160ToolStripMenuItem.Text = "UHD (3840x2160)"; - this.uHD3840x2160ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); - // - // k2048x1080ToolStripMenuItem - // - this.k2048x1080ToolStripMenuItem.Name = "k2048x1080ToolStripMenuItem"; - this.k2048x1080ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.k2048x1080ToolStripMenuItem.Text = "2K (2048x1080)"; - this.k2048x1080ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); - // - // dCI2KScope2048x858ToolStripMenuItem - // - this.dCI2KScope2048x858ToolStripMenuItem.Name = "dCI2KScope2048x858ToolStripMenuItem"; - this.dCI2KScope2048x858ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.dCI2KScope2048x858ToolStripMenuItem.Text = "DCI 2K Scope (2048x858)"; - this.dCI2KScope2048x858ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); - // - // dCI2KFlat1998x1080ToolStripMenuItem - // - this.dCI2KFlat1998x1080ToolStripMenuItem.Name = "dCI2KFlat1998x1080ToolStripMenuItem"; - this.dCI2KFlat1998x1080ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.dCI2KFlat1998x1080ToolStripMenuItem.Text = "DCI 2K Flat (1998x1080)"; - this.dCI2KFlat1998x1080ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); - // - // p1920x1080ToolStripMenuItem - // - this.p1920x1080ToolStripMenuItem.Name = "p1920x1080ToolStripMenuItem"; - this.p1920x1080ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.p1920x1080ToolStripMenuItem.Text = "1080p (1920x1080)"; - this.p1920x1080ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); - // - // x1080ToolStripMenuItem - // - this.x1080ToolStripMenuItem.Name = "x1080ToolStripMenuItem"; - this.x1080ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.x1080ToolStripMenuItem.Text = "1440x1080"; - this.x1080ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); - // - // p1280x720ToolStripMenuItem - // - this.p1280x720ToolStripMenuItem.Name = "p1280x720ToolStripMenuItem"; - this.p1280x720ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.p1280x720ToolStripMenuItem.Text = "720p (1280x720)"; - this.p1280x720ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); - // - // x720ToolStripMenuItem - // - this.x720ToolStripMenuItem.Name = "x720ToolStripMenuItem"; - this.x720ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.x720ToolStripMenuItem.Text = "960x720"; - this.x720ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); - // - // p848x480ToolStripMenuItem - // - this.p848x480ToolStripMenuItem.Name = "p848x480ToolStripMenuItem"; - this.p848x480ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.p848x480ToolStripMenuItem.Text = "480p (848x480)"; - this.p848x480ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); - // - // pAL720x576ToolStripMenuItem - // - this.pAL720x576ToolStripMenuItem.Name = "pAL720x576ToolStripMenuItem"; - this.pAL720x576ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.pAL720x576ToolStripMenuItem.Text = "PAL (720x576)"; - this.pAL720x576ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); - // - // nTSC720x480ToolStripMenuItem - // - this.nTSC720x480ToolStripMenuItem.Name = "nTSC720x480ToolStripMenuItem"; - this.nTSC720x480ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.nTSC720x480ToolStripMenuItem.Text = "NTSC (720x480)"; - this.nTSC720x480ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); - // - // x352ToolStripMenuItem - // - this.x352ToolStripMenuItem.Name = "x352ToolStripMenuItem"; - this.x352ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.x352ToolStripMenuItem.Text = "640x352"; - this.x352ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); - // - // x272ToolStripMenuItem - // - this.x272ToolStripMenuItem.Name = "x272ToolStripMenuItem"; - this.x272ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.x272ToolStripMenuItem.Text = "640x272"; - this.x272ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); - // - // buttonMode - // - this.buttonMode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonMode.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.buttonMode.Location = new System.Drawing.Point(748, 586); - this.buttonMode.Name = "buttonMode"; - this.buttonMode.Size = new System.Drawing.Size(125, 23); - this.buttonMode.TabIndex = 143; - this.buttonMode.Text = "Batch mode"; - this.buttonMode.UseVisualStyleBackColor = true; - this.buttonMode.Click += new System.EventHandler(this.buttonMode_Click); - // - // useSourceResoluton0x0ToolStripMenuItem - // - this.useSourceResoluton0x0ToolStripMenuItem.Name = "useSourceResoluton0x0ToolStripMenuItem"; - this.useSourceResoluton0x0ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.useSourceResoluton0x0ToolStripMenuItem.Text = "Use source resoluton (0x0)"; - // - // labelPreviewPleaseWait - // - this.labelPreviewPleaseWait.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.labelPreviewPleaseWait.AutoSize = true; - this.labelPreviewPleaseWait.Location = new System.Drawing.Point(668, 570); - this.labelPreviewPleaseWait.Name = "labelPreviewPleaseWait"; - this.labelPreviewPleaseWait.Size = new System.Drawing.Size(70, 13); - this.labelPreviewPleaseWait.TabIndex = 48; - this.labelPreviewPleaseWait.Text = "Please wait..."; - // - // videoPlayerContainer1 - // - this.videoPlayerContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.videoPlayerContainer1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(18)))), ((int)(((byte)(18)))), ((int)(((byte)(18))))); - this.videoPlayerContainer1.Chapters = null; - this.videoPlayerContainer1.CurrentPosition = 0D; - this.videoPlayerContainer1.FontSizeFactor = 1F; - this.videoPlayerContainer1.LastParagraph = null; - this.videoPlayerContainer1.Location = new System.Drawing.Point(430, 313); - this.videoPlayerContainer1.Name = "videoPlayerContainer1"; - this.videoPlayerContainer1.ShowFullscreenButton = true; - this.videoPlayerContainer1.ShowMuteButton = true; - this.videoPlayerContainer1.ShowStopButton = true; - this.videoPlayerContainer1.Size = new System.Drawing.Size(431, 226); - this.videoPlayerContainer1.SubtitleText = ""; - this.videoPlayerContainer1.TabIndex = 110; - this.videoPlayerContainer1.TextRightToLeft = System.Windows.Forms.RightToLeft.No; - this.videoPlayerContainer1.UsingFrontCenterAudioChannelOnly = false; - this.videoPlayerContainer1.VideoHeight = 0; - this.videoPlayerContainer1.VideoPlayer = null; - this.videoPlayerContainer1.VideoWidth = 0; - this.videoPlayerContainer1.Volume = 0D; - // // numericUpDownCutToSeconds // this.numericUpDownCutToSeconds.BackColor = System.Drawing.SystemColors.Window; @@ -1033,6 +611,17 @@ namespace Nikse.SubtitleEdit.Forms this.labelCutFrom.TabIndex = 14; this.labelCutFrom.Text = "From"; // + // checkBoxCut + // + this.checkBoxCut.AutoSize = true; + this.checkBoxCut.Location = new System.Drawing.Point(12, 36); + this.checkBoxCut.Name = "checkBoxCut"; + this.checkBoxCut.Size = new System.Drawing.Size(42, 17); + this.checkBoxCut.TabIndex = 0; + this.checkBoxCut.Text = "Cut"; + this.checkBoxCut.UseVisualStyleBackColor = true; + this.checkBoxCut.CheckedChanged += new System.EventHandler(this.checkBoxCut_CheckedChanged); + // // labelVideoBitrate // this.labelVideoBitrate.AutoSize = true; @@ -1042,6 +631,28 @@ namespace Nikse.SubtitleEdit.Forms this.labelVideoBitrate.TabIndex = 14; this.labelVideoBitrate.Text = "labelVideoBitrate"; // + // checkBoxBox + // + this.checkBoxBox.AutoSize = true; + this.checkBoxBox.Location = new System.Drawing.Point(226, 27); + this.checkBoxBox.Name = "checkBoxBox"; + this.checkBoxBox.Size = new System.Drawing.Size(44, 17); + this.checkBoxBox.TabIndex = 2; + this.checkBoxBox.Text = "Box"; + this.checkBoxBox.UseVisualStyleBackColor = true; + this.checkBoxBox.CheckedChanged += new System.EventHandler(this.checkBoxBox_CheckedChanged); + // + // checkBoxAlignRight + // + this.checkBoxAlignRight.AutoSize = true; + this.checkBoxAlignRight.Location = new System.Drawing.Point(217, 114); + this.checkBoxAlignRight.Name = "checkBoxAlignRight"; + this.checkBoxAlignRight.Size = new System.Drawing.Size(72, 17); + this.checkBoxAlignRight.TabIndex = 10; + this.checkBoxAlignRight.Text = "Align right"; + this.checkBoxAlignRight.UseVisualStyleBackColor = true; + this.checkBoxAlignRight.CheckedChanged += new System.EventHandler(this.checkBoxAlignRight_CheckedChanged); + // // labelInfo // this.labelInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); @@ -1052,6 +663,17 @@ namespace Nikse.SubtitleEdit.Forms this.labelInfo.TabIndex = 1; this.labelInfo.Text = "Info"; // + // checkBoxRightToLeft + // + this.checkBoxRightToLeft.AutoSize = true; + this.checkBoxRightToLeft.Location = new System.Drawing.Point(120, 114); + this.checkBoxRightToLeft.Name = "checkBoxRightToLeft"; + this.checkBoxRightToLeft.Size = new System.Drawing.Size(80, 17); + this.checkBoxRightToLeft.TabIndex = 9; + this.checkBoxRightToLeft.Text = "Right to left"; + this.checkBoxRightToLeft.UseVisualStyleBackColor = true; + this.checkBoxRightToLeft.CheckedChanged += new System.EventHandler(this.checkBoxRightToLeft_CheckedChanged); + // // comboBoxSubtitleFont // this.comboBoxSubtitleFont.BackColor = System.Drawing.SystemColors.Window; @@ -1085,6 +707,29 @@ namespace Nikse.SubtitleEdit.Forms this.labelSubtitleFont.TabIndex = 7; this.labelSubtitleFont.Text = "Subtitle font"; // + // groupBoxVideo + // + this.groupBoxVideo.Controls.Add(this.labelCrfHint); + this.groupBoxVideo.Controls.Add(this.buttonVideoChooseStandardRes); + this.groupBoxVideo.Controls.Add(this.labelResolution); + this.groupBoxVideo.Controls.Add(this.numericUpDownWidth); + this.groupBoxVideo.Controls.Add(this.numericUpDownHeight); + this.groupBoxVideo.Controls.Add(this.labelX); + this.groupBoxVideo.Controls.Add(this.labelPreset); + this.groupBoxVideo.Controls.Add(this.comboBoxTune); + this.groupBoxVideo.Controls.Add(this.comboBoxPreset); + this.groupBoxVideo.Controls.Add(this.labelTune); + this.groupBoxVideo.Controls.Add(this.labelCRF); + this.groupBoxVideo.Controls.Add(this.comboBoxVideoEncoding); + this.groupBoxVideo.Controls.Add(this.comboBoxCrf); + this.groupBoxVideo.Controls.Add(this.labelVideoEncoding); + this.groupBoxVideo.Location = new System.Drawing.Point(6, 141); + this.groupBoxVideo.Name = "groupBoxVideo"; + this.groupBoxVideo.Size = new System.Drawing.Size(406, 166); + this.groupBoxVideo.TabIndex = 70; + this.groupBoxVideo.TabStop = false; + this.groupBoxVideo.Text = "Video"; + // // labelCrfHint // this.labelCrfHint.AutoSize = true; @@ -1096,6 +741,18 @@ namespace Nikse.SubtitleEdit.Forms this.labelCrfHint.TabIndex = 32; this.labelCrfHint.Text = "Hint"; // + // buttonVideoChooseStandardRes + // + this.buttonVideoChooseStandardRes.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.buttonVideoChooseStandardRes.Location = new System.Drawing.Point(257, 15); + this.buttonVideoChooseStandardRes.Name = "buttonVideoChooseStandardRes"; + this.buttonVideoChooseStandardRes.Size = new System.Drawing.Size(69, 23); + this.buttonVideoChooseStandardRes.TabIndex = 3; + this.buttonVideoChooseStandardRes.Text = "..."; + this.buttonVideoChooseStandardRes.UseVisualStyleBackColor = true; + this.buttonVideoChooseStandardRes.Click += new System.EventHandler(this.buttonVideoChooseStandardRes_Click); + // // labelResolution // this.labelResolution.AutoSize = true; @@ -1356,6 +1013,45 @@ namespace Nikse.SubtitleEdit.Forms this.labelVideoEncoding.TabIndex = 3; this.labelVideoEncoding.Text = "Video enc"; // + // groupBoxAudio + // + this.groupBoxAudio.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.groupBoxAudio.Controls.Add(this.listViewAudioTracks); + this.groupBoxAudio.Controls.Add(this.labelAudioEnc); + this.groupBoxAudio.Controls.Add(this.comboBoxAudioBitRate); + this.groupBoxAudio.Controls.Add(this.comboBoxAudioEnc); + this.groupBoxAudio.Controls.Add(this.labelAudioBitRate); + this.groupBoxAudio.Controls.Add(this.checkBoxMakeStereo); + this.groupBoxAudio.Controls.Add(this.labelAudioSampleRate); + this.groupBoxAudio.Controls.Add(this.comboBoxAudioSampleRate); + this.groupBoxAudio.Location = new System.Drawing.Point(430, 141); + this.groupBoxAudio.Name = "groupBoxAudio"; + this.groupBoxAudio.Size = new System.Drawing.Size(425, 166); + this.groupBoxAudio.TabIndex = 90; + this.groupBoxAudio.TabStop = false; + this.groupBoxAudio.Text = "Audio"; + // + // listViewAudioTracks + // + this.listViewAudioTracks.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.listViewAudioTracks.CheckBoxes = true; + this.listViewAudioTracks.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeaderAudioTrack}); + this.listViewAudioTracks.HideSelection = false; + this.listViewAudioTracks.Location = new System.Drawing.Point(229, 29); + this.listViewAudioTracks.Name = "listViewAudioTracks"; + this.listViewAudioTracks.Size = new System.Drawing.Size(190, 122); + this.listViewAudioTracks.TabIndex = 45; + this.listViewAudioTracks.UseCompatibleStateImageBehavior = false; + this.listViewAudioTracks.View = System.Windows.Forms.View.Details; + // + // columnHeaderAudioTrack + // + this.columnHeaderAudioTrack.Text = "Audio tracks"; + this.columnHeaderAudioTrack.Width = 160; + // // labelAudioEnc // this.labelAudioEnc.AutoSize = true; @@ -1431,6 +1127,18 @@ namespace Nikse.SubtitleEdit.Forms this.labelAudioBitRate.TabIndex = 4; this.labelAudioBitRate.Text = "Bit rate"; // + // checkBoxMakeStereo + // + this.checkBoxMakeStereo.AutoSize = true; + this.checkBoxMakeStereo.Checked = true; + this.checkBoxMakeStereo.CheckState = System.Windows.Forms.CheckState.Checked; + this.checkBoxMakeStereo.Location = new System.Drawing.Point(91, 58); + this.checkBoxMakeStereo.Name = "checkBoxMakeStereo"; + this.checkBoxMakeStereo.Size = new System.Drawing.Size(57, 17); + this.checkBoxMakeStereo.TabIndex = 2; + this.checkBoxMakeStereo.Text = "Stereo"; + this.checkBoxMakeStereo.UseVisualStyleBackColor = true; + // // labelAudioSampleRate // this.labelAudioSampleRate.AutoSize = true; @@ -1516,6 +1224,17 @@ namespace Nikse.SubtitleEdit.Forms this.labelFileSize.TabIndex = 12; this.labelFileSize.Text = "File size in MB"; // + // checkBoxTargetFileSize + // + this.checkBoxTargetFileSize.AutoSize = true; + this.checkBoxTargetFileSize.Location = new System.Drawing.Point(22, 327); + this.checkBoxTargetFileSize.Name = "checkBoxTargetFileSize"; + this.checkBoxTargetFileSize.Size = new System.Drawing.Size(192, 17); + this.checkBoxTargetFileSize.TabIndex = 100; + this.checkBoxTargetFileSize.Text = "Target file size (two pass encoding)"; + this.checkBoxTargetFileSize.UseVisualStyleBackColor = true; + this.checkBoxTargetFileSize.CheckedChanged += new System.EventHandler(this.checkBoxTargetFileSize_CheckedChanged); + // // labelFileName // this.labelFileName.AutoSize = true; @@ -1572,6 +1291,285 @@ namespace Nikse.SubtitleEdit.Forms this.labelFontSize.TabIndex = 0; this.labelFontSize.Text = "Font size"; // + // listViewBatch + // + this.listViewBatch.AllowDrop = true; + this.listViewBatch.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.listViewBatch.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { + this.columnHeaderVideoFile, + this.columnHeaderResolution, + this.columnHeaderSize, + this.columnHeaderSubtitleFile, + this.columnHeaderStatus}); + this.listViewBatch.ContextMenuStrip = this.contextMenuStripBatch; + this.listViewBatch.FullRowSelect = true; + this.listViewBatch.HideSelection = false; + this.listViewBatch.Location = new System.Drawing.Point(6, 316); + this.listViewBatch.Name = "listViewBatch"; + this.listViewBatch.Size = new System.Drawing.Size(852, 191); + this.listViewBatch.TabIndex = 3; + this.listViewBatch.UseCompatibleStateImageBehavior = false; + this.listViewBatch.View = System.Windows.Forms.View.Details; + this.listViewBatch.DragDrop += new System.Windows.Forms.DragEventHandler(this.listViewBatch_DragDrop); + this.listViewBatch.DragEnter += new System.Windows.Forms.DragEventHandler(this.listViewBatch_DragEnter); + this.listViewBatch.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listViewBatch_KeyDown); + // + // columnHeaderVideoFile + // + this.columnHeaderVideoFile.Text = "Video file"; + this.columnHeaderVideoFile.Width = 420; + // + // columnHeaderResolution + // + this.columnHeaderResolution.Text = "Resolution"; + this.columnHeaderResolution.Width = 80; + // + // columnHeaderSize + // + this.columnHeaderSize.Text = "Size"; + this.columnHeaderSize.Width = 80; + // + // columnHeaderSubtitleFile + // + this.columnHeaderSubtitleFile.Text = "Subtitle file"; + this.columnHeaderSubtitleFile.Width = 180; + // + // columnHeaderStatus + // + this.columnHeaderStatus.Text = "Status"; + this.columnHeaderStatus.Width = 80; + // + // contextMenuStripBatch + // + this.contextMenuStripBatch.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.addFilesToolStripMenuItem, + this.toolStripSeparator2, + this.pickSubtitleFileToolStripMenuItem, + this.removeSubtitleFileToolStripMenuItem, + this.toolStripSeparator1, + this.deleteToolStripMenuItem, + this.clearToolStripMenuItem}); + this.contextMenuStripBatch.Name = "contextMenuStripBatch"; + this.contextMenuStripBatch.Size = new System.Drawing.Size(179, 126); + this.contextMenuStripBatch.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripBatch_Opening); + // + // addFilesToolStripMenuItem + // + this.addFilesToolStripMenuItem.Name = "addFilesToolStripMenuItem"; + this.addFilesToolStripMenuItem.Size = new System.Drawing.Size(178, 22); + this.addFilesToolStripMenuItem.Text = "Add video files..."; + this.addFilesToolStripMenuItem.Click += new System.EventHandler(this.addFilesToolStripMenuItem_Click); + // + // toolStripSeparator2 + // + this.toolStripSeparator2.Name = "toolStripSeparator2"; + this.toolStripSeparator2.Size = new System.Drawing.Size(175, 6); + // + // pickSubtitleFileToolStripMenuItem + // + this.pickSubtitleFileToolStripMenuItem.Name = "pickSubtitleFileToolStripMenuItem"; + this.pickSubtitleFileToolStripMenuItem.Size = new System.Drawing.Size(178, 22); + this.pickSubtitleFileToolStripMenuItem.Text = "Pick subtitle file..."; + this.pickSubtitleFileToolStripMenuItem.Click += new System.EventHandler(this.pickSubtitleFileToolStripMenuItem_Click); + // + // removeSubtitleFileToolStripMenuItem + // + this.removeSubtitleFileToolStripMenuItem.Name = "removeSubtitleFileToolStripMenuItem"; + this.removeSubtitleFileToolStripMenuItem.Size = new System.Drawing.Size(178, 22); + this.removeSubtitleFileToolStripMenuItem.Text = "Remove subtitle file"; + this.removeSubtitleFileToolStripMenuItem.Click += new System.EventHandler(this.removeSubtitleFileToolStripMenuItem_Click); + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(175, 6); + // + // deleteToolStripMenuItem + // + this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem"; + this.deleteToolStripMenuItem.Size = new System.Drawing.Size(178, 22); + this.deleteToolStripMenuItem.Text = "Delete"; + this.deleteToolStripMenuItem.Click += new System.EventHandler(this.deleteToolStripMenuItem_Click); + // + // clearToolStripMenuItem + // + this.clearToolStripMenuItem.Name = "clearToolStripMenuItem"; + this.clearToolStripMenuItem.Size = new System.Drawing.Size(178, 22); + this.clearToolStripMenuItem.Text = "Clear"; + this.clearToolStripMenuItem.Click += new System.EventHandler(this.clearToolStripMenuItem_Click); + // + // buttonPreview + // + this.buttonPreview.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonPreview.Location = new System.Drawing.Point(621, 586); + this.buttonPreview.Name = "buttonPreview"; + this.buttonPreview.Size = new System.Drawing.Size(121, 23); + this.buttonPreview.TabIndex = 130; + this.buttonPreview.Text = "Preview"; + this.buttonPreview.UseVisualStyleBackColor = true; + this.buttonPreview.Click += new System.EventHandler(this.buttonPreview_Click); + // + // linkLabelHelp + // + this.linkLabelHelp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.linkLabelHelp.AutoSize = true; + this.linkLabelHelp.Location = new System.Drawing.Point(844, 563); + this.linkLabelHelp.Name = "linkLabelHelp"; + this.linkLabelHelp.Size = new System.Drawing.Size(29, 13); + this.linkLabelHelp.TabIndex = 120; + this.linkLabelHelp.TabStop = true; + this.linkLabelHelp.Text = "Help"; + this.linkLabelHelp.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelHelp_LinkClicked); + // + // contextMenuStripRes + // + this.contextMenuStripRes.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.useSourceResoluton0x0ToolStripMenuItem, + this.x2160ToolStripMenuItem, + this.uHD3840x2160ToolStripMenuItem, + this.k2048x1080ToolStripMenuItem, + this.dCI2KScope2048x858ToolStripMenuItem, + this.dCI2KFlat1998x1080ToolStripMenuItem, + this.p1920x1080ToolStripMenuItem, + this.x1080ToolStripMenuItem, + this.p1280x720ToolStripMenuItem, + this.x720ToolStripMenuItem, + this.p848x480ToolStripMenuItem, + this.pAL720x576ToolStripMenuItem, + this.nTSC720x480ToolStripMenuItem, + this.x352ToolStripMenuItem, + this.x272ToolStripMenuItem}); + this.contextMenuStripRes.Name = "contextMenuStripRes"; + this.contextMenuStripRes.Size = new System.Drawing.Size(214, 334); + // + // useSourceResoluton0x0ToolStripMenuItem + // + this.useSourceResoluton0x0ToolStripMenuItem.Name = "useSourceResoluton0x0ToolStripMenuItem"; + this.useSourceResoluton0x0ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.useSourceResoluton0x0ToolStripMenuItem.Text = "Use source resoluton (0x0)"; + // + // x2160ToolStripMenuItem + // + this.x2160ToolStripMenuItem.Name = "x2160ToolStripMenuItem"; + this.x2160ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.x2160ToolStripMenuItem.Text = "4K (4096x2160)"; + this.x2160ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + // + // uHD3840x2160ToolStripMenuItem + // + this.uHD3840x2160ToolStripMenuItem.Name = "uHD3840x2160ToolStripMenuItem"; + this.uHD3840x2160ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.uHD3840x2160ToolStripMenuItem.Text = "UHD (3840x2160)"; + this.uHD3840x2160ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + // + // k2048x1080ToolStripMenuItem + // + this.k2048x1080ToolStripMenuItem.Name = "k2048x1080ToolStripMenuItem"; + this.k2048x1080ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.k2048x1080ToolStripMenuItem.Text = "2K (2048x1080)"; + this.k2048x1080ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + // + // dCI2KScope2048x858ToolStripMenuItem + // + this.dCI2KScope2048x858ToolStripMenuItem.Name = "dCI2KScope2048x858ToolStripMenuItem"; + this.dCI2KScope2048x858ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.dCI2KScope2048x858ToolStripMenuItem.Text = "DCI 2K Scope (2048x858)"; + this.dCI2KScope2048x858ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + // + // dCI2KFlat1998x1080ToolStripMenuItem + // + this.dCI2KFlat1998x1080ToolStripMenuItem.Name = "dCI2KFlat1998x1080ToolStripMenuItem"; + this.dCI2KFlat1998x1080ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.dCI2KFlat1998x1080ToolStripMenuItem.Text = "DCI 2K Flat (1998x1080)"; + this.dCI2KFlat1998x1080ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + // + // p1920x1080ToolStripMenuItem + // + this.p1920x1080ToolStripMenuItem.Name = "p1920x1080ToolStripMenuItem"; + this.p1920x1080ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.p1920x1080ToolStripMenuItem.Text = "1080p (1920x1080)"; + this.p1920x1080ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + // + // x1080ToolStripMenuItem + // + this.x1080ToolStripMenuItem.Name = "x1080ToolStripMenuItem"; + this.x1080ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.x1080ToolStripMenuItem.Text = "1440x1080"; + this.x1080ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + // + // p1280x720ToolStripMenuItem + // + this.p1280x720ToolStripMenuItem.Name = "p1280x720ToolStripMenuItem"; + this.p1280x720ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.p1280x720ToolStripMenuItem.Text = "720p (1280x720)"; + this.p1280x720ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + // + // x720ToolStripMenuItem + // + this.x720ToolStripMenuItem.Name = "x720ToolStripMenuItem"; + this.x720ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.x720ToolStripMenuItem.Text = "960x720"; + this.x720ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + // + // p848x480ToolStripMenuItem + // + this.p848x480ToolStripMenuItem.Name = "p848x480ToolStripMenuItem"; + this.p848x480ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.p848x480ToolStripMenuItem.Text = "480p (848x480)"; + this.p848x480ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + // + // pAL720x576ToolStripMenuItem + // + this.pAL720x576ToolStripMenuItem.Name = "pAL720x576ToolStripMenuItem"; + this.pAL720x576ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.pAL720x576ToolStripMenuItem.Text = "PAL (720x576)"; + this.pAL720x576ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + // + // nTSC720x480ToolStripMenuItem + // + this.nTSC720x480ToolStripMenuItem.Name = "nTSC720x480ToolStripMenuItem"; + this.nTSC720x480ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.nTSC720x480ToolStripMenuItem.Text = "NTSC (720x480)"; + this.nTSC720x480ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + // + // x352ToolStripMenuItem + // + this.x352ToolStripMenuItem.Name = "x352ToolStripMenuItem"; + this.x352ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.x352ToolStripMenuItem.Text = "640x352"; + this.x352ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + // + // x272ToolStripMenuItem + // + this.x272ToolStripMenuItem.Name = "x272ToolStripMenuItem"; + this.x272ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.x272ToolStripMenuItem.Text = "640x272"; + this.x272ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + // + // buttonMode + // + this.buttonMode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonMode.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonMode.Location = new System.Drawing.Point(748, 586); + this.buttonMode.Name = "buttonMode"; + this.buttonMode.Size = new System.Drawing.Size(125, 23); + this.buttonMode.TabIndex = 143; + this.buttonMode.Text = "Batch mode"; + this.buttonMode.UseVisualStyleBackColor = true; + this.buttonMode.Click += new System.EventHandler(this.buttonMode_Click); + // + // labelPreviewPleaseWait + // + this.labelPreviewPleaseWait.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.labelPreviewPleaseWait.AutoSize = true; + this.labelPreviewPleaseWait.Location = new System.Drawing.Point(668, 570); + this.labelPreviewPleaseWait.Name = "labelPreviewPleaseWait"; + this.labelPreviewPleaseWait.Size = new System.Drawing.Size(70, 13); + this.labelPreviewPleaseWait.TabIndex = 48; + this.labelPreviewPleaseWait.Text = "Please wait..."; + // // labelPass // this.labelPass.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); @@ -1612,23 +1610,16 @@ namespace Nikse.SubtitleEdit.Forms this.textBoxLog.Size = new System.Drawing.Size(188, 26); this.textBoxLog.TabIndex = 31; // - // nikseLabelSuffix + // buttonOutputFileSettings // - this.nikseLabelSuffix.AutoSize = true; - this.nikseLabelSuffix.Location = new System.Drawing.Point(260, 518); - this.nikseLabelSuffix.Name = "nikseLabelSuffix"; - this.nikseLabelSuffix.Size = new System.Drawing.Size(33, 13); - this.nikseLabelSuffix.TabIndex = 147; - this.nikseLabelSuffix.Text = "Suffix"; - // - // nikseTextBoxSuffix - // - this.nikseTextBoxSuffix.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); - this.nikseTextBoxSuffix.Location = new System.Drawing.Point(299, 515); - this.nikseTextBoxSuffix.Name = "nikseTextBoxSuffix"; - this.nikseTextBoxSuffix.Size = new System.Drawing.Size(100, 20); - this.nikseTextBoxSuffix.TabIndex = 148; - this.nikseTextBoxSuffix.Text = "_input"; + this.buttonOutputFileSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.buttonOutputFileSettings.Location = new System.Drawing.Point(245, 513); + this.buttonOutputFileSettings.Name = "buttonOutputFileSettings"; + this.buttonOutputFileSettings.Size = new System.Drawing.Size(167, 23); + this.buttonOutputFileSettings.TabIndex = 148; + this.buttonOutputFileSettings.Text = "Output file/folder..."; + this.buttonOutputFileSettings.UseVisualStyleBackColor = true; + this.buttonOutputFileSettings.Click += new System.EventHandler(this.buttonOutputFileSettings_Click); // // GenerateVideoWithHardSubs // @@ -1779,7 +1770,6 @@ namespace Nikse.SubtitleEdit.Forms private System.Windows.Forms.ToolStripMenuItem removeSubtitleFileToolStripMenuItem; private System.Windows.Forms.ColumnHeader columnHeaderResolution; private System.Windows.Forms.ToolStripMenuItem useSourceResoluton0x0ToolStripMenuItem; - private Controls.NikseLabel nikseLabelSuffix; - private Controls.NikseTextBox nikseTextBoxSuffix; + private System.Windows.Forms.Button buttonOutputFileSettings; } } \ No newline at end of file diff --git a/src/ui/Forms/GenerateVideoWithHardSubs.cs b/src/ui/Forms/GenerateVideoWithHardSubs.cs index 1aa902015..d60ba234e 100644 --- a/src/ui/Forms/GenerateVideoWithHardSubs.cs +++ b/src/ui/Forms/GenerateVideoWithHardSubs.cs @@ -314,8 +314,7 @@ namespace Nikse.SubtitleEdit.Forms buttonRemoveFile.Visible = BatchMode; buttonClear.Visible = BatchMode; buttonAddFile.Visible = BatchMode; - nikseLabelSuffix.Visible = BatchMode; - nikseTextBoxSuffix.Visible = BatchMode; + buttonOutputFileSettings.Visible = BatchMode; var audioTracks = _mediaInfo.Tracks.Where(p => p.TrackType == FfmpegTrackType.Audio).ToList(); useSourceResoluton0x0ToolStripMenuItem.Visible = BatchMode; @@ -468,14 +467,21 @@ namespace Nikse.SubtitleEdit.Forms } var path = Path.GetDirectoryName(videoAndSub.VideoFileName); + if (Configuration.Settings.Tools.GenVideoUseOutputFolder && + !string.IsNullOrEmpty(Configuration.Settings.Tools.GenVideoOutputFolder) && + Directory.Exists(Configuration.Settings.Tools.GenVideoOutputFolder)) + { + path = Configuration.Settings.Tools.GenVideoOutputFolder; + } + var nameNoExt = Path.GetFileNameWithoutExtension(videoAndSub.VideoFileName); var ext = Path.GetExtension(videoAndSub.VideoFileName); - VideoFileName = Path.Combine(path, $"{nameNoExt.TrimEnd('.', '.')}{nikseTextBoxSuffix.Text}{ext}"); + VideoFileName = Path.Combine(path, $"{nameNoExt.TrimEnd('.', '.')}{Configuration.Settings.Tools.GenVideoOutputFileSuffix}{ext}"); if (File.Exists(VideoFileName)) { for (var i = 2; i < int.MaxValue; i++) { - VideoFileName = Path.Combine(path, $"{nameNoExt.TrimEnd('.', '.')}{nikseTextBoxSuffix.Text}_{i}{ext}"); + VideoFileName = Path.Combine(path, $"{nameNoExt.TrimEnd('.', '.')}{Configuration.Settings.Tools.GenVideoOutputFileSuffix}_{i}{ext}"); if (!File.Exists(VideoFileName)) { break; @@ -2001,8 +2007,7 @@ namespace Nikse.SubtitleEdit.Forms buttonAddFile.Visible = BatchMode; buttonRemoveFile.Visible = BatchMode; buttonClear.Visible = BatchMode; - nikseLabelSuffix.Visible = BatchMode; - nikseTextBoxSuffix.Visible = BatchMode; + buttonOutputFileSettings.Visible = BatchMode; buttonMode.Text = BatchMode ? LanguageSettings.Current.Split.Basic : LanguageSettings.Current.AudioToText.BatchMode; @@ -2249,5 +2254,13 @@ namespace Nikse.SubtitleEdit.Forms _batchVideoAndSubList[i].SubtitleFileName = null; } } + + private void buttonOutputFileSettings_Click(object sender, EventArgs e) + { + using (var form = new GenerateVideoWithHardSubsOutFile()) + { + form.ShowDialog(this); + } + } } } diff --git a/src/ui/Forms/GenerateVideoWithHardSubsOutFile.Designer.cs b/src/ui/Forms/GenerateVideoWithHardSubsOutFile.Designer.cs new file mode 100644 index 000000000..ea4625633 --- /dev/null +++ b/src/ui/Forms/GenerateVideoWithHardSubsOutFile.Designer.cs @@ -0,0 +1,183 @@ +namespace Nikse.SubtitleEdit.Forms +{ + partial class GenerateVideoWithHardSubsOutFile + { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() + { + this.radioButtonSaveInOutputFolder = new System.Windows.Forms.RadioButton(); + this.linkLabelOpenOutputFolder = new System.Windows.Forms.LinkLabel(); + this.buttonChooseFolder = new System.Windows.Forms.Button(); + this.textBoxOutputFolder = new Nikse.SubtitleEdit.Controls.NikseTextBox(); + this.radioButtonSaveInSourceFolder = new System.Windows.Forms.RadioButton(); + this.labelSuffix = new System.Windows.Forms.Label(); + this.textBoxSuffix = new Nikse.SubtitleEdit.Controls.NikseTextBox(); + this.buttonCancel = new System.Windows.Forms.Button(); + this.buttonOK = new System.Windows.Forms.Button(); + this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog(); + this.SuspendLayout(); + // + // radioButtonSaveInOutputFolder + // + this.radioButtonSaveInOutputFolder.AutoSize = true; + this.radioButtonSaveInOutputFolder.Location = new System.Drawing.Point(21, 54); + this.radioButtonSaveInOutputFolder.Name = "radioButtonSaveInOutputFolder"; + this.radioButtonSaveInOutputFolder.Size = new System.Drawing.Size(154, 17); + this.radioButtonSaveInOutputFolder.TabIndex = 6; + this.radioButtonSaveInOutputFolder.Text = "Save in output folder below"; + this.radioButtonSaveInOutputFolder.UseVisualStyleBackColor = true; + this.radioButtonSaveInOutputFolder.CheckedChanged += new System.EventHandler(this.radioButtonSaveInOutputFolder_CheckedChanged); + // + // linkLabelOpenOutputFolder + // + this.linkLabelOpenOutputFolder.AutoSize = true; + this.linkLabelOpenOutputFolder.Location = new System.Drawing.Point(368, 83); + this.linkLabelOpenOutputFolder.Name = "linkLabelOpenOutputFolder"; + this.linkLabelOpenOutputFolder.Size = new System.Drawing.Size(42, 13); + this.linkLabelOpenOutputFolder.TabIndex = 9; + this.linkLabelOpenOutputFolder.TabStop = true; + this.linkLabelOpenOutputFolder.Text = "Open..."; + this.linkLabelOpenOutputFolder.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelOpenOutputFolder_LinkClicked); + // + // buttonChooseFolder + // + this.buttonChooseFolder.Enabled = false; + this.buttonChooseFolder.Location = new System.Drawing.Point(336, 78); + this.buttonChooseFolder.Name = "buttonChooseFolder"; + this.buttonChooseFolder.Size = new System.Drawing.Size(26, 23); + this.buttonChooseFolder.TabIndex = 8; + this.buttonChooseFolder.Text = "..."; + this.buttonChooseFolder.UseVisualStyleBackColor = true; + this.buttonChooseFolder.Click += new System.EventHandler(this.buttonChooseFolder_Click); + // + // textBoxOutputFolder + // + this.textBoxOutputFolder.Enabled = false; + this.textBoxOutputFolder.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.textBoxOutputFolder.Location = new System.Drawing.Point(28, 81); + this.textBoxOutputFolder.Name = "textBoxOutputFolder"; + this.textBoxOutputFolder.Size = new System.Drawing.Size(302, 20); + this.textBoxOutputFolder.TabIndex = 7; + // + // radioButtonSaveInSourceFolder + // + this.radioButtonSaveInSourceFolder.AutoSize = true; + this.radioButtonSaveInSourceFolder.Checked = true; + this.radioButtonSaveInSourceFolder.Location = new System.Drawing.Point(21, 23); + this.radioButtonSaveInSourceFolder.Name = "radioButtonSaveInSourceFolder"; + this.radioButtonSaveInSourceFolder.Size = new System.Drawing.Size(141, 17); + this.radioButtonSaveInSourceFolder.TabIndex = 5; + this.radioButtonSaveInSourceFolder.TabStop = true; + this.radioButtonSaveInSourceFolder.Text = "Save in source file folder"; + this.radioButtonSaveInSourceFolder.UseVisualStyleBackColor = true; + this.radioButtonSaveInSourceFolder.CheckedChanged += new System.EventHandler(this.radioButtonSaveInSourceFolder_CheckedChanged); + // + // labelSuffix + // + this.labelSuffix.AutoSize = true; + this.labelSuffix.Location = new System.Drawing.Point(21, 135); + this.labelSuffix.Name = "labelSuffix"; + this.labelSuffix.Size = new System.Drawing.Size(79, 13); + this.labelSuffix.TabIndex = 11; + this.labelSuffix.Text = "File name suffix"; + // + // textBoxSuffix + // + this.textBoxSuffix.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.textBoxSuffix.Location = new System.Drawing.Point(21, 151); + this.textBoxSuffix.Name = "textBoxSuffix"; + this.textBoxSuffix.Size = new System.Drawing.Size(309, 20); + this.textBoxSuffix.TabIndex = 12; + // + // buttonCancel + // + this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonCancel.Location = new System.Drawing.Point(349, 214); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(75, 23); + this.buttonCancel.TabIndex = 105; + this.buttonCancel.Text = "C&ancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); + // + // buttonOK + // + this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonOK.DialogResult = System.Windows.Forms.DialogResult.OK; + this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonOK.Location = new System.Drawing.Point(268, 214); + this.buttonOK.Name = "buttonOK"; + this.buttonOK.Size = new System.Drawing.Size(75, 23); + this.buttonOK.TabIndex = 104; + this.buttonOK.Text = "&OK"; + this.buttonOK.UseVisualStyleBackColor = true; + this.buttonOK.Click += new System.EventHandler(this.buttonOK_Click); + // + // GenerateVideoWithHardSubsOutFile + // + this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.ClientSize = new System.Drawing.Size(436, 249); + this.Controls.Add(this.buttonCancel); + this.Controls.Add(this.buttonOK); + this.Controls.Add(this.labelSuffix); + this.Controls.Add(this.textBoxSuffix); + this.Controls.Add(this.radioButtonSaveInOutputFolder); + this.Controls.Add(this.linkLabelOpenOutputFolder); + this.Controls.Add(this.buttonChooseFolder); + this.Controls.Add(this.textBoxOutputFolder); + this.Controls.Add(this.radioButtonSaveInSourceFolder); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.KeyPreview = true; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "GenerateVideoWithHardSubsOutFile"; + this.ShowIcon = false; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "GenerateVideoWithHardSubsOutFile"; + this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.GenerateVideoWithHardSubsOutFile_KeyDown); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.RadioButton radioButtonSaveInOutputFolder; + private System.Windows.Forms.LinkLabel linkLabelOpenOutputFolder; + private System.Windows.Forms.Button buttonChooseFolder; + private Controls.NikseTextBox textBoxOutputFolder; + private System.Windows.Forms.RadioButton radioButtonSaveInSourceFolder; + private System.Windows.Forms.Label labelSuffix; + private Controls.NikseTextBox textBoxSuffix; + private System.Windows.Forms.Button buttonCancel; + private System.Windows.Forms.Button buttonOK; + private System.Windows.Forms.FolderBrowserDialog folderBrowserDialog1; + } +} \ No newline at end of file diff --git a/src/ui/Forms/GenerateVideoWithHardSubsOutFile.cs b/src/ui/Forms/GenerateVideoWithHardSubsOutFile.cs new file mode 100644 index 000000000..e877d7955 --- /dev/null +++ b/src/ui/Forms/GenerateVideoWithHardSubsOutFile.cs @@ -0,0 +1,130 @@ +using Nikse.SubtitleEdit.Logic; +using System; +using System.IO; +using System.Windows.Forms; +using Nikse.SubtitleEdit.Core.Common; + +namespace Nikse.SubtitleEdit.Forms +{ + public partial class GenerateVideoWithHardSubsOutFile : Form + { + public GenerateVideoWithHardSubsOutFile() + { + UiUtil.PreInitialize(this); + InitializeComponent(); + UiUtil.FixFonts(this); + + labelSuffix.Text = LanguageSettings.Current.Settings.Suffix; + buttonOK.Text = LanguageSettings.Current.General.Ok; + buttonCancel.Text = LanguageSettings.Current.General.Cancel; + + if (string.IsNullOrEmpty(Configuration.Settings.Tools.GenVideoOutputFolder) || !Directory.Exists(Configuration.Settings.Tools.GenVideoOutputFolder)) + { + textBoxOutputFolder.Text = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "Output"); + } + else + { + textBoxOutputFolder.Text = Configuration.Settings.Tools.GenVideoOutputFolder; + } + + textBoxSuffix.Text = Configuration.Settings.Tools.GenVideoOutputFileSuffix; + if (Configuration.Settings.Tools.GenVideoUseOutputFolder) + { + radioButtonSaveInOutputFolder.Checked = true; + } + else + { + radioButtonSaveInSourceFolder.Checked = true; + } + + radioButtonSaveInSourceFolder_CheckedChanged(null, null); + } + + private void GenerateVideoWithHardSubsOutFile_KeyDown(object sender, KeyEventArgs e) + { + if (e.KeyCode == Keys.Escape) + { + DialogResult = DialogResult.Cancel; + } + } + + private void buttonOK_Click(object sender, EventArgs e) + { + if (radioButtonSaveInOutputFolder.Checked && string.IsNullOrWhiteSpace(textBoxOutputFolder.Text)) + { + MessageBox.Show("Please choose output folder"); + return; + } + + + try + { + if (!Directory.Exists(textBoxOutputFolder.Text)) + { + Directory.CreateDirectory(textBoxOutputFolder.Text); + } + } + catch (Exception exception) + { + MessageBox.Show("Please choose output folder" + Environment.NewLine + exception.Message); + return; + } + + Configuration.Settings.Tools.GenVideoOutputFolder = textBoxOutputFolder.Text; + Configuration.Settings.Tools.GenVideoOutputFileSuffix = textBoxSuffix.Text; + Configuration.Settings.Tools.GenVideoUseOutputFolder = radioButtonSaveInOutputFolder.Checked; + + DialogResult = DialogResult.OK; + } + + private void buttonCancel_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.Cancel; + } + + private void buttonChooseFolder_Click(object sender, EventArgs e) + { + folderBrowserDialog1.ShowNewFolderButton = true; + if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) + { + textBoxOutputFolder.Text = folderBrowserDialog1.SelectedPath; + } + } + + private void linkLabelOpenOutputFolder_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) + { + if (!Directory.Exists(textBoxOutputFolder.Text)) + { + try + { + Directory.CreateDirectory(textBoxOutputFolder.Text); + } + catch + { + // ignore + } + } + + if (Directory.Exists(textBoxOutputFolder.Text)) + { + UiUtil.OpenFolder(textBoxOutputFolder.Text); + } + else + { + MessageBox.Show(string.Format(LanguageSettings.Current.SplitSubtitle.FolderNotFoundX, textBoxOutputFolder.Text)); + } + } + + private void radioButtonSaveInSourceFolder_CheckedChanged(object sender, EventArgs e) + { + textBoxOutputFolder.Enabled = !radioButtonSaveInSourceFolder.Checked; + buttonChooseFolder.Enabled = !radioButtonSaveInSourceFolder.Checked; + } + + private void radioButtonSaveInOutputFolder_CheckedChanged(object sender, EventArgs e) + { + textBoxOutputFolder.Enabled = !radioButtonSaveInSourceFolder.Checked; + buttonChooseFolder.Enabled = !radioButtonSaveInSourceFolder.Checked; + } + } +} diff --git a/src/ui/Forms/GenerateVideoWithHardSubsOutFile.resx b/src/ui/Forms/GenerateVideoWithHardSubsOutFile.resx new file mode 100644 index 000000000..69f943da9 --- /dev/null +++ b/src/ui/Forms/GenerateVideoWithHardSubsOutFile.resx @@ -0,0 +1,123 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + 17, 17 + + \ No newline at end of file diff --git a/src/ui/SubtitleEdit.csproj b/src/ui/SubtitleEdit.csproj index c388c26fe..d8eb752d0 100644 --- a/src/ui/SubtitleEdit.csproj +++ b/src/ui/SubtitleEdit.csproj @@ -385,6 +385,12 @@ VoskModelDownload.cs + + Form + + + GenerateVideoWithHardSubsOutFile.cs + Form @@ -1834,6 +1840,9 @@ GenerateVideoFFmpegPrompt.cs + + GenerateVideoWithHardSubsOutFile.cs + GenerateVideoWithSoftSubs.cs From bffb62a2bb86b83c2daa241a355e28ce06ad5523 Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Sun, 21 Apr 2024 16:17:27 +0200 Subject: [PATCH 6/8] Fix "use source" context menu - thx Leon :) Work on #8210 --- .../GenerateVideoWithHardSubs.Designer.cs | 27 ++++++++++--------- src/ui/Forms/GenerateVideoWithHardSubs.cs | 1 + 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs b/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs index 9645427b6..8a3422745 100644 --- a/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs +++ b/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs @@ -37,6 +37,7 @@ namespace Nikse.SubtitleEdit.Forms this.buttonCancel = new System.Windows.Forms.Button(); this.timer1 = new System.Windows.Forms.Timer(this.components); this.groupBoxSettings = new System.Windows.Forms.GroupBox(); + this.buttonOutputFileSettings = new System.Windows.Forms.Button(); this.buttonClear = new System.Windows.Forms.Button(); this.panelForeColor = new System.Windows.Forms.Panel(); this.buttonRemoveFile = new System.Windows.Forms.Button(); @@ -133,7 +134,6 @@ namespace Nikse.SubtitleEdit.Forms this.labelProgress = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.labelPleaseWait = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.textBoxLog = new Nikse.SubtitleEdit.Controls.NikseTextBox(); - this.buttonOutputFileSettings = new System.Windows.Forms.Button(); this.contextMenuStripGenerate.SuspendLayout(); this.groupBoxSettings.SuspendLayout(); this.groupBoxCut.SuspendLayout(); @@ -236,6 +236,17 @@ namespace Nikse.SubtitleEdit.Forms this.groupBoxSettings.TabStop = false; this.groupBoxSettings.Text = "Settings"; // + // buttonOutputFileSettings + // + this.buttonOutputFileSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); + this.buttonOutputFileSettings.Location = new System.Drawing.Point(245, 513); + this.buttonOutputFileSettings.Name = "buttonOutputFileSettings"; + this.buttonOutputFileSettings.Size = new System.Drawing.Size(167, 23); + this.buttonOutputFileSettings.TabIndex = 148; + this.buttonOutputFileSettings.Text = "Output file/folder..."; + this.buttonOutputFileSettings.UseVisualStyleBackColor = true; + this.buttonOutputFileSettings.Click += new System.EventHandler(this.buttonOutputFileSettings_Click); + // // buttonClear // this.buttonClear.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); @@ -1442,13 +1453,14 @@ namespace Nikse.SubtitleEdit.Forms this.x352ToolStripMenuItem, this.x272ToolStripMenuItem}); this.contextMenuStripRes.Name = "contextMenuStripRes"; - this.contextMenuStripRes.Size = new System.Drawing.Size(214, 334); + this.contextMenuStripRes.Size = new System.Drawing.Size(214, 356); // // useSourceResoluton0x0ToolStripMenuItem // this.useSourceResoluton0x0ToolStripMenuItem.Name = "useSourceResoluton0x0ToolStripMenuItem"; this.useSourceResoluton0x0ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); this.useSourceResoluton0x0ToolStripMenuItem.Text = "Use source resoluton (0x0)"; + this.useSourceResoluton0x0ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // // x2160ToolStripMenuItem // @@ -1610,17 +1622,6 @@ namespace Nikse.SubtitleEdit.Forms this.textBoxLog.Size = new System.Drawing.Size(188, 26); this.textBoxLog.TabIndex = 31; // - // buttonOutputFileSettings - // - this.buttonOutputFileSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.buttonOutputFileSettings.Location = new System.Drawing.Point(245, 513); - this.buttonOutputFileSettings.Name = "buttonOutputFileSettings"; - this.buttonOutputFileSettings.Size = new System.Drawing.Size(167, 23); - this.buttonOutputFileSettings.TabIndex = 148; - this.buttonOutputFileSettings.Text = "Output file/folder..."; - this.buttonOutputFileSettings.UseVisualStyleBackColor = true; - this.buttonOutputFileSettings.Click += new System.EventHandler(this.buttonOutputFileSettings_Click); - // // GenerateVideoWithHardSubs // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/src/ui/Forms/GenerateVideoWithHardSubs.cs b/src/ui/Forms/GenerateVideoWithHardSubs.cs index d60ba234e..7363c8d0a 100644 --- a/src/ui/Forms/GenerateVideoWithHardSubs.cs +++ b/src/ui/Forms/GenerateVideoWithHardSubs.cs @@ -441,6 +441,7 @@ namespace Nikse.SubtitleEdit.Forms Stopwatch stopWatch; if (BatchMode) { + checkBoxTargetFileSize.Checked = false; var useSourceResolution = numericUpDownWidth.Value == 0 && numericUpDownHeight.Value == 0; listViewBatch.SelectedIndices.Clear(); From 83a7aece4826ffb0c2dc8b9e3c0f2eabdfbcd3c6 Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Sun, 21 Apr 2024 19:15:41 +0200 Subject: [PATCH 7/8] Return edited subtitle from tts - thx cvrle77 :) Work on #8230 --- src/ui/Forms/Main.cs | 8 +- src/ui/Forms/Tts/RegenerateAudioClip.cs | 8 +- src/ui/Forms/Tts/ReviewAudioClips.Designer.cs | 28 +++---- src/ui/Forms/Tts/ReviewAudioClips.cs | 13 ++-- src/ui/Forms/Tts/TextToSpeech.Designer.cs | 20 ++++- src/ui/Forms/Tts/TextToSpeech.cs | 78 +++++++++++++------ 6 files changed, 104 insertions(+), 51 deletions(-) diff --git a/src/ui/Forms/Main.cs b/src/ui/Forms/Main.cs index a2e94a07b..7f5e1b895 100644 --- a/src/ui/Forms/Main.cs +++ b/src/ui/Forms/Main.cs @@ -36804,9 +36804,13 @@ namespace Nikse.SubtitleEdit.Forms { using (var form = new TextToSpeech(_subtitle, GetCurrentSubtitleFormat(), _videoFileName, _videoInfo)) { - if (form.ShowDialog(this) != DialogResult.OK) + if (form.ShowDialog(this) == DialogResult.OK) { - return; + var idx = FirstSelectedIndex; + _subtitle = form.EditedSubtitle; + SubtitleListview1.Fill(_subtitle, _subtitleOriginal); + _subtitleListViewIndex = -1; + SubtitleListview1.SelectIndexAndEnsureVisibleFaster(idx); } } } diff --git a/src/ui/Forms/Tts/RegenerateAudioClip.cs b/src/ui/Forms/Tts/RegenerateAudioClip.cs index 2905c6c7a..4dd960de3 100644 --- a/src/ui/Forms/Tts/RegenerateAudioClip.cs +++ b/src/ui/Forms/Tts/RegenerateAudioClip.cs @@ -7,7 +7,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts { public partial class RegenerateAudioClip : Form { - public string NewAudioFileName { get; set; } + public TextToSpeech.FileNameAndSpeedFactor FileNameAndSpeedFactor { get; set; } private readonly TextToSpeech _textToSpeech; private readonly Subtitle _subtitle; @@ -39,10 +39,10 @@ namespace Nikse.SubtitleEdit.Forms.Tts { Cursor = Cursors.WaitCursor; buttonReGenerate.Enabled = false; - var fileName = await _textToSpeech.GenerateAudio(paragraph, nikseComboBoxVoice.Text); - if (!string.IsNullOrEmpty(fileName)) + var fileNameAndSpeedFactor = await _textToSpeech.ReGenerateAudio(paragraph, nikseComboBoxVoice.Text); + if (fileNameAndSpeedFactor != null) { - NewAudioFileName = fileName; + FileNameAndSpeedFactor = fileNameAndSpeedFactor; Cursor = Cursors.Default; DialogResult = DialogResult.OK; } diff --git a/src/ui/Forms/Tts/ReviewAudioClips.Designer.cs b/src/ui/Forms/Tts/ReviewAudioClips.Designer.cs index b8c127d12..c744cc41b 100644 --- a/src/ui/Forms/Tts/ReviewAudioClips.Designer.cs +++ b/src/ui/Forms/Tts/ReviewAudioClips.Designer.cs @@ -40,7 +40,7 @@ this.labelParagraphInfo = new System.Windows.Forms.Label(); this.checkBoxContinuePlay = new System.Windows.Forms.CheckBox(); this.buttonStop = new System.Windows.Forms.Button(); - this.buttonReGenerate = new System.Windows.Forms.Button(); + this.buttonEdit = new System.Windows.Forms.Button(); this.SuspendLayout(); // // listView1 @@ -137,7 +137,7 @@ // this.checkBoxContinuePlay.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.checkBoxContinuePlay.AutoSize = true; - this.checkBoxContinuePlay.Location = new System.Drawing.Point(703, 353); + this.checkBoxContinuePlay.Location = new System.Drawing.Point(717, 354); this.checkBoxContinuePlay.Name = "checkBoxContinuePlay"; this.checkBoxContinuePlay.Size = new System.Drawing.Size(92, 17); this.checkBoxContinuePlay.TabIndex = 11; @@ -156,24 +156,24 @@ this.buttonStop.UseVisualStyleBackColor = true; this.buttonStop.Click += new System.EventHandler(this.buttonStop_Click); // - // buttonReGenerate + // buttonEdit // - this.buttonReGenerate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonReGenerate.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.buttonReGenerate.Location = new System.Drawing.Point(703, 249); - this.buttonReGenerate.Name = "buttonReGenerate"; - this.buttonReGenerate.Size = new System.Drawing.Size(180, 23); - this.buttonReGenerate.TabIndex = 13; - this.buttonReGenerate.Text = "Regenerate"; - this.buttonReGenerate.UseVisualStyleBackColor = true; - this.buttonReGenerate.Click += new System.EventHandler(this.buttonReGenerate_Click); + this.buttonEdit.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonEdit.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonEdit.Location = new System.Drawing.Point(703, 249); + this.buttonEdit.Name = "buttonEdit"; + this.buttonEdit.Size = new System.Drawing.Size(180, 23); + this.buttonEdit.TabIndex = 13; + this.buttonEdit.Text = "Edit"; + this.buttonEdit.UseVisualStyleBackColor = true; + this.buttonEdit.Click += new System.EventHandler(this.buttonEdit_Click); // // ReviewAudioClips // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(894, 448); - this.Controls.Add(this.buttonReGenerate); + this.Controls.Add(this.buttonEdit); this.Controls.Add(this.buttonStop); this.Controls.Add(this.checkBoxContinuePlay); this.Controls.Add(this.labelParagraphInfo); @@ -211,6 +211,6 @@ private System.Windows.Forms.Label labelParagraphInfo; private System.Windows.Forms.CheckBox checkBoxContinuePlay; private System.Windows.Forms.Button buttonStop; - private System.Windows.Forms.Button buttonReGenerate; + private System.Windows.Forms.Button buttonEdit; } } \ No newline at end of file diff --git a/src/ui/Forms/Tts/ReviewAudioClips.cs b/src/ui/Forms/Tts/ReviewAudioClips.cs index 4250dc722..763a2eb3d 100644 --- a/src/ui/Forms/Tts/ReviewAudioClips.cs +++ b/src/ui/Forms/Tts/ReviewAudioClips.cs @@ -14,12 +14,12 @@ namespace Nikse.SubtitleEdit.Forms.Tts private readonly Subtitle _subtitle; private readonly TextToSpeech _textToSpeech; - private readonly List _fileNames; + private readonly List _fileNames; private bool _abortPlay; private LibMpvDynamic _libMpv; private Timer _mpvDoneTimer; - public ReviewAudioClips(TextToSpeech textToSpeech, Subtitle subtitle, List fileNames) + public ReviewAudioClips(TextToSpeech textToSpeech, Subtitle subtitle, List fileNames) { UiUtil.PreInitialize(this); InitializeComponent(); @@ -90,7 +90,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts } var idx = listView1.SelectedItems[0].Index; - var waveFileName = _fileNames[idx]; + var waveFileName = _fileNames[idx].Filename; if (_libMpv != null) { @@ -129,7 +129,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts listView1.Items[idx + 1].Selected = true; listView1.Items[idx + 1].Focused = true; listView1.Items[idx + 1].EnsureVisible(); - TaskDelayHelper.RunDelayed(TimeSpan.FromMilliseconds(10), () => Play()); + TaskDelayHelper.RunDelayed(TimeSpan.FromMilliseconds(10), () => Play()); Application.DoEvents(); } } @@ -192,7 +192,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts } } - private void buttonReGenerate_Click(object sender, EventArgs e) + private void buttonEdit_Click(object sender, EventArgs e) { if (listView1.SelectedItems.Count == 0) { @@ -205,7 +205,8 @@ namespace Nikse.SubtitleEdit.Forms.Tts var dr = form.ShowDialog(this); if (dr == DialogResult.OK) { - _fileNames[idx] = form.NewAudioFileName; + _fileNames[idx].Filename = form.FileNameAndSpeedFactor.Filename; + _fileNames[idx].Factor = form.FileNameAndSpeedFactor.Factor; listView1.Items[idx].SubItems[4].Text = _subtitle.Paragraphs[idx].Text; Play(true); } diff --git a/src/ui/Forms/Tts/TextToSpeech.Designer.cs b/src/ui/Forms/Tts/TextToSpeech.Designer.cs index fa33f5a00..6caf5b275 100644 --- a/src/ui/Forms/Tts/TextToSpeech.Designer.cs +++ b/src/ui/Forms/Tts/TextToSpeech.Designer.cs @@ -49,6 +49,7 @@ this.TextBoxTest = new Nikse.SubtitleEdit.Controls.NikseTextBox(); this.nikseComboBoxVoice = new Nikse.SubtitleEdit.Controls.NikseComboBox(); this.nikseComboBoxEngine = new Nikse.SubtitleEdit.Controls.NikseComboBox(); + this.buttonCancel = new System.Windows.Forms.Button(); this.groupBoxMsSettings.SuspendLayout(); this.SuspendLayout(); // @@ -56,7 +57,7 @@ // this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.buttonOK.Location = new System.Drawing.Point(767, 456); + this.buttonOK.Location = new System.Drawing.Point(686, 456); this.buttonOK.Name = "buttonOK"; this.buttonOK.Size = new System.Drawing.Size(75, 23); this.buttonOK.TabIndex = 100; @@ -93,7 +94,7 @@ | System.Windows.Forms.AnchorStyles.Right))); this.progressBar1.Location = new System.Drawing.Point(12, 456); this.progressBar1.Name = "progressBar1"; - this.progressBar1.Size = new System.Drawing.Size(749, 10); + this.progressBar1.Size = new System.Drawing.Size(665, 10); this.progressBar1.TabIndex = 12; // // labelEngine @@ -302,11 +303,25 @@ this.nikseComboBoxEngine.UsePopupWindow = false; this.nikseComboBoxEngine.SelectedIndexChanged += new System.EventHandler(this.nikseComboBoxEngine_SelectedIndexChanged); // + // buttonCancel + // + this.buttonCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); + this.buttonCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.buttonCancel.Location = new System.Drawing.Point(767, 456); + this.buttonCancel.Name = "buttonCancel"; + this.buttonCancel.Size = new System.Drawing.Size(75, 23); + this.buttonCancel.TabIndex = 101; + this.buttonCancel.Text = "C&ancel"; + this.buttonCancel.UseVisualStyleBackColor = true; + this.buttonCancel.Click += new System.EventHandler(this.buttonCancel_Click); + // // TextToSpeech // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(854, 491); + this.Controls.Add(this.buttonCancel); this.Controls.Add(this.labelActors); this.Controls.Add(this.listViewActors); this.Controls.Add(this.groupBoxMsSettings); @@ -354,5 +369,6 @@ private System.Windows.Forms.Label labelApiKey; private Controls.NikseTextBox nikseTextBoxApiKey; private System.Windows.Forms.CheckBox checkBoxShowPreview; + private System.Windows.Forms.Button buttonCancel; } } \ No newline at end of file diff --git a/src/ui/Forms/Tts/TextToSpeech.cs b/src/ui/Forms/Tts/TextToSpeech.cs index 04017fe44..5b59db3e4 100644 --- a/src/ui/Forms/Tts/TextToSpeech.cs +++ b/src/ui/Forms/Tts/TextToSpeech.cs @@ -21,6 +21,8 @@ namespace Nikse.SubtitleEdit.Forms.Tts { public sealed partial class TextToSpeech : Form { + public Subtitle EditedSubtitle { get; set; } + private readonly Subtitle _subtitle; private readonly string _videoFileName; private readonly VideoInfo _videoInfo; @@ -41,6 +43,12 @@ namespace Nikse.SubtitleEdit.Forms.Tts public int VoiceIndex { get; set; } } + public class FileNameAndSpeedFactor + { + public string Filename { get; set; } + public decimal Factor { get; set; } + } + public class TextToSpeechEngine { public TextToSpeechEngineId Id { get; set; } @@ -89,6 +97,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts checkBoxAddToVideoFile.Text = LanguageSettings.Current.TextToSpeech.AddAudioToVideo; buttonGenerateTTS.Text = LanguageSettings.Current.TextToSpeech.GenerateSpeech; buttonOK.Text = LanguageSettings.Current.General.Ok; + buttonCancel.Text = LanguageSettings.Current.General.Cancel; UiUtil.FixLargeFonts(this, buttonOK); progressBar1.Visible = false; @@ -193,7 +202,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts return; } - var fileNames = FixParagraphAudioSpeed(); + var fileNameAndSpeedFactors = FixParagraphAudioSpeed(_subtitle, null); if (_abort) { HandleAbort(); @@ -202,7 +211,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts if (checkBoxShowPreview.Checked) { - using (var form = new ReviewAudioClips(this, _subtitle, fileNames)) + using (var form = new ReviewAudioClips(this, _subtitle, fileNameAndSpeedFactors)) { var dr = form.ShowDialog(this); if (dr != DialogResult.OK) @@ -214,12 +223,12 @@ namespace Nikse.SubtitleEdit.Forms.Tts foreach (var idx in form.SkipIndices) { - fileNames[idx] = null; // skip these files + fileNameAndSpeedFactors[idx] = null; // skip these files } } } - var tempAudioFile = MergeAudioParagraphs(fileNames); + var tempAudioFile = MergeAudioParagraphs(fileNameAndSpeedFactors); if (_abort) { HandleAbort(); @@ -330,37 +339,47 @@ namespace Nikse.SubtitleEdit.Forms.Tts } } - private List FixParagraphAudioSpeed() + private List FixParagraphAudioSpeed(Subtitle subtitle, string overrideFileName) { - var fileNames = new List(_subtitle.Paragraphs.Count); + var fileNames = new List(subtitle.Paragraphs.Count); labelProgress.Text = string.Empty; labelProgress.Refresh(); Application.DoEvents(); progressBar1.Value = 0; - progressBar1.Maximum = _subtitle.Paragraphs.Count; + progressBar1.Maximum = subtitle.Paragraphs.Count; progressBar1.Visible = true; - for (var index = 0; index < _subtitle.Paragraphs.Count; index++) + for (var index = 0; index < subtitle.Paragraphs.Count; index++) { progressBar1.Value = index + 1; - labelProgress.Text = string.Format(LanguageSettings.Current.TextToSpeech.AdjustingSpeedXOfY, index + 1, _subtitle.Paragraphs.Count); - var p = _subtitle.Paragraphs[index]; - var next = _subtitle.GetParagraphOrDefault(index + 1); + labelProgress.Text = string.Format(LanguageSettings.Current.TextToSpeech.AdjustingSpeedXOfY, index + 1, subtitle.Paragraphs.Count); + var p = subtitle.Paragraphs[index]; + var next = subtitle.GetParagraphOrDefault(index + 1); var pFileName = Path.Combine(_waveFolder, index + ".wav"); + if (!string.IsNullOrEmpty(overrideFileName) && File.Exists(Path.Combine(_waveFolder, overrideFileName))) + { + pFileName = Path.Combine(_waveFolder, overrideFileName); + } + if (!File.Exists(pFileName)) { pFileName = Path.Combine(_waveFolder, index + ".mp3"); } var outputFileName1 = Path.Combine(_waveFolder, index + "_u.wav"); + if (!string.IsNullOrEmpty(overrideFileName) && File.Exists(Path.Combine(_waveFolder, overrideFileName))) + { + outputFileName1 = Path.Combine(_waveFolder, Path.GetFileNameWithoutExtension(overrideFileName) + "_u.wav"); + } + var trimProcess = VideoPreviewGenerator.TrimSilenceStartAndEnd(pFileName, outputFileName1); trimProcess.Start(); while (!trimProcess.HasExited) { if (_abort) { - return new List(); + return new List(); } } @@ -377,19 +396,24 @@ namespace Nikse.SubtitleEdit.Forms.Tts if (_abort) { - return new List(); + return new List(); } var waveInfo = UiUtil.GetVideoInfo(outputFileName1); if (waveInfo.TotalMilliseconds <= p.DurationTotalMilliseconds + addDuration) { - fileNames.Add(outputFileName1); + fileNames.Add(new FileNameAndSpeedFactor { Filename = outputFileName1, Factor = 1 }); continue; } - var factor = waveInfo.TotalMilliseconds / (p.DurationTotalMilliseconds + addDuration); + var factor = (decimal)waveInfo.TotalMilliseconds / (decimal)(p.DurationTotalMilliseconds + addDuration); var outputFileName2 = Path.Combine(_waveFolder, index + "_t.wav"); - fileNames.Add(outputFileName2); + if (!string.IsNullOrEmpty(overrideFileName) && File.Exists(Path.Combine(_waveFolder, overrideFileName))) + { + outputFileName2 = Path.Combine(_waveFolder, Path.GetFileNameWithoutExtension(overrideFileName) + "_t.wav"); + } + + fileNames.Add(new FileNameAndSpeedFactor { Filename = outputFileName2, Factor = factor }); var mergeProcess = VideoPreviewGenerator.ChangeSpeed(outputFileName1, outputFileName2, (float)factor); mergeProcess.Start(); @@ -398,7 +422,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts Application.DoEvents(); if (_abort) { - return new List(); + return new List(); } } } @@ -406,7 +430,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts return fileNames; } - private string MergeAudioParagraphs(List fileNames) + private string MergeAudioParagraphs(List fileNames) { labelProgress.Text = string.Empty; labelProgress.Refresh(); @@ -427,14 +451,14 @@ namespace Nikse.SubtitleEdit.Forms.Tts labelProgress.Text = string.Format(LanguageSettings.Current.TextToSpeech.MergingAudioTrackXOfY, index + 1, _subtitle.Paragraphs.Count); var p = _subtitle.Paragraphs[index]; var pFileName = fileNames[index]; - if (!File.Exists(pFileName)) + if (!File.Exists(pFileName.Filename)) { - SeLogger.Error($"TextToSpeech: File not found (skipping): {pFileName}"); + SeLogger.Error($"TextToSpeech: File not found (skipping): {pFileName.Filename}"); continue; } outputFileName = Path.Combine(_waveFolder, $"silence{index}.wav"); - var mergeProcess = VideoPreviewGenerator.MergeAudioTracks(inputFileName, pFileName, outputFileName, (float)p.StartTime.TotalSeconds); + var mergeProcess = VideoPreviewGenerator.MergeAudioTracks(inputFileName, pFileName.Filename, outputFileName, (float)p.StartTime.TotalSeconds); inputFileName = outputFileName; mergeProcess.Start(); @@ -864,6 +888,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts private void buttonOK_Click(object sender, EventArgs e) { + EditedSubtitle = _subtitle; DialogResult = DialogResult.OK; } @@ -1174,7 +1199,7 @@ namespace Nikse.SubtitleEdit.Forms.Tts listViewActors.AutoSizeLastColumn(); } - public async Task GenerateAudio(Paragraph p, string voice) + public async Task ReGenerateAudio(Paragraph p, string voice) { nikseComboBoxVoice.Text = voice; var sub = new Subtitle(); @@ -1186,7 +1211,9 @@ namespace Nikse.SubtitleEdit.Forms.Tts return null; } - return Path.Combine(_waveFolder, waveFileNameOnly); + var fileNameAndSpeedFactors = FixParagraphAudioSpeed(sub, waveFileNameOnly); + + return fileNameAndSpeedFactors.First(); } private async void buttonTestVoice_Click(object sender, EventArgs e) @@ -1326,5 +1353,10 @@ namespace Nikse.SubtitleEdit.Forms.Tts nikseComboBox.SelectedIndex = nikseComboBoxVoice.SelectedIndex; } + + private void buttonCancel_Click(object sender, EventArgs e) + { + DialogResult = DialogResult.Cancel; + } } } \ No newline at end of file From b56f93d99d75e13a9237f4eac78fafb36622d416 Mon Sep 17 00:00:00 2001 From: Nikolaj Olsson Date: Sun, 21 Apr 2024 19:32:10 +0200 Subject: [PATCH 8/8] Fix for "Source resolution" in burn-in - thx Leon :) Work on #8210 --- .../GenerateVideoWithHardSubs.Designer.cs | 47 ++++++++-------- src/ui/Forms/GenerateVideoWithHardSubs.cs | 56 +++++++++++++------ 2 files changed, 63 insertions(+), 40 deletions(-) diff --git a/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs b/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs index 8a3422745..175765e03 100644 --- a/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs +++ b/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs @@ -113,7 +113,7 @@ namespace Nikse.SubtitleEdit.Forms this.buttonPreview = new System.Windows.Forms.Button(); this.linkLabelHelp = new System.Windows.Forms.LinkLabel(); this.contextMenuStripRes = new System.Windows.Forms.ContextMenuStrip(this.components); - this.useSourceResoluton0x0ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.useSourceResolutionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.x2160ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.uHD3840x2160ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.k2048x1080ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -1437,7 +1437,7 @@ namespace Nikse.SubtitleEdit.Forms // contextMenuStripRes // this.contextMenuStripRes.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { - this.useSourceResoluton0x0ToolStripMenuItem, + this.useSourceResolutionToolStripMenuItem, this.x2160ToolStripMenuItem, this.uHD3840x2160ToolStripMenuItem, this.k2048x1080ToolStripMenuItem, @@ -1453,110 +1453,111 @@ namespace Nikse.SubtitleEdit.Forms this.x352ToolStripMenuItem, this.x272ToolStripMenuItem}); this.contextMenuStripRes.Name = "contextMenuStripRes"; - this.contextMenuStripRes.Size = new System.Drawing.Size(214, 356); + this.contextMenuStripRes.Size = new System.Drawing.Size(204, 334); + this.contextMenuStripRes.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripRes_Opening); // - // useSourceResoluton0x0ToolStripMenuItem + // useSourceResolutionToolStripMenuItem // - this.useSourceResoluton0x0ToolStripMenuItem.Name = "useSourceResoluton0x0ToolStripMenuItem"; - this.useSourceResoluton0x0ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); - this.useSourceResoluton0x0ToolStripMenuItem.Text = "Use source resoluton (0x0)"; - this.useSourceResoluton0x0ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); + this.useSourceResolutionToolStripMenuItem.Name = "useSourceResolutionToolStripMenuItem"; + this.useSourceResolutionToolStripMenuItem.Size = new System.Drawing.Size(203, 22); + this.useSourceResolutionToolStripMenuItem.Text = "Use source resoluton"; + this.useSourceResolutionToolStripMenuItem.Click += new System.EventHandler(this.useSourceResolutionToolStripMenuItem_Click); // // x2160ToolStripMenuItem // this.x2160ToolStripMenuItem.Name = "x2160ToolStripMenuItem"; - this.x2160ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.x2160ToolStripMenuItem.Size = new System.Drawing.Size(203, 22); this.x2160ToolStripMenuItem.Text = "4K (4096x2160)"; this.x2160ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // // uHD3840x2160ToolStripMenuItem // this.uHD3840x2160ToolStripMenuItem.Name = "uHD3840x2160ToolStripMenuItem"; - this.uHD3840x2160ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.uHD3840x2160ToolStripMenuItem.Size = new System.Drawing.Size(203, 22); this.uHD3840x2160ToolStripMenuItem.Text = "UHD (3840x2160)"; this.uHD3840x2160ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // // k2048x1080ToolStripMenuItem // this.k2048x1080ToolStripMenuItem.Name = "k2048x1080ToolStripMenuItem"; - this.k2048x1080ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.k2048x1080ToolStripMenuItem.Size = new System.Drawing.Size(203, 22); this.k2048x1080ToolStripMenuItem.Text = "2K (2048x1080)"; this.k2048x1080ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // // dCI2KScope2048x858ToolStripMenuItem // this.dCI2KScope2048x858ToolStripMenuItem.Name = "dCI2KScope2048x858ToolStripMenuItem"; - this.dCI2KScope2048x858ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.dCI2KScope2048x858ToolStripMenuItem.Size = new System.Drawing.Size(203, 22); this.dCI2KScope2048x858ToolStripMenuItem.Text = "DCI 2K Scope (2048x858)"; this.dCI2KScope2048x858ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // // dCI2KFlat1998x1080ToolStripMenuItem // this.dCI2KFlat1998x1080ToolStripMenuItem.Name = "dCI2KFlat1998x1080ToolStripMenuItem"; - this.dCI2KFlat1998x1080ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.dCI2KFlat1998x1080ToolStripMenuItem.Size = new System.Drawing.Size(203, 22); this.dCI2KFlat1998x1080ToolStripMenuItem.Text = "DCI 2K Flat (1998x1080)"; this.dCI2KFlat1998x1080ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // // p1920x1080ToolStripMenuItem // this.p1920x1080ToolStripMenuItem.Name = "p1920x1080ToolStripMenuItem"; - this.p1920x1080ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.p1920x1080ToolStripMenuItem.Size = new System.Drawing.Size(203, 22); this.p1920x1080ToolStripMenuItem.Text = "1080p (1920x1080)"; this.p1920x1080ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // // x1080ToolStripMenuItem // this.x1080ToolStripMenuItem.Name = "x1080ToolStripMenuItem"; - this.x1080ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.x1080ToolStripMenuItem.Size = new System.Drawing.Size(203, 22); this.x1080ToolStripMenuItem.Text = "1440x1080"; this.x1080ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // // p1280x720ToolStripMenuItem // this.p1280x720ToolStripMenuItem.Name = "p1280x720ToolStripMenuItem"; - this.p1280x720ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.p1280x720ToolStripMenuItem.Size = new System.Drawing.Size(203, 22); this.p1280x720ToolStripMenuItem.Text = "720p (1280x720)"; this.p1280x720ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // // x720ToolStripMenuItem // this.x720ToolStripMenuItem.Name = "x720ToolStripMenuItem"; - this.x720ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.x720ToolStripMenuItem.Size = new System.Drawing.Size(203, 22); this.x720ToolStripMenuItem.Text = "960x720"; this.x720ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // // p848x480ToolStripMenuItem // this.p848x480ToolStripMenuItem.Name = "p848x480ToolStripMenuItem"; - this.p848x480ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.p848x480ToolStripMenuItem.Size = new System.Drawing.Size(203, 22); this.p848x480ToolStripMenuItem.Text = "480p (848x480)"; this.p848x480ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // // pAL720x576ToolStripMenuItem // this.pAL720x576ToolStripMenuItem.Name = "pAL720x576ToolStripMenuItem"; - this.pAL720x576ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.pAL720x576ToolStripMenuItem.Size = new System.Drawing.Size(203, 22); this.pAL720x576ToolStripMenuItem.Text = "PAL (720x576)"; this.pAL720x576ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // // nTSC720x480ToolStripMenuItem // this.nTSC720x480ToolStripMenuItem.Name = "nTSC720x480ToolStripMenuItem"; - this.nTSC720x480ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.nTSC720x480ToolStripMenuItem.Size = new System.Drawing.Size(203, 22); this.nTSC720x480ToolStripMenuItem.Text = "NTSC (720x480)"; this.nTSC720x480ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // // x352ToolStripMenuItem // this.x352ToolStripMenuItem.Name = "x352ToolStripMenuItem"; - this.x352ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.x352ToolStripMenuItem.Size = new System.Drawing.Size(203, 22); this.x352ToolStripMenuItem.Text = "640x352"; this.x352ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // // x272ToolStripMenuItem // this.x272ToolStripMenuItem.Name = "x272ToolStripMenuItem"; - this.x272ToolStripMenuItem.Size = new System.Drawing.Size(213, 22); + this.x272ToolStripMenuItem.Size = new System.Drawing.Size(203, 22); this.x272ToolStripMenuItem.Text = "640x272"; this.x272ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); // @@ -1770,7 +1771,7 @@ namespace Nikse.SubtitleEdit.Forms private System.Windows.Forms.ToolStripSeparator toolStripSeparator2; private System.Windows.Forms.ToolStripMenuItem removeSubtitleFileToolStripMenuItem; private System.Windows.Forms.ColumnHeader columnHeaderResolution; - private System.Windows.Forms.ToolStripMenuItem useSourceResoluton0x0ToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem useSourceResolutionToolStripMenuItem; private System.Windows.Forms.Button buttonOutputFileSettings; } } \ No newline at end of file diff --git a/src/ui/Forms/GenerateVideoWithHardSubs.cs b/src/ui/Forms/GenerateVideoWithHardSubs.cs index 7363c8d0a..070f81a10 100644 --- a/src/ui/Forms/GenerateVideoWithHardSubs.cs +++ b/src/ui/Forms/GenerateVideoWithHardSubs.cs @@ -317,12 +317,10 @@ namespace Nikse.SubtitleEdit.Forms buttonOutputFileSettings.Visible = BatchMode; var audioTracks = _mediaInfo.Tracks.Where(p => p.TrackType == FfmpegTrackType.Audio).ToList(); - useSourceResoluton0x0ToolStripMenuItem.Visible = BatchMode; if (BatchMode) { listViewAudioTracks.Visible = false; - numericUpDownWidth.Value = 0; - numericUpDownHeight.Value = 0; + useSourceResolutionToolStripMenuItem_Click(null, null); } else if (audioTracks.Count > 1) { @@ -1537,20 +1535,7 @@ namespace Nikse.SubtitleEdit.Forms private void MediaPlayer_OnButtonClicked(object sender, EventArgs e) { - if (sender is PictureBox pb && pb.Name == "_pictureBoxFullscreenOver") - { - if (_previewVideo != null && !_previewVideo.IsDisposed) - { - _previewVideo.Close(); - _previewVideo.Dispose(); - _previewVideo = null; - } - else - { - _previewVideo = new PreviewVideo(_inputVideoFileName, _mpvSubtitleFileName, _assaSubtitle, true); - _previewVideo.Show(this); - } - } + } private void checkBoxTargetFileSize_CheckedChanged(object sender, EventArgs e) @@ -1749,6 +1734,11 @@ namespace Nikse.SubtitleEdit.Forms private void ResolutionPickClick(object sender, EventArgs e) { + labelX.Left = numericUpDownWidth.Left + numericUpDownWidth.Width + 3; + numericUpDownWidth.Visible = true; + labelX.Text = "x"; + numericUpDownHeight.Visible = true; + var text = (sender as ToolStripMenuItem).Text; var match = new Regex("\\d+x\\d+").Match(text); var parts = match.Value.Split('x'); @@ -2014,6 +2004,21 @@ namespace Nikse.SubtitleEdit.Forms : LanguageSettings.Current.AudioToText.BatchMode; FontEnableOrDisable(BatchMode || _initialFontOn); + + if (!numericUpDownWidth.Visible) + { + var item = new ToolStripMenuItem(); + if (_videoInfo == null) + { + item.Text = "(1920x1080)"; + } + else + { + item.Text = $"({_videoInfo.Width}x{_videoInfo.Height})"; + } + + ResolutionPickClick(item, null); + } } private void addFilesToolStripMenuItem_Click(object sender, EventArgs e) @@ -2263,5 +2268,22 @@ namespace Nikse.SubtitleEdit.Forms form.ShowDialog(this); } } + + private void useSourceResolutionToolStripMenuItem_Click(object sender, EventArgs e) + { + numericUpDownWidth.Visible = false; + numericUpDownHeight.Visible = false; + + labelX.Left = numericUpDownWidth.Left; + labelX.Text = "Use source"; + + numericUpDownWidth.Value = 0; + numericUpDownHeight.Value = 0; + } + + private void contextMenuStripRes_Opening(object sender, System.ComponentModel.CancelEventArgs e) + { + useSourceResolutionToolStripMenuItem.Visible = BatchMode; + } } }