diff --git a/Changelog.txt b/Changelog.txt index e8629b01b..ab4d8f4cb 100644 --- a/Changelog.txt +++ b/Changelog.txt @@ -12,6 +12,7 @@ * Update Polish translation - thx admas * Update Korean translation - thx domddol * Show Vosk/Whisper done msgbox modal (also if not focused) - thx jupester + * Allow re-encode with burn-in without subtitle - thx Leon * FIXED: * Fix for Antrophic translate - thx venomousraid * Fix possible crash in teletext reading - thx yellobyte diff --git a/Ocr/Latin.nocr b/Ocr/Latin.nocr index 6f11a4a38..844f688c1 100644 Binary files a/Ocr/Latin.nocr and b/Ocr/Latin.nocr differ diff --git a/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs b/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs index 715f79c2b..d0e8379ba 100644 --- a/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs +++ b/src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs @@ -90,9 +90,19 @@ 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.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.pickSubtitleFileToolStripMenuItem = 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.textBoxLog = new Nikse.SubtitleEdit.Controls.NikseTextBox(); this.contextMenuStripRes = new System.Windows.Forms.ContextMenuStrip(this.components); this.x2160ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.uHD3840x2160ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); @@ -108,15 +118,21 @@ namespace Nikse.SubtitleEdit.Forms this.nTSC720x480ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.x352ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.x272ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.buttonMode = new System.Windows.Forms.Button(); this.labelPreviewPleaseWait = 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.buttonClear = new System.Windows.Forms.Button(); + this.buttonRemoveFile = new System.Windows.Forms.Button(); + this.buttonAddFile = new System.Windows.Forms.Button(); this.contextMenuStripGenerate.SuspendLayout(); this.groupBoxSettings.SuspendLayout(); this.groupBoxCut.SuspendLayout(); this.groupBoxVideo.SuspendLayout(); this.groupBoxAudio.SuspendLayout(); + this.contextMenuStripBatch.SuspendLayout(); this.contextMenuStripRes.SuspendLayout(); this.SuspendLayout(); // @@ -126,7 +142,7 @@ namespace Nikse.SubtitleEdit.Forms | System.Windows.Forms.AnchorStyles.Right))); this.progressBar1.Location = new System.Drawing.Point(12, 615); this.progressBar1.Name = "progressBar1"; - this.progressBar1.Size = new System.Drawing.Size(653, 11); + this.progressBar1.Size = new System.Drawing.Size(603, 11); this.progressBar1.TabIndex = 22; this.progressBar1.Visible = false; // @@ -135,7 +151,7 @@ namespace Nikse.SubtitleEdit.Forms this.buttonGenerate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.buttonGenerate.ContextMenuStrip = this.contextMenuStripGenerate; this.buttonGenerate.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.buttonGenerate.Location = new System.Drawing.Point(671, 615); + this.buttonGenerate.Location = new System.Drawing.Point(621, 615); this.buttonGenerate.Name = "buttonGenerate"; this.buttonGenerate.Size = new System.Drawing.Size(121, 23); this.buttonGenerate.TabIndex = 140; @@ -162,9 +178,9 @@ namespace Nikse.SubtitleEdit.Forms 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(798, 615); + this.buttonCancel.Location = new System.Drawing.Point(748, 615); this.buttonCancel.Name = "buttonCancel"; - this.buttonCancel.Size = new System.Drawing.Size(75, 23); + this.buttonCancel.Size = new System.Drawing.Size(125, 23); this.buttonCancel.TabIndex = 141; this.buttonCancel.Text = "C&ancel"; this.buttonCancel.UseVisualStyleBackColor = true; @@ -180,8 +196,11 @@ 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.buttonClear); this.groupBoxSettings.Controls.Add(this.panelForeColor); + this.groupBoxSettings.Controls.Add(this.buttonRemoveFile); this.groupBoxSettings.Controls.Add(this.buttonForeColor); + this.groupBoxSettings.Controls.Add(this.buttonAddFile); this.groupBoxSettings.Controls.Add(this.panelOutlineColor); this.groupBoxSettings.Controls.Add(this.buttonOutlineColor); this.groupBoxSettings.Controls.Add(this.videoPlayerContainer1); @@ -201,6 +220,7 @@ namespace Nikse.SubtitleEdit.Forms this.groupBoxSettings.Controls.Add(this.labelFileName); this.groupBoxSettings.Controls.Add(this.numericUpDownFontSize); this.groupBoxSettings.Controls.Add(this.labelFontSize); + this.groupBoxSettings.Controls.Add(this.listViewBatch); this.groupBoxSettings.Location = new System.Drawing.Point(12, 13); this.groupBoxSettings.Name = "groupBoxSettings"; this.groupBoxSettings.Size = new System.Drawing.Size(861, 547); @@ -1209,10 +1229,96 @@ 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.columnHeaderSize, + this.columnHeaderSubtitleFile, + this.columnHeaderStatus}); + this.listViewBatch.ContextMenuStrip = this.contextMenuStripBatch; + 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); + // + // columnHeaderVideoFile + // + this.columnHeaderVideoFile.Text = "Video file"; + this.columnHeaderVideoFile.Width = 400; + // + // columnHeaderSize + // + this.columnHeaderSize.Text = "Size"; + this.columnHeaderSize.Width = 140; + // + // columnHeaderSubtitleFile + // + this.columnHeaderSubtitleFile.Text = "Subtitle file"; + this.columnHeaderSubtitleFile.Width = 200; + // + // columnHeaderStatus + // + this.columnHeaderStatus.Text = "Status"; + this.columnHeaderStatus.Width = 80; + // + // contextMenuStripBatch + // + this.contextMenuStripBatch.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.addFilesToolStripMenuItem, + this.pickSubtitleFileToolStripMenuItem, + this.toolStripSeparator1, + this.deleteToolStripMenuItem, + this.clearToolStripMenuItem}); + this.contextMenuStripBatch.Name = "contextMenuStripBatch"; + this.contextMenuStripBatch.Size = new System.Drawing.Size(167, 98); + this.contextMenuStripBatch.Opening += new System.ComponentModel.CancelEventHandler(this.contextMenuStripBatch_Opening); + // + // addFilesToolStripMenuItem + // + this.addFilesToolStripMenuItem.Name = "addFilesToolStripMenuItem"; + this.addFilesToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.addFilesToolStripMenuItem.Text = "Add video files..."; + this.addFilesToolStripMenuItem.Click += new System.EventHandler(this.addFilesToolStripMenuItem_Click); + // + // pickSubtitleFileToolStripMenuItem + // + this.pickSubtitleFileToolStripMenuItem.Name = "pickSubtitleFileToolStripMenuItem"; + this.pickSubtitleFileToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.pickSubtitleFileToolStripMenuItem.Text = "Pick subtitle file..."; + // + // toolStripSeparator1 + // + this.toolStripSeparator1.Name = "toolStripSeparator1"; + this.toolStripSeparator1.Size = new System.Drawing.Size(177, 6); + // + // deleteToolStripMenuItem + // + this.deleteToolStripMenuItem.Name = "deleteToolStripMenuItem"; + this.deleteToolStripMenuItem.Size = new System.Drawing.Size(180, 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(180, 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(671, 586); + 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; @@ -1232,16 +1338,6 @@ namespace Nikse.SubtitleEdit.Forms this.linkLabelHelp.Text = "Help"; this.linkLabelHelp.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelHelp_LinkClicked); // - // textBoxLog - // - this.textBoxLog.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); - this.textBoxLog.Location = new System.Drawing.Point(12, 13); - this.textBoxLog.Multiline = true; - this.textBoxLog.Name = "textBoxLog"; - this.textBoxLog.ReadOnly = true; - this.textBoxLog.Size = new System.Drawing.Size(188, 26); - this.textBoxLog.TabIndex = 31; - // // contextMenuStripRes // this.contextMenuStripRes.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { @@ -1360,6 +1456,18 @@ namespace Nikse.SubtitleEdit.Forms 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))); @@ -1374,7 +1482,7 @@ namespace Nikse.SubtitleEdit.Forms // this.labelPass.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.labelPass.AutoSize = true; - this.labelPass.Location = new System.Drawing.Point(614, 599); + this.labelPass.Location = new System.Drawing.Point(564, 599); this.labelPass.Name = "labelPass"; this.labelPass.Size = new System.Drawing.Size(51, 13); this.labelPass.TabIndex = 47; @@ -1400,11 +1508,55 @@ namespace Nikse.SubtitleEdit.Forms this.labelPleaseWait.TabIndex = 25; this.labelPleaseWait.Text = "Please wait..."; // + // textBoxLog + // + this.textBoxLog.FocusedColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(120)))), ((int)(((byte)(215))))); + this.textBoxLog.Location = new System.Drawing.Point(12, 13); + this.textBoxLog.Multiline = true; + this.textBoxLog.Name = "textBoxLog"; + this.textBoxLog.ReadOnly = true; + this.textBoxLog.Size = new System.Drawing.Size(188, 26); + this.textBoxLog.TabIndex = 31; + // + // buttonClear + // + this.buttonClear.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.buttonClear.Location = new System.Drawing.Point(165, 513); + this.buttonClear.Name = "buttonClear"; + this.buttonClear.Size = new System.Drawing.Size(74, 23); + this.buttonClear.TabIndex = 146; + this.buttonClear.Text = "Clear"; + this.buttonClear.UseVisualStyleBackColor = true; + this.buttonClear.Click += new System.EventHandler(this.buttonClear_Click); + // + // buttonRemoveFile + // + this.buttonRemoveFile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.buttonRemoveFile.Location = new System.Drawing.Point(85, 513); + this.buttonRemoveFile.Name = "buttonRemoveFile"; + this.buttonRemoveFile.Size = new System.Drawing.Size(74, 23); + this.buttonRemoveFile.TabIndex = 145; + this.buttonRemoveFile.Text = "Remove"; + this.buttonRemoveFile.UseVisualStyleBackColor = true; + this.buttonRemoveFile.Click += new System.EventHandler(this.buttonRemoveFile_Click); + // + // buttonAddFile + // + this.buttonAddFile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.buttonAddFile.Location = new System.Drawing.Point(6, 513); + this.buttonAddFile.Name = "buttonAddFile"; + this.buttonAddFile.Size = new System.Drawing.Size(73, 23); + this.buttonAddFile.TabIndex = 144; + this.buttonAddFile.Text = "Add..."; + this.buttonAddFile.UseVisualStyleBackColor = true; + this.buttonAddFile.Click += new System.EventHandler(this.buttonAddFile_Click); + // // GenerateVideoWithHardSubs // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(885, 650); + this.Controls.Add(this.buttonMode); this.Controls.Add(this.labelPreviewPleaseWait); this.Controls.Add(this.groupBoxSettings); this.Controls.Add(this.labelPass); @@ -1423,6 +1575,7 @@ namespace Nikse.SubtitleEdit.Forms this.Text = "GenerateVideoWithHardSubs"; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.GenerateVideoWithHardSubs_FormClosing); this.Shown += new System.EventHandler(this.GenerateVideoWithHardSubs_Shown); + this.ResizeEnd += new System.EventHandler(this.GenerateVideoWithHardSubs_ResizeEnd); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.GenerateVideoWithHardSubs_KeyDown); this.contextMenuStripGenerate.ResumeLayout(false); this.groupBoxSettings.ResumeLayout(false); @@ -1433,6 +1586,7 @@ namespace Nikse.SubtitleEdit.Forms this.groupBoxVideo.PerformLayout(); this.groupBoxAudio.ResumeLayout(false); this.groupBoxAudio.PerformLayout(); + this.contextMenuStripBatch.ResumeLayout(false); this.contextMenuStripRes.ResumeLayout(false); this.ResumeLayout(false); this.PerformLayout(); @@ -1523,5 +1677,20 @@ namespace Nikse.SubtitleEdit.Forms private System.Windows.Forms.Button buttonOutlineColor; private System.Windows.Forms.Panel panelForeColor; private System.Windows.Forms.Button buttonForeColor; + private System.Windows.Forms.ListView listViewBatch; + private System.Windows.Forms.ColumnHeader columnHeaderVideoFile; + private System.Windows.Forms.ColumnHeader columnHeaderSubtitleFile; + private System.Windows.Forms.ColumnHeader columnHeaderSize; + private System.Windows.Forms.ColumnHeader columnHeaderStatus; + private System.Windows.Forms.ContextMenuStrip contextMenuStripBatch; + private System.Windows.Forms.ToolStripMenuItem addFilesToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem pickSubtitleFileToolStripMenuItem; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; + private System.Windows.Forms.ToolStripMenuItem deleteToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem clearToolStripMenuItem; + private System.Windows.Forms.Button buttonMode; + private System.Windows.Forms.Button buttonClear; + private System.Windows.Forms.Button buttonRemoveFile; + private System.Windows.Forms.Button buttonAddFile; } } \ No newline at end of file diff --git a/src/ui/Forms/GenerateVideoWithHardSubs.cs b/src/ui/Forms/GenerateVideoWithHardSubs.cs index 22ca11a4a..adc6d42e3 100644 --- a/src/ui/Forms/GenerateVideoWithHardSubs.cs +++ b/src/ui/Forms/GenerateVideoWithHardSubs.cs @@ -21,7 +21,7 @@ namespace Nikse.SubtitleEdit.Forms private bool _abort; private bool _loading; private readonly Subtitle _assaSubtitle; - private readonly VideoInfo _videoInfo; + private VideoInfo _videoInfo; private readonly string _inputVideoFileName; private static readonly Regex FrameFinderRegex = new Regex(@"[Ff]rame=\s*\d+", RegexOptions.Compiled); private long _processedFrames; @@ -34,9 +34,21 @@ namespace Nikse.SubtitleEdit.Forms private readonly bool _mpvOn; private readonly string _mpvSubtitleFileName; private readonly bool _noSubtitles; + private bool _converting; public string VideoFileName { get; private set; } public long MillisecondsEncoding { get; private set; } private PreviewVideo _previewVideo; + public bool BatchMode { get; set; } + public string BatchInfo { get; set; } + private readonly List _batchVideoAndSubList; + + public class BatchVideoAndSub + { + public string VideoFileName { get; set; } + public string SubtitleFileName { get; set; } + public long VideoFileSizeInBytes { get; set; } + public long SubtitleFileFileSizeInBytes { get; set; } + } public GenerateVideoWithHardSubs(Subtitle assaSubtitle, SubtitleFormat format, string inputVideoFileName, VideoInfo videoInfo, int? fontSize, bool setStartEndCut) { @@ -49,6 +61,7 @@ namespace Nikse.SubtitleEdit.Forms _videoInfo = videoInfo; _assaSubtitle = new Subtitle(assaSubtitle); _inputVideoFileName = inputVideoFileName; + _batchVideoAndSubList = new List(); _noSubtitles = _assaSubtitle == null || _assaSubtitle.Paragraphs.Count == 0 || @@ -82,6 +95,14 @@ namespace Nikse.SubtitleEdit.Forms checkBoxRightToLeft.Text = LanguageSettings.Current.Settings.FixRTLViaUnicodeChars; checkBoxAlignRight.Text = LanguageSettings.Current.GenerateVideoWithBurnedInSubs.AlignRight; checkBoxBox.Text = LanguageSettings.Current.SubStationAlphaStyles.OpaqueBox; + buttonMode.Text = LanguageSettings.Current.AudioToText.BatchMode; + deleteToolStripMenuItem.Text = LanguageSettings.Current.DvdSubRip.Remove; + clearToolStripMenuItem.Text = LanguageSettings.Current.DvdSubRip.Clear; + addFilesToolStripMenuItem.Text = LanguageSettings.Current.DvdSubRip.Add; + buttonRemoveFile.Text = LanguageSettings.Current.DvdSubRip.Remove; + buttonClear.Text = LanguageSettings.Current.DvdSubRip.Clear; + buttonAddFile.Text = LanguageSettings.Current.DvdSubRip.Add; + progressBar1.Visible = false; labelPleaseWait.Visible = false; labelPreviewPleaseWait.Visible = false; @@ -117,8 +138,11 @@ namespace Nikse.SubtitleEdit.Forms labelVideoBitrate.Text = string.Empty; - numericUpDownWidth.Value = _videoInfo.Width; - numericUpDownHeight.Value = _videoInfo.Height; + if (_videoInfo != null) + { + numericUpDownWidth.Value = _videoInfo.Width; + numericUpDownHeight.Value = _videoInfo.Height; + } var left = Math.Max(Math.Max(labelResolution.Left + labelResolution.Width, labelFontSize.Left + labelFontSize.Width), labelSubtitleFont.Left + labelSubtitleFont.Width) + 5; numericUpDownFontSize.Left = left; @@ -261,7 +285,12 @@ namespace Nikse.SubtitleEdit.Forms } _mpvOn = LibMpvDynamic.IsInstalled && Configuration.Settings.General.VideoPlayer == "MPV"; - _mpvSubtitleFileName = GetAssaFileName(_inputVideoFileName); + + if (_videoInfo != null) + { + _mpvSubtitleFileName = GetAssaFileName(_inputVideoFileName); + } + if (_mpvOn) { buttonPreview.Visible = false; @@ -279,6 +308,17 @@ namespace Nikse.SubtitleEdit.Forms labelProgress.Text = LanguageSettings.Current.Main.NoSubtitleLoaded; labelProgress.ForeColor = UiUtil.WarningColor; } + + listViewBatch.Visible = BatchMode; + buttonRemoveFile.Visible = BatchMode; + buttonClear.Visible = BatchMode; + buttonAddFile.Visible = BatchMode; + + if (string.IsNullOrEmpty(inputVideoFileName) || _videoInfo == null || _videoInfo.Width == 0 || _videoInfo.Height == 0) + { + buttonMode_Click(null, null); + buttonMode.Visible = false; + } } private void buttonCancel_Click(object sender, EventArgs e) @@ -319,6 +359,12 @@ namespace Nikse.SubtitleEdit.Forms private void buttonGenerate_Click(object sender, EventArgs e) { + if (BatchMode && _batchVideoAndSubList.Count == 0) + { + MessageBox.Show("No video files added for batch."); + return; + } + labelProgress.Text = string.Empty; labelProgress.ForeColor = UiUtil.ForeColor; @@ -345,29 +391,110 @@ namespace Nikse.SubtitleEdit.Forms var oldFontSizeEnabled = numericUpDownFontSize.Enabled; numericUpDownFontSize.Enabled = false; - using (var saveDialog = new SaveFileDialog + Stopwatch stopWatch; + if (BatchMode) { - FileName = SuggestNewVideoFileName(), - Filter = "MP4|*.mp4|Matroska|*.mkv|WebM|*.webm", - AddExtension = true, - InitialDirectory = Path.GetDirectoryName(_inputVideoFileName), - }) - { - if (comboBoxVideoEncoding.Text == "prores_ks") + stopWatch = Stopwatch.StartNew(); + var sbInfo = new StringBuilder(); + sbInfo.AppendLine($"Input for convert: {_batchVideoAndSubList.Count} video files:"); + sbInfo.AppendLine(); + var okCount = 0; + var failCount = 0; + for (var index = 0; index < _batchVideoAndSubList.Count; index++) { - saveDialog.Filter = "mov|*.mov|Matroska|*.mkv|Material eXchange Format|*.mxf"; + var videoAndSub = _batchVideoAndSubList[index]; + _videoInfo = UiUtil.GetVideoInfo(videoAndSub.VideoFileName); + var subtitle = new Subtitle(); + 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); + + if (ConvertVideo(oldFontSizeEnabled, videoAndSub.VideoFileName, subtitle)) + { + listViewBatch.Items[index].SubItems[3].Text = "Converted"; + sbInfo.AppendLine($"{index + 1}: {videoAndSub.VideoFileName} -> {VideoFileName}"); + okCount++; + } + else + { + listViewBatch.Items[index].SubItems[3].Text = "Error"; + sbInfo.AppendLine($"{index + 1}: {videoAndSub.VideoFileName} -> Failed!"); + failCount++; + } } - if (saveDialog.ShowDialog(this) != DialogResult.OK) + sbInfo.AppendLine(); + sbInfo.AppendLine($"Video files converted in {stopWatch.Elapsed}: {okCount}"); + if (failCount > 0) + { + sbInfo.AppendLine($"Video files failed: {failCount}"); + } + + BatchInfo = sbInfo.ToString(); + } + else + { + using (var saveDialog = new SaveFileDialog + { + FileName = SuggestNewVideoFileName(), + Filter = "MP4|*.mp4|Matroska|*.mkv|WebM|*.webm", + AddExtension = true, + InitialDirectory = Path.GetDirectoryName(_inputVideoFileName), + }) + { + if (comboBoxVideoEncoding.Text == "prores_ks") + { + saveDialog.Filter = "mov|*.mov|Matroska|*.mkv|Material eXchange Format|*.mxf"; + } + + if (saveDialog.ShowDialog(this) != DialogResult.OK) + { + buttonGenerate.Enabled = true; + numericUpDownFontSize.Enabled = true; + return; + } + + VideoFileName = saveDialog.FileName; + } + + stopWatch = Stopwatch.StartNew(); + if (!ConvertVideo(oldFontSizeEnabled, _inputVideoFileName, _assaSubtitle)) { - buttonGenerate.Enabled = true; - numericUpDownFontSize.Enabled = true; return; } - - VideoFileName = saveDialog.FileName; } + + progressBar1.Visible = false; + labelPleaseWait.Visible = false; + timer1.Stop(); + MillisecondsEncoding = stopWatch.ElapsedMilliseconds; + labelProgress.Text = string.Empty; + groupBoxSettings.Enabled = true; + + _converting = false; + if (_abort) + { + DialogResult = DialogResult.Cancel; + return; + } + + if (!BatchMode && (!File.Exists(VideoFileName) || new FileInfo(VideoFileName).Length == 0)) + { + SeLogger.Error(Environment.NewLine + "Generate hard subbed video failed: " + Environment.NewLine + _log); + MessageBox.Show("Generate embedded video failed" + Environment.NewLine + + "For more info see the error log: " + SeLogger.ErrorFile); + buttonGenerate.Enabled = true; + numericUpDownFontSize.Enabled = oldFontSizeEnabled; + return; + } + + DialogResult = DialogResult.OK; + } + + private bool ConvertVideo(bool oldFontSizeEnabled, string videoFileName, Subtitle subtitle) + { if (File.Exists(VideoFileName)) { try @@ -379,14 +506,15 @@ namespace Nikse.SubtitleEdit.Forms MessageBox.Show($"Cannot overwrite video file {VideoFileName} - probably in use!"); buttonGenerate.Enabled = true; numericUpDownFontSize.Enabled = oldFontSizeEnabled; - return; + return false; } } + _converting = true; _totalFrames = (long)_videoInfo.TotalFrames; _log = new StringBuilder(); - _log.AppendLine("Target file name: " + VideoFileName); + _log.AppendLine("Target file name: " + videoFileName); _log.AppendLine("Video info width: " + _videoInfo.Width); _log.AppendLine("Video info width: " + _videoInfo.Height); _log.AppendLine("Video info total frames: " + _videoInfo.TotalFrames); @@ -395,13 +523,13 @@ namespace Nikse.SubtitleEdit.Forms labelFileName.Text = string.Format(LanguageSettings.Current.GenerateVideoWithBurnedInSubs.TargetFileName, VideoFileName); if (!_isAssa) { - SetStyleForNonAssa(_assaSubtitle); + SetStyleForNonAssa(subtitle); } - FixRightToLeft(_assaSubtitle); + FixRightToLeft(subtitle); var format = new AdvancedSubStationAlpha(); - var assaTempFileName = GetAssaFileName(_inputVideoFileName); + var assaTempFileName = GetAssaFileName(videoFileName); if (checkBoxCut.Checked) { @@ -409,8 +537,8 @@ namespace Nikse.SubtitleEdit.Forms if (cutStart.TotalMilliseconds > 0.001) { var paragraphs = new List(); - _assaSubtitle.AddTimeToAllParagraphs(-cutStart); - foreach (var assaP in _assaSubtitle.Paragraphs) + subtitle.AddTimeToAllParagraphs(-cutStart); + foreach (var assaP in subtitle.Paragraphs) { if (assaP.StartTime.TotalMilliseconds > 0 && assaP.EndTime.TotalMilliseconds > 0) { @@ -423,21 +551,21 @@ namespace Nikse.SubtitleEdit.Forms } } - _assaSubtitle.Paragraphs.Clear(); - _assaSubtitle.Paragraphs.AddRange(paragraphs); + subtitle.Paragraphs.Clear(); + subtitle.Paragraphs.AddRange(paragraphs); } } if (Configuration.Settings.General.CurrentVideoIsSmpte && (decimal)_videoInfo.FramesPerSecond % 1 != 0) { - foreach (var assaP in _assaSubtitle.Paragraphs) + foreach (var assaP in subtitle.Paragraphs) { assaP.StartTime.TotalMilliseconds *= 1.001; assaP.EndTime.TotalMilliseconds *= 1.001; } } - FileUtil.WriteAllText(assaTempFileName, format.ToText(_assaSubtitle, null), new TextEncoding(Encoding.UTF8, "UTF8")); + FileUtil.WriteAllText(assaTempFileName, format.ToText(subtitle, null), new TextEncoding(Encoding.UTF8, "UTF8")); groupBoxSettings.Enabled = false; labelPleaseWait.Visible = true; @@ -453,23 +581,15 @@ namespace Nikse.SubtitleEdit.Forms _totalFrames = (long)Math.Round(_totalFrames / factor) + 10; } - var stopWatch = Stopwatch.StartNew(); if (checkBoxTargetFileSize.Checked) { - RunTwoPassEncoding(assaTempFileName); + RunTwoPassEncoding(assaTempFileName, videoFileName); } else { - RunOnePassEncoding(assaTempFileName); + RunOnePassEncoding(assaTempFileName, videoFileName); } - progressBar1.Visible = false; - labelPleaseWait.Visible = false; - timer1.Stop(); - MillisecondsEncoding = stopWatch.ElapsedMilliseconds; - labelProgress.Text = string.Empty; - groupBoxSettings.Enabled = true; - try { File.Delete(assaTempFileName); @@ -479,23 +599,7 @@ namespace Nikse.SubtitleEdit.Forms // ignore } - if (_abort) - { - DialogResult = DialogResult.Cancel; - return; - } - - if (!File.Exists(VideoFileName) || new FileInfo(VideoFileName).Length == 0) - { - SeLogger.Error(Environment.NewLine + "Generate hard subbed video failed: " + Environment.NewLine + _log); - MessageBox.Show("Generate embedded video failed" + Environment.NewLine + - "For more info see the error log: " + SeLogger.ErrorFile); - buttonGenerate.Enabled = true; - numericUpDownFontSize.Enabled = oldFontSizeEnabled; - return; - } - - DialogResult = DialogResult.OK; + return true; } private TimeSpan GetCutEnd() @@ -585,7 +689,7 @@ namespace Nikse.SubtitleEdit.Forms } } - private void RunTwoPassEncoding(string assaTempFileName) + private void RunTwoPassEncoding(string assaTempFileName, string videoFileName) { labelPass.Text = string.Format(LanguageSettings.Current.GenerateVideoWithBurnedInSubs.PassX, "1"); @@ -598,7 +702,7 @@ namespace Nikse.SubtitleEdit.Forms return; } - var process = GetFfmpegProcess(_inputVideoFileName, VideoFileName, assaTempFileName, 1, videoBitRate); + var process = GetFfmpegProcess(videoFileName, VideoFileName, assaTempFileName, 1, videoBitRate); _log.AppendLine("ffmpeg arguments pass 1: " + process.StartInfo.Arguments); if (!CheckForPromptParameters(process, Text + " - Pass 1")) { @@ -714,9 +818,9 @@ namespace Nikse.SubtitleEdit.Forms } } - private void RunOnePassEncoding(string assaTempFileName) + private void RunOnePassEncoding(string assaTempFileName, string videoFileName) { - var process = GetFfmpegProcess(_inputVideoFileName, VideoFileName, assaTempFileName); + var process = GetFfmpegProcess(videoFileName, VideoFileName, assaTempFileName); _log.AppendLine("ffmpeg arguments: " + process.StartInfo.Arguments); if (!CheckForPromptParameters(process, Text)) @@ -949,12 +1053,15 @@ namespace Nikse.SubtitleEdit.Forms CloseVideo(); - using (var graphics = CreateGraphics()) + if (_videoInfo != null) { - using (var font = new Font(UiUtil.GetDefaultFont().FontFamily, (float)numericUpDownFontSize.Value, FontStyle.Regular)) + using (var graphics = CreateGraphics()) { - var currentHeight = graphics.MeasureString("HJKLj", font).Height; - Configuration.Settings.Tools.GenVideoFontSizePercentOfHeight = (float)(currentHeight / _videoInfo.Height); + using (var font = new Font(UiUtil.GetDefaultFont().FontFamily, (float)numericUpDownFontSize.Value, FontStyle.Regular)) + { + var currentHeight = graphics.MeasureString("HJKLj", font).Height; + Configuration.Settings.Tools.GenVideoFontSizePercentOfHeight = (float)(currentHeight / _videoInfo.Height); + } } } @@ -1272,20 +1379,19 @@ namespace Nikse.SubtitleEdit.Forms private void GenerateVideoWithHardSubs_Shown(object sender, EventArgs e) { - if (!File.Exists(_inputVideoFileName)) + panelOutlineColor.BackColor = Configuration.Settings.Tools.GenVideoNonAssaBoxColor; + panelForeColor.BackColor = Configuration.Settings.Tools.GenVideoNonAssaTextColor; + + if (_videoInfo == null) { - MessageBox.Show(string.Format(LanguageSettings.Current.Main.FileNotFound, _inputVideoFileName)); - buttonGenerate.Enabled = false; + _loading = false; return; } var targetFileSizeMb = (int)Math.Round(new FileInfo(_inputVideoFileName).Length / 1024.0 / 1024); numericUpDownTargetFileSize.Value = Math.Max(targetFileSizeMb, numericUpDownTargetFileSize.Minimum); - _loading = false; UiUtil.FixFonts(groupBoxSettings, 2000); - - panelOutlineColor.BackColor = Configuration.Settings.Tools.GenVideoNonAssaBoxColor; - panelForeColor.BackColor = Configuration.Settings.Tools.GenVideoNonAssaTextColor; + _loading = false; if (_mpvOn) { @@ -1755,5 +1861,213 @@ namespace Nikse.SubtitleEdit.Forms { buttonForeColor_Click(null, null); } + + private void contextMenuStripBatch_Opening(object sender, System.ComponentModel.CancelEventArgs e) + { + pickSubtitleFileToolStripMenuItem.Visible = listViewBatch.SelectedItems.Count == 1; + + if (listViewBatch.Items.Count == 0) + { + toolStripSeparator1.Visible = false; + deleteToolStripMenuItem.Visible = false; + clearToolStripMenuItem.Visible = false; + } + else + { + toolStripSeparator1.Visible = true; + deleteToolStripMenuItem.Visible = true; + clearToolStripMenuItem.Visible = true; + } + } + + private void buttonMode_Click(object sender, EventArgs e) + { + BatchMode = !BatchMode; + listViewBatch.Visible = BatchMode; + listViewBatch.AutoSizeLastColumn(); + videoPlayerContainer1.Visible = !BatchMode; + labelInfo.Visible = !BatchMode; + checkBoxTargetFileSize.Visible = !BatchMode; + labelFileSize.Visible = !BatchMode; + numericUpDownTargetFileSize.Visible = !BatchMode; + labelVideoBitrate.Visible = !BatchMode; + labelFileName.Visible = !BatchMode; + buttonAddFile.Visible = BatchMode; + buttonRemoveFile.Visible = BatchMode; + buttonClear.Visible = BatchMode; + buttonMode.Text = BatchMode + ? LanguageSettings.Current.AudioToText.BatchMode + : LanguageSettings.Current.Split.Basic; + } + + private void addFilesToolStripMenuItem_Click(object sender, EventArgs e) + { + using (var openFileDialog1 = new OpenFileDialog()) + { + openFileDialog1.Title = LanguageSettings.Current.General.OpenVideoFileTitle; + openFileDialog1.FileName = string.Empty; + openFileDialog1.Filter = UiUtil.GetVideoFileFilter(true); + openFileDialog1.Multiselect = true; + if (openFileDialog1.ShowDialog(this) != DialogResult.OK) + { + return; + } + + foreach (var fileName in openFileDialog1.FileNames) + { + AddInputFile(fileName); + } + } + } + + private void AddInputFile(string fileName) + { + if (string.IsNullOrEmpty(fileName)) + { + return; + } + + var ext = Path.GetExtension(fileName).ToLowerInvariant(); + if ((Utilities.AudioFileExtensions.Contains(ext) || Utilities.VideoFileExtensions.Contains(ext)) && File.Exists(fileName)) + { + var item = new BatchVideoAndSub(); + item.VideoFileName = fileName; + item.VideoFileSizeInBytes = new FileInfo(fileName).Length; + + var path = Path.GetDirectoryName(fileName); + var fileNameNoExt = Path.GetFileNameWithoutExtension(fileName); + var subFileName = Path.ChangeExtension(fileName, ".srt"); + + if (!File.Exists(subFileName)) + { + subFileName = Path.ChangeExtension(fileName, ".ass"); + } + + if (!File.Exists(subFileName)) + { + var files = Directory.GetFiles(path, fileNameNoExt + "*.srt"); + if (files.Length > 0) + { + subFileName = files[0]; + } + } + + if (!File.Exists(subFileName)) + { + var files = Directory.GetFiles(path, fileNameNoExt + "*.ass"); + if (files.Length > 0) + { + subFileName = files[0]; + } + } + + if (File.Exists(subFileName)) + { + item.SubtitleFileName = subFileName; + item.SubtitleFileFileSizeInBytes = new FileInfo(subFileName).Length; + } + + var listViewItem = new ListViewItem(fileName); + listViewItem.Tag = item; + var s = Utilities.FormatBytesToDisplayFileSize(item.VideoFileSizeInBytes); + listViewItem.SubItems.Add(s); + listViewItem.SubItems.Add(Path.GetFileName(item.SubtitleFileName)); + listViewItem.SubItems.Add(string.Empty); + listViewBatch.Items.Add(listViewItem); + _batchVideoAndSubList.Add(item); + } + } + + private void deleteToolStripMenuItem_Click(object sender, EventArgs e) + { + for (var i = listViewBatch.SelectedIndices.Count - 1; i >= 0; i--) + { + listViewBatch.Items.RemoveAt(listViewBatch.SelectedIndices[i]); + _batchVideoAndSubList.RemoveAt(listViewBatch.SelectedIndices[i]); + } + } + + private void clearToolStripMenuItem_Click(object sender, EventArgs e) + { + listViewBatch.Items.Clear(); + _batchVideoAndSubList.Clear(); + } + + private void GenerateVideoWithHardSubs_ResizeEnd(object sender, EventArgs e) + { + listViewBatch.AutoSizeLastColumn(); + } + + private void listViewBatch_DragEnter(object sender, DragEventArgs e) + { + if (_converting) + { + e.Effect = DragDropEffects.None; + return; + } + + if (e.Data.GetDataPresent(DataFormats.FileDrop, false)) + { + e.Effect = DragDropEffects.All; + } + } + + private void listViewBatch_DragDrop(object sender, DragEventArgs e) + { + if (_converting) + { + return; + } + + try + { + var fileNames = (string[])e.Data.GetData(DataFormats.FileDrop); + labelPleaseWait.Visible = true; + + TaskDelayHelper.RunDelayed(TimeSpan.FromMilliseconds(5), () => + { + foreach (var fileName in fileNames) + { + if (FileUtil.IsDirectory(fileName)) + { + SearchFolder(fileName); + } + else + { + AddInputFile(fileName); + } + } + }); + + } + finally + { + labelPleaseWait.Visible = false; + } + } + + private void SearchFolder(string path) + { + _abort = false; + foreach (var fileName in Directory.EnumerateFiles(path)) + { + AddInputFile(fileName); + } + } + + private void buttonAddFile_Click(object sender, EventArgs e) + { + addFilesToolStripMenuItem_Click(null, null); + } + + private void buttonRemoveFile_Click(object sender, EventArgs e) + { + deleteToolStripMenuItem_Click(null, null); + } + + private void buttonClear_Click(object sender, EventArgs e) + { + clearToolStripMenuItem_Click(null, null); + } } } diff --git a/src/ui/Forms/GenerateVideoWithHardSubs.resx b/src/ui/Forms/GenerateVideoWithHardSubs.resx index d9b94fb8b..891fa1f9e 100644 --- a/src/ui/Forms/GenerateVideoWithHardSubs.resx +++ b/src/ui/Forms/GenerateVideoWithHardSubs.resx @@ -123,6 +123,9 @@ 17, 17 + + 468, 17 + 104, 17 diff --git a/src/ui/Forms/Main.cs b/src/ui/Forms/Main.cs index f31960733..e326db66e 100644 --- a/src/ui/Forms/Main.cs +++ b/src/ui/Forms/Main.cs @@ -9099,10 +9099,17 @@ namespace Nikse.SubtitleEdit.Forms return; } - var encodingTime = new TimeCode(form.MillisecondsEncoding).ToString(); - using (var f = new ExportPngXmlDialogOpenFolder(string.Format(LanguageSettings.Current.GenerateVideoWithBurnedInSubs.XGeneratedWithBurnedInSubsInX, Path.GetFileName(form.VideoFileName), encodingTime), Path.GetDirectoryName(form.VideoFileName), form.VideoFileName)) + if (form.BatchMode) { - f.ShowDialog(this); + MessageBox.Show(form.BatchInfo); + } + else + { + var encodingTime = new TimeCode(form.MillisecondsEncoding).ToString(); + using (var f = new ExportPngXmlDialogOpenFolder(string.Format(LanguageSettings.Current.GenerateVideoWithBurnedInSubs.XGeneratedWithBurnedInSubsInX, Path.GetFileName(form.VideoFileName), encodingTime), Path.GetDirectoryName(form.VideoFileName), form.VideoFileName)) + { + f.ShowDialog(this); + } } } }; @@ -9873,6 +9880,19 @@ namespace Nikse.SubtitleEdit.Forms return; } + if (useOriginal) + { + var p2 = _subtitle.GetParagraphOrDefaultById(audioClips[0].Paragraph.Id); + if (p2 != null) + { + var original = Utilities.GetOriginalParagraph(_subtitle.Paragraphs.IndexOf(p2), p2, _subtitleOriginal.Paragraphs); + if (original != null) + { + _subtitleOriginal.Paragraphs.Remove(original); + } + } + } + _subtitle.Paragraphs.RemoveAll(p => p.Id == audioClips[0].Paragraph.Id); foreach (var p in form.TranscribedSubtitle.Paragraphs) @@ -9882,7 +9902,7 @@ namespace Nikse.SubtitleEdit.Forms { _subtitleOriginal.InsertParagraphInCorrectTimeOrder(p); if (_subtitle.Paragraphs.Any(x => - (p.StartTime.TotalMilliseconds > x.StartTime.TotalMilliseconds && p.StartTime.TotalMilliseconds < x.EndTime.TotalMilliseconds) || + (p.StartTime.TotalMilliseconds > x.StartTime.TotalMilliseconds && p.StartTime.TotalMilliseconds < x.EndTime.TotalMilliseconds) || (p.EndTime.TotalMilliseconds > x.EndTime.TotalMilliseconds && p.EndTime.TotalMilliseconds < x.EndTime.TotalMilliseconds))) { // overlap @@ -35638,12 +35658,6 @@ namespace Nikse.SubtitleEdit.Forms return; } - if (string.IsNullOrEmpty(_videoFileName) || _videoInfo == null || _videoInfo.Width == 0 || _videoInfo.Height == 0) - { - MessageBox.Show(LanguageSettings.Current.General.NoVideoLoaded); - return; - } - if (!RequireFfmpegOk()) { return; @@ -35660,10 +35674,17 @@ namespace Nikse.SubtitleEdit.Forms return; } - var encodingTime = new TimeCode(form.MillisecondsEncoding).ToString(); - using (var f = new ExportPngXmlDialogOpenFolder(string.Format(LanguageSettings.Current.GenerateVideoWithBurnedInSubs.XGeneratedWithBurnedInSubsInX, Path.GetFileName(form.VideoFileName), encodingTime), Path.GetDirectoryName(form.VideoFileName), form.VideoFileName)) + if (form.BatchMode) { - f.ShowDialog(this); + MessageBox.Show(form.BatchInfo); + } + else + { + var encodingTime = new TimeCode(form.MillisecondsEncoding).ToString(); + using (var f = new ExportPngXmlDialogOpenFolder(string.Format(LanguageSettings.Current.GenerateVideoWithBurnedInSubs.XGeneratedWithBurnedInSubsInX, Path.GetFileName(form.VideoFileName), encodingTime), Path.GetDirectoryName(form.VideoFileName), form.VideoFileName)) + { + f.ShowDialog(this); + } } } } @@ -35671,6 +35692,12 @@ namespace Nikse.SubtitleEdit.Forms private int? PrepareBurn(Subtitle sub) { int? fontSize = null; + + if (_videoInfo == null) + { + return fontSize; + } + if (string.IsNullOrEmpty(sub.Header) || !IsAssa()) { sub.Header = AdvancedSubStationAlpha.DefaultHeader;