Add video file ext for gen transparent subs - thx David :)

Work on #8674
This commit is contained in:
Nikolaj Olsson 2024-07-29 08:31:30 +02:00
parent 9ee39eb029
commit c9ce9c9575
4 changed files with 65 additions and 3 deletions

View File

@ -4066,6 +4066,12 @@ namespace Nikse.SubtitleEdit.Core.Settings
settings.Tools.GenTransparentVideoNonAssaBoxPerLine = Convert.ToBoolean(subNode.InnerText, CultureInfo.InvariantCulture);
}
subNode = node.SelectSingleNode("GenTransparentVideoExtension");
if (subNode != null)
{
settings.Tools.GenTransparentVideoExtension = subNode.InnerText;
}
subNode = node.SelectSingleNode("GenVideoNonAssaBoxColor");
if (subNode != null)
{
@ -9276,6 +9282,7 @@ namespace Nikse.SubtitleEdit.Core.Settings
textWriter.WriteElementString("GenVideoNonAssaBox", settings.Tools.GenVideoNonAssaBox.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("GenTransparentVideoNonAssaBox", settings.Tools.GenTransparentVideoNonAssaBox.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("GenTransparentVideoNonAssaBoxPerLine", settings.Tools.GenTransparentVideoNonAssaBoxPerLine.ToString(CultureInfo.InvariantCulture));
textWriter.WriteElementString("GenTransparentVideoExtension", settings.Tools.GenTransparentVideoExtension);
textWriter.WriteElementString("GenVideoNonAssaBoxColor", ToHtml(settings.Tools.GenVideoNonAssaBoxColor));
textWriter.WriteElementString("GenVideoNonAssaTextColor", ToHtml(settings.Tools.GenVideoNonAssaTextColor));
textWriter.WriteElementString("GenVideoNonAssaShadowColor", ToHtml(settings.Tools.GenVideoNonAssaShadowColor));

View File

@ -389,6 +389,7 @@ namespace Nikse.SubtitleEdit.Core.Settings
public bool GenVideoNonAssaBox { get; set; }
public bool GenTransparentVideoNonAssaBox { get; set; }
public bool GenTransparentVideoNonAssaBoxPerLine { get; set; }
public string GenTransparentVideoExtension { get; set; }
public Color GenVideoNonAssaBoxColor { get; set; }
public Color GenVideoNonAssaTextColor { get; set; }
public Color GenVideoNonAssaShadowColor { get; set; }
@ -670,6 +671,7 @@ namespace Nikse.SubtitleEdit.Core.Settings
GenVideoEmbedOutputSuffix = "embed";
GenVideoEmbedOutputReplace = "embed" + Environment.NewLine + "SoftSub" + Environment.NewLine + "SoftSubbed";
GenVideoOutputFileSuffix = "_new";
GenTransparentVideoExtension = ".mkv";
VoskPostProcessing = true;
WhisperChoice = Configuration.IsRunningOnWindows ? AudioToText.WhisperChoice.PurfviewFasterWhisper : AudioToText.WhisperChoice.OpenAi;
WhisperDeleteTempFiles = true;

View File

@ -128,6 +128,8 @@
this.labelProgress = new Nikse.SubtitleEdit.Controls.NikseLabel();
this.labelPleaseWait = new Nikse.SubtitleEdit.Controls.NikseLabel();
this.textBoxLog = new Nikse.SubtitleEdit.Controls.NikseTextBox();
this.nikseLabelVideoExtension = new Nikse.SubtitleEdit.Controls.NikseLabel();
this.nikseComboBoxVideoExtension = new Nikse.SubtitleEdit.Controls.NikseComboBox();
this.contextMenuStripBatch.SuspendLayout();
this.contextMenuStripRes.SuspendLayout();
this.groupBoxSettings.SuspendLayout();
@ -1103,6 +1105,8 @@
//
// groupBoxVideo
//
this.groupBoxVideo.Controls.Add(this.nikseLabelVideoExtension);
this.groupBoxVideo.Controls.Add(this.nikseComboBoxVideoExtension);
this.groupBoxVideo.Controls.Add(this.labelFrameRate);
this.groupBoxVideo.Controls.Add(this.comboBoxFrameRate);
this.groupBoxVideo.Controls.Add(this.buttonVideoChooseStandardRes);
@ -1139,7 +1143,7 @@
this.comboBoxFrameRate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown;
this.comboBoxFrameRate.DropDownWidth = 200;
this.comboBoxFrameRate.FormattingEnabled = true;
this.comboBoxFrameRate.Location = new System.Drawing.Point(96, 46);
this.comboBoxFrameRate.Location = new System.Drawing.Point(96, 47);
this.comboBoxFrameRate.MaxLength = 32767;
this.comboBoxFrameRate.Name = "comboBoxFrameRate";
this.comboBoxFrameRate.SelectedIndex = -1;
@ -1417,6 +1421,39 @@
this.textBoxLog.Size = new System.Drawing.Size(188, 26);
this.textBoxLog.TabIndex = 148;
//
// nikseLabelVideoExtension
//
this.nikseLabelVideoExtension.AutoSize = true;
this.nikseLabelVideoExtension.Location = new System.Drawing.Point(185, 52);
this.nikseLabelVideoExtension.Name = "nikseLabelVideoExtension";
this.nikseLabelVideoExtension.Size = new System.Drawing.Size(82, 13);
this.nikseLabelVideoExtension.TabIndex = 34;
this.nikseLabelVideoExtension.Text = "Video extension";
//
// nikseComboBoxVideoExtension
//
this.nikseComboBoxVideoExtension.BackColor = System.Drawing.SystemColors.Window;
this.nikseComboBoxVideoExtension.BackColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(240)))), ((int)(((byte)(240)))));
this.nikseComboBoxVideoExtension.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(171)))), ((int)(((byte)(173)))), ((int)(((byte)(179)))));
this.nikseComboBoxVideoExtension.BorderColorDisabled = System.Drawing.Color.FromArgb(((int)(((byte)(120)))), ((int)(((byte)(120)))), ((int)(((byte)(120)))));
this.nikseComboBoxVideoExtension.ButtonForeColor = System.Drawing.SystemColors.ControlText;
this.nikseComboBoxVideoExtension.ButtonForeColorDown = System.Drawing.Color.Orange;
this.nikseComboBoxVideoExtension.ButtonForeColorOver = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215)))));
this.nikseComboBoxVideoExtension.DropDownHeight = 400;
this.nikseComboBoxVideoExtension.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDown;
this.nikseComboBoxVideoExtension.DropDownWidth = 200;
this.nikseComboBoxVideoExtension.FormattingEnabled = true;
this.nikseComboBoxVideoExtension.Location = new System.Drawing.Point(268, 47);
this.nikseComboBoxVideoExtension.MaxLength = 32767;
this.nikseComboBoxVideoExtension.Name = "nikseComboBoxVideoExtension";
this.nikseComboBoxVideoExtension.SelectedIndex = -1;
this.nikseComboBoxVideoExtension.SelectedItem = null;
this.nikseComboBoxVideoExtension.SelectedText = "";
this.nikseComboBoxVideoExtension.Size = new System.Drawing.Size(64, 23);
this.nikseComboBoxVideoExtension.TabIndex = 35;
this.nikseComboBoxVideoExtension.TabStop = false;
this.nikseComboBoxVideoExtension.UsePopupWindow = false;
//
// GenerateTransparentVideoWithSubtitles
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -1560,5 +1597,7 @@
private System.Windows.Forms.ToolStripMenuItem removeVideoFileToolStripMenuItem;
private System.Windows.Forms.Button buttonCutToText;
private System.Windows.Forms.Button buttonCutFromText;
private Controls.NikseLabel nikseLabelVideoExtension;
private Controls.NikseComboBox nikseComboBoxVideoExtension;
}
}

View File

@ -96,6 +96,7 @@ namespace Nikse.SubtitleEdit.Forms
radioButtonSelectedLineAndForward.Text = LanguageSettings.Current.ShowEarlierLater.SelectedLinesAndForward;
nikseLabelBoxType.Text = LanguageSettings.Current.SubStationAlphaStyles.BoxType;
useSourceResolutionToolStripMenuItem.Text = LanguageSettings.Current.GenerateVideoWithBurnedInSubs.UseSourceResolution;
nikseComboBoxVideoExtension.Text = LanguageSettings.Current.ExportCustomTextFormat.FileExtension;
comboBoxOpaqueBoxStyle.Items.Clear();
comboBoxOpaqueBoxStyle.Items.Add(LanguageSettings.Current.SubStationAlphaStyles.BoxPerLineShort);
@ -103,6 +104,11 @@ namespace Nikse.SubtitleEdit.Forms
comboBoxOpaqueBoxStyle.SelectedIndex = Configuration.Settings.Tools.GenTransparentVideoNonAssaBoxPerLine ? 0 : 1;
comboBoxOpaqueBoxStyle.Enabled = false;
nikseComboBoxVideoExtension.Items.Clear();
nikseComboBoxVideoExtension.Items.Add(".mkv");
nikseComboBoxVideoExtension.Items.Add(".mp4");
nikseComboBoxVideoExtension.Text = Configuration.Settings.Tools.GenTransparentVideoExtension;
progressBar1.Visible = false;
labelPleaseWait.Visible = false;
labelProgress.Text = string.Empty;
@ -126,6 +132,8 @@ namespace Nikse.SubtitleEdit.Forms
numericUpDownHeight.Left = labelX.Left + labelX.Width + 3;
buttonVideoChooseStandardRes.Left = numericUpDownHeight.Left + numericUpDownHeight.Width + 9;
labelInfo.Text = LanguageSettings.Current.GenerateVideoWithBurnedInSubs.InfoAssaOff;
nikseLabelVideoExtension.Left = comboBoxFrameRate.Right + 9;
nikseComboBoxVideoExtension.Left = nikseLabelVideoExtension.Right + 3;
checkBoxFontBold.Left = numericUpDownFontSize.Right + 12;
checkBoxBox.Left = numericUpDownOutline.Right + 12;
@ -518,7 +526,12 @@ namespace Nikse.SubtitleEdit.Forms
}
var nameNoExt = Path.GetFileNameWithoutExtension(batchItem.SubtitleFileName);
var ext = ".mp4"; //TODO: use setting form .mkv/.mp4/?
var ext = Configuration.Settings.Tools.GenTransparentVideoExtension;
if (string.IsNullOrEmpty(ext) || !ext.StartsWith("."))
{
ext = ".mkv";
}
var outputFileName = Path.Combine(path, $"{nameNoExt.TrimEnd('.', '.')}{Configuration.Settings.Tools.GenVideoOutputFileSuffix}{ext}");
return outputFileName;
@ -914,6 +927,7 @@ namespace Nikse.SubtitleEdit.Forms
Configuration.Settings.Tools.GenVideoNonAssaTextColor = panelForeColor.BackColor;
Configuration.Settings.Tools.GenVideoNonAssaShadowColor = panelShadowColor.BackColor;
Configuration.Settings.Tools.GenTransparentVideoNonAssaBoxPerLine = comboBoxOpaqueBoxStyle.SelectedIndex == 0;
Configuration.Settings.Tools.GenTransparentVideoExtension = nikseComboBoxVideoExtension.Text;
}
private void radioButtonAllLines_CheckedChanged(object sender, EventArgs e)