This commit is contained in:
Nikolaj Olsson 2024-04-18 18:50:47 +02:00
parent d70939e50b
commit cd7a175ca4
6 changed files with 615 additions and 101 deletions

View File

@ -12,6 +12,7 @@
* Update Polish translation - thx admas * Update Polish translation - thx admas
* Update Korean translation - thx domddol * Update Korean translation - thx domddol
* Show Vosk/Whisper done msgbox modal (also if not focused) - thx jupester * Show Vosk/Whisper done msgbox modal (also if not focused) - thx jupester
* Allow re-encode with burn-in without subtitle - thx Leon
* FIXED: * FIXED:
* Fix for Antrophic translate - thx venomousraid * Fix for Antrophic translate - thx venomousraid
* Fix possible crash in teletext reading - thx yellobyte * Fix possible crash in teletext reading - thx yellobyte

Binary file not shown.

View File

@ -90,9 +90,19 @@ namespace Nikse.SubtitleEdit.Forms
this.labelFileName = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.labelFileName = new Nikse.SubtitleEdit.Controls.NikseLabel();
this.numericUpDownFontSize = new Nikse.SubtitleEdit.Controls.NikseUpDown(); this.numericUpDownFontSize = new Nikse.SubtitleEdit.Controls.NikseUpDown();
this.labelFontSize = new Nikse.SubtitleEdit.Controls.NikseLabel(); 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.buttonPreview = new System.Windows.Forms.Button();
this.linkLabelHelp = new System.Windows.Forms.LinkLabel(); this.linkLabelHelp = new System.Windows.Forms.LinkLabel();
this.textBoxLog = new Nikse.SubtitleEdit.Controls.NikseTextBox();
this.contextMenuStripRes = new System.Windows.Forms.ContextMenuStrip(this.components); this.contextMenuStripRes = new System.Windows.Forms.ContextMenuStrip(this.components);
this.x2160ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.x2160ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.uHD3840x2160ToolStripMenuItem = 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.nTSC720x480ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.x352ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.x352ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.x272ToolStripMenuItem = 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.labelPreviewPleaseWait = new Nikse.SubtitleEdit.Controls.NikseLabel();
this.labelPass = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.labelPass = new Nikse.SubtitleEdit.Controls.NikseLabel();
this.labelProgress = new Nikse.SubtitleEdit.Controls.NikseLabel(); this.labelProgress = new Nikse.SubtitleEdit.Controls.NikseLabel();
this.labelPleaseWait = 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.contextMenuStripGenerate.SuspendLayout();
this.groupBoxSettings.SuspendLayout(); this.groupBoxSettings.SuspendLayout();
this.groupBoxCut.SuspendLayout(); this.groupBoxCut.SuspendLayout();
this.groupBoxVideo.SuspendLayout(); this.groupBoxVideo.SuspendLayout();
this.groupBoxAudio.SuspendLayout(); this.groupBoxAudio.SuspendLayout();
this.contextMenuStripBatch.SuspendLayout();
this.contextMenuStripRes.SuspendLayout(); this.contextMenuStripRes.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
@ -126,7 +142,7 @@ namespace Nikse.SubtitleEdit.Forms
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.progressBar1.Location = new System.Drawing.Point(12, 615); this.progressBar1.Location = new System.Drawing.Point(12, 615);
this.progressBar1.Name = "progressBar1"; 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.TabIndex = 22;
this.progressBar1.Visible = false; 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.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.buttonGenerate.ContextMenuStrip = this.contextMenuStripGenerate; this.buttonGenerate.ContextMenuStrip = this.contextMenuStripGenerate;
this.buttonGenerate.ImeMode = System.Windows.Forms.ImeMode.NoControl; 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.Name = "buttonGenerate";
this.buttonGenerate.Size = new System.Drawing.Size(121, 23); this.buttonGenerate.Size = new System.Drawing.Size(121, 23);
this.buttonGenerate.TabIndex = 140; 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.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.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.buttonCancel.ImeMode = System.Windows.Forms.ImeMode.NoControl; 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.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.TabIndex = 141;
this.buttonCancel.Text = "C&ancel"; this.buttonCancel.Text = "C&ancel";
this.buttonCancel.UseVisualStyleBackColor = true; 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) 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.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.groupBoxSettings.Controls.Add(this.buttonClear);
this.groupBoxSettings.Controls.Add(this.panelForeColor); this.groupBoxSettings.Controls.Add(this.panelForeColor);
this.groupBoxSettings.Controls.Add(this.buttonRemoveFile);
this.groupBoxSettings.Controls.Add(this.buttonForeColor); this.groupBoxSettings.Controls.Add(this.buttonForeColor);
this.groupBoxSettings.Controls.Add(this.buttonAddFile);
this.groupBoxSettings.Controls.Add(this.panelOutlineColor); this.groupBoxSettings.Controls.Add(this.panelOutlineColor);
this.groupBoxSettings.Controls.Add(this.buttonOutlineColor); this.groupBoxSettings.Controls.Add(this.buttonOutlineColor);
this.groupBoxSettings.Controls.Add(this.videoPlayerContainer1); 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.labelFileName);
this.groupBoxSettings.Controls.Add(this.numericUpDownFontSize); this.groupBoxSettings.Controls.Add(this.numericUpDownFontSize);
this.groupBoxSettings.Controls.Add(this.labelFontSize); this.groupBoxSettings.Controls.Add(this.labelFontSize);
this.groupBoxSettings.Controls.Add(this.listViewBatch);
this.groupBoxSettings.Location = new System.Drawing.Point(12, 13); this.groupBoxSettings.Location = new System.Drawing.Point(12, 13);
this.groupBoxSettings.Name = "groupBoxSettings"; this.groupBoxSettings.Name = "groupBoxSettings";
this.groupBoxSettings.Size = new System.Drawing.Size(861, 547); this.groupBoxSettings.Size = new System.Drawing.Size(861, 547);
@ -1209,10 +1229,96 @@ namespace Nikse.SubtitleEdit.Forms
this.labelFontSize.TabIndex = 0; this.labelFontSize.TabIndex = 0;
this.labelFontSize.Text = "Font size"; 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 // buttonPreview
// //
this.buttonPreview.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 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.Name = "buttonPreview";
this.buttonPreview.Size = new System.Drawing.Size(121, 23); this.buttonPreview.Size = new System.Drawing.Size(121, 23);
this.buttonPreview.TabIndex = 130; this.buttonPreview.TabIndex = 130;
@ -1232,16 +1338,6 @@ namespace Nikse.SubtitleEdit.Forms
this.linkLabelHelp.Text = "Help"; this.linkLabelHelp.Text = "Help";
this.linkLabelHelp.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelHelp_LinkClicked); 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 // contextMenuStripRes
// //
this.contextMenuStripRes.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { this.contextMenuStripRes.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
@ -1360,6 +1456,18 @@ namespace Nikse.SubtitleEdit.Forms
this.x272ToolStripMenuItem.Text = "640x272"; this.x272ToolStripMenuItem.Text = "640x272";
this.x272ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick); 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 // labelPreviewPleaseWait
// //
this.labelPreviewPleaseWait.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 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.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.labelPass.AutoSize = true; 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.Name = "labelPass";
this.labelPass.Size = new System.Drawing.Size(51, 13); this.labelPass.Size = new System.Drawing.Size(51, 13);
this.labelPass.TabIndex = 47; this.labelPass.TabIndex = 47;
@ -1400,11 +1508,55 @@ namespace Nikse.SubtitleEdit.Forms
this.labelPleaseWait.TabIndex = 25; this.labelPleaseWait.TabIndex = 25;
this.labelPleaseWait.Text = "Please wait..."; 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 // GenerateVideoWithHardSubs
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(885, 650); this.ClientSize = new System.Drawing.Size(885, 650);
this.Controls.Add(this.buttonMode);
this.Controls.Add(this.labelPreviewPleaseWait); this.Controls.Add(this.labelPreviewPleaseWait);
this.Controls.Add(this.groupBoxSettings); this.Controls.Add(this.groupBoxSettings);
this.Controls.Add(this.labelPass); this.Controls.Add(this.labelPass);
@ -1423,6 +1575,7 @@ namespace Nikse.SubtitleEdit.Forms
this.Text = "GenerateVideoWithHardSubs"; this.Text = "GenerateVideoWithHardSubs";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.GenerateVideoWithHardSubs_FormClosing); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.GenerateVideoWithHardSubs_FormClosing);
this.Shown += new System.EventHandler(this.GenerateVideoWithHardSubs_Shown); 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.KeyDown += new System.Windows.Forms.KeyEventHandler(this.GenerateVideoWithHardSubs_KeyDown);
this.contextMenuStripGenerate.ResumeLayout(false); this.contextMenuStripGenerate.ResumeLayout(false);
this.groupBoxSettings.ResumeLayout(false); this.groupBoxSettings.ResumeLayout(false);
@ -1433,6 +1586,7 @@ namespace Nikse.SubtitleEdit.Forms
this.groupBoxVideo.PerformLayout(); this.groupBoxVideo.PerformLayout();
this.groupBoxAudio.ResumeLayout(false); this.groupBoxAudio.ResumeLayout(false);
this.groupBoxAudio.PerformLayout(); this.groupBoxAudio.PerformLayout();
this.contextMenuStripBatch.ResumeLayout(false);
this.contextMenuStripRes.ResumeLayout(false); this.contextMenuStripRes.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -1523,5 +1677,20 @@ namespace Nikse.SubtitleEdit.Forms
private System.Windows.Forms.Button buttonOutlineColor; private System.Windows.Forms.Button buttonOutlineColor;
private System.Windows.Forms.Panel panelForeColor; private System.Windows.Forms.Panel panelForeColor;
private System.Windows.Forms.Button buttonForeColor; 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;
} }
} }

View File

@ -21,7 +21,7 @@ namespace Nikse.SubtitleEdit.Forms
private bool _abort; private bool _abort;
private bool _loading; private bool _loading;
private readonly Subtitle _assaSubtitle; private readonly Subtitle _assaSubtitle;
private readonly VideoInfo _videoInfo; private VideoInfo _videoInfo;
private readonly string _inputVideoFileName; private readonly string _inputVideoFileName;
private static readonly Regex FrameFinderRegex = new Regex(@"[Ff]rame=\s*\d+", RegexOptions.Compiled); private static readonly Regex FrameFinderRegex = new Regex(@"[Ff]rame=\s*\d+", RegexOptions.Compiled);
private long _processedFrames; private long _processedFrames;
@ -34,9 +34,21 @@ namespace Nikse.SubtitleEdit.Forms
private readonly bool _mpvOn; private readonly bool _mpvOn;
private readonly string _mpvSubtitleFileName; private readonly string _mpvSubtitleFileName;
private readonly bool _noSubtitles; private readonly bool _noSubtitles;
private bool _converting;
public string VideoFileName { get; private set; } public string VideoFileName { get; private set; }
public long MillisecondsEncoding { get; private set; } public long MillisecondsEncoding { get; private set; }
private PreviewVideo _previewVideo; private PreviewVideo _previewVideo;
public bool BatchMode { get; set; }
public string BatchInfo { get; set; }
private readonly List<BatchVideoAndSub> _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) public GenerateVideoWithHardSubs(Subtitle assaSubtitle, SubtitleFormat format, string inputVideoFileName, VideoInfo videoInfo, int? fontSize, bool setStartEndCut)
{ {
@ -49,6 +61,7 @@ namespace Nikse.SubtitleEdit.Forms
_videoInfo = videoInfo; _videoInfo = videoInfo;
_assaSubtitle = new Subtitle(assaSubtitle); _assaSubtitle = new Subtitle(assaSubtitle);
_inputVideoFileName = inputVideoFileName; _inputVideoFileName = inputVideoFileName;
_batchVideoAndSubList = new List<BatchVideoAndSub>();
_noSubtitles = _assaSubtitle == null || _noSubtitles = _assaSubtitle == null ||
_assaSubtitle.Paragraphs.Count == 0 || _assaSubtitle.Paragraphs.Count == 0 ||
@ -82,6 +95,14 @@ namespace Nikse.SubtitleEdit.Forms
checkBoxRightToLeft.Text = LanguageSettings.Current.Settings.FixRTLViaUnicodeChars; checkBoxRightToLeft.Text = LanguageSettings.Current.Settings.FixRTLViaUnicodeChars;
checkBoxAlignRight.Text = LanguageSettings.Current.GenerateVideoWithBurnedInSubs.AlignRight; checkBoxAlignRight.Text = LanguageSettings.Current.GenerateVideoWithBurnedInSubs.AlignRight;
checkBoxBox.Text = LanguageSettings.Current.SubStationAlphaStyles.OpaqueBox; 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; progressBar1.Visible = false;
labelPleaseWait.Visible = false; labelPleaseWait.Visible = false;
labelPreviewPleaseWait.Visible = false; labelPreviewPleaseWait.Visible = false;
@ -117,8 +138,11 @@ namespace Nikse.SubtitleEdit.Forms
labelVideoBitrate.Text = string.Empty; labelVideoBitrate.Text = string.Empty;
if (_videoInfo != null)
{
numericUpDownWidth.Value = _videoInfo.Width; numericUpDownWidth.Value = _videoInfo.Width;
numericUpDownHeight.Value = _videoInfo.Height; numericUpDownHeight.Value = _videoInfo.Height;
}
var left = Math.Max(Math.Max(labelResolution.Left + labelResolution.Width, labelFontSize.Left + labelFontSize.Width), labelSubtitleFont.Left + labelSubtitleFont.Width) + 5; var left = Math.Max(Math.Max(labelResolution.Left + labelResolution.Width, labelFontSize.Left + labelFontSize.Width), labelSubtitleFont.Left + labelSubtitleFont.Width) + 5;
numericUpDownFontSize.Left = left; numericUpDownFontSize.Left = left;
@ -261,7 +285,12 @@ namespace Nikse.SubtitleEdit.Forms
} }
_mpvOn = LibMpvDynamic.IsInstalled && Configuration.Settings.General.VideoPlayer == "MPV"; _mpvOn = LibMpvDynamic.IsInstalled && Configuration.Settings.General.VideoPlayer == "MPV";
if (_videoInfo != null)
{
_mpvSubtitleFileName = GetAssaFileName(_inputVideoFileName); _mpvSubtitleFileName = GetAssaFileName(_inputVideoFileName);
}
if (_mpvOn) if (_mpvOn)
{ {
buttonPreview.Visible = false; buttonPreview.Visible = false;
@ -279,6 +308,17 @@ namespace Nikse.SubtitleEdit.Forms
labelProgress.Text = LanguageSettings.Current.Main.NoSubtitleLoaded; labelProgress.Text = LanguageSettings.Current.Main.NoSubtitleLoaded;
labelProgress.ForeColor = UiUtil.WarningColor; 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) private void buttonCancel_Click(object sender, EventArgs e)
@ -319,6 +359,12 @@ namespace Nikse.SubtitleEdit.Forms
private void buttonGenerate_Click(object sender, EventArgs e) 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.Text = string.Empty;
labelProgress.ForeColor = UiUtil.ForeColor; labelProgress.ForeColor = UiUtil.ForeColor;
@ -345,6 +391,50 @@ namespace Nikse.SubtitleEdit.Forms
var oldFontSizeEnabled = numericUpDownFontSize.Enabled; var oldFontSizeEnabled = numericUpDownFontSize.Enabled;
numericUpDownFontSize.Enabled = false; numericUpDownFontSize.Enabled = false;
Stopwatch stopWatch;
if (BatchMode)
{
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++)
{
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++;
}
}
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 using (var saveDialog = new SaveFileDialog
{ {
FileName = SuggestNewVideoFileName(), FileName = SuggestNewVideoFileName(),
@ -368,6 +458,43 @@ namespace Nikse.SubtitleEdit.Forms
VideoFileName = saveDialog.FileName; VideoFileName = saveDialog.FileName;
} }
stopWatch = Stopwatch.StartNew();
if (!ConvertVideo(oldFontSizeEnabled, _inputVideoFileName, _assaSubtitle))
{
return;
}
}
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)) if (File.Exists(VideoFileName))
{ {
try try
@ -379,14 +506,15 @@ namespace Nikse.SubtitleEdit.Forms
MessageBox.Show($"Cannot overwrite video file {VideoFileName} - probably in use!"); MessageBox.Show($"Cannot overwrite video file {VideoFileName} - probably in use!");
buttonGenerate.Enabled = true; buttonGenerate.Enabled = true;
numericUpDownFontSize.Enabled = oldFontSizeEnabled; numericUpDownFontSize.Enabled = oldFontSizeEnabled;
return; return false;
} }
} }
_converting = true;
_totalFrames = (long)_videoInfo.TotalFrames; _totalFrames = (long)_videoInfo.TotalFrames;
_log = new StringBuilder(); _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.Width);
_log.AppendLine("Video info width: " + _videoInfo.Height); _log.AppendLine("Video info width: " + _videoInfo.Height);
_log.AppendLine("Video info total frames: " + _videoInfo.TotalFrames); _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); labelFileName.Text = string.Format(LanguageSettings.Current.GenerateVideoWithBurnedInSubs.TargetFileName, VideoFileName);
if (!_isAssa) if (!_isAssa)
{ {
SetStyleForNonAssa(_assaSubtitle); SetStyleForNonAssa(subtitle);
} }
FixRightToLeft(_assaSubtitle); FixRightToLeft(subtitle);
var format = new AdvancedSubStationAlpha(); var format = new AdvancedSubStationAlpha();
var assaTempFileName = GetAssaFileName(_inputVideoFileName); var assaTempFileName = GetAssaFileName(videoFileName);
if (checkBoxCut.Checked) if (checkBoxCut.Checked)
{ {
@ -409,8 +537,8 @@ namespace Nikse.SubtitleEdit.Forms
if (cutStart.TotalMilliseconds > 0.001) if (cutStart.TotalMilliseconds > 0.001)
{ {
var paragraphs = new List<Paragraph>(); var paragraphs = new List<Paragraph>();
_assaSubtitle.AddTimeToAllParagraphs(-cutStart); subtitle.AddTimeToAllParagraphs(-cutStart);
foreach (var assaP in _assaSubtitle.Paragraphs) foreach (var assaP in subtitle.Paragraphs)
{ {
if (assaP.StartTime.TotalMilliseconds > 0 && assaP.EndTime.TotalMilliseconds > 0) if (assaP.StartTime.TotalMilliseconds > 0 && assaP.EndTime.TotalMilliseconds > 0)
{ {
@ -423,21 +551,21 @@ namespace Nikse.SubtitleEdit.Forms
} }
} }
_assaSubtitle.Paragraphs.Clear(); subtitle.Paragraphs.Clear();
_assaSubtitle.Paragraphs.AddRange(paragraphs); subtitle.Paragraphs.AddRange(paragraphs);
} }
} }
if (Configuration.Settings.General.CurrentVideoIsSmpte && (decimal)_videoInfo.FramesPerSecond % 1 != 0) 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.StartTime.TotalMilliseconds *= 1.001;
assaP.EndTime.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; groupBoxSettings.Enabled = false;
labelPleaseWait.Visible = true; labelPleaseWait.Visible = true;
@ -453,23 +581,15 @@ namespace Nikse.SubtitleEdit.Forms
_totalFrames = (long)Math.Round(_totalFrames / factor) + 10; _totalFrames = (long)Math.Round(_totalFrames / factor) + 10;
} }
var stopWatch = Stopwatch.StartNew();
if (checkBoxTargetFileSize.Checked) if (checkBoxTargetFileSize.Checked)
{ {
RunTwoPassEncoding(assaTempFileName); RunTwoPassEncoding(assaTempFileName, videoFileName);
} }
else 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 try
{ {
File.Delete(assaTempFileName); File.Delete(assaTempFileName);
@ -479,23 +599,7 @@ namespace Nikse.SubtitleEdit.Forms
// ignore // ignore
} }
if (_abort) return true;
{
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;
} }
private TimeSpan GetCutEnd() 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"); labelPass.Text = string.Format(LanguageSettings.Current.GenerateVideoWithBurnedInSubs.PassX, "1");
@ -598,7 +702,7 @@ namespace Nikse.SubtitleEdit.Forms
return; 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); _log.AppendLine("ffmpeg arguments pass 1: " + process.StartInfo.Arguments);
if (!CheckForPromptParameters(process, Text + " - Pass 1")) 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); _log.AppendLine("ffmpeg arguments: " + process.StartInfo.Arguments);
if (!CheckForPromptParameters(process, Text)) if (!CheckForPromptParameters(process, Text))
@ -949,6 +1053,8 @@ namespace Nikse.SubtitleEdit.Forms
CloseVideo(); CloseVideo();
if (_videoInfo != null)
{
using (var graphics = CreateGraphics()) using (var graphics = CreateGraphics())
{ {
using (var font = new Font(UiUtil.GetDefaultFont().FontFamily, (float)numericUpDownFontSize.Value, FontStyle.Regular)) using (var font = new Font(UiUtil.GetDefaultFont().FontFamily, (float)numericUpDownFontSize.Value, FontStyle.Regular))
@ -957,6 +1063,7 @@ namespace Nikse.SubtitleEdit.Forms
Configuration.Settings.Tools.GenVideoFontSizePercentOfHeight = (float)(currentHeight / _videoInfo.Height); Configuration.Settings.Tools.GenVideoFontSizePercentOfHeight = (float)(currentHeight / _videoInfo.Height);
} }
} }
}
try try
{ {
@ -1272,20 +1379,19 @@ namespace Nikse.SubtitleEdit.Forms
private void GenerateVideoWithHardSubs_Shown(object sender, EventArgs e) 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)); _loading = false;
buttonGenerate.Enabled = false;
return; return;
} }
var targetFileSizeMb = (int)Math.Round(new FileInfo(_inputVideoFileName).Length / 1024.0 / 1024); var targetFileSizeMb = (int)Math.Round(new FileInfo(_inputVideoFileName).Length / 1024.0 / 1024);
numericUpDownTargetFileSize.Value = Math.Max(targetFileSizeMb, numericUpDownTargetFileSize.Minimum); numericUpDownTargetFileSize.Value = Math.Max(targetFileSizeMb, numericUpDownTargetFileSize.Minimum);
_loading = false;
UiUtil.FixFonts(groupBoxSettings, 2000); UiUtil.FixFonts(groupBoxSettings, 2000);
_loading = false;
panelOutlineColor.BackColor = Configuration.Settings.Tools.GenVideoNonAssaBoxColor;
panelForeColor.BackColor = Configuration.Settings.Tools.GenVideoNonAssaTextColor;
if (_mpvOn) if (_mpvOn)
{ {
@ -1755,5 +1861,213 @@ namespace Nikse.SubtitleEdit.Forms
{ {
buttonForeColor_Click(null, null); 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);
}
} }
} }

View File

@ -123,6 +123,9 @@
<metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<metadata name="contextMenuStripBatch.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>468, 17</value>
</metadata>
<metadata name="contextMenuStripRes.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="contextMenuStripRes.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>104, 17</value> <value>104, 17</value>
</metadata> </metadata>

View File

@ -9099,12 +9099,19 @@ namespace Nikse.SubtitleEdit.Forms
return; return;
} }
if (form.BatchMode)
{
MessageBox.Show(form.BatchInfo);
}
else
{
var encodingTime = new TimeCode(form.MillisecondsEncoding).ToString(); 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)) 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); f.ShowDialog(this);
} }
} }
}
}; };
} }
@ -9873,6 +9880,19 @@ namespace Nikse.SubtitleEdit.Forms
return; 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); _subtitle.Paragraphs.RemoveAll(p => p.Id == audioClips[0].Paragraph.Id);
foreach (var p in form.TranscribedSubtitle.Paragraphs) foreach (var p in form.TranscribedSubtitle.Paragraphs)
@ -35638,12 +35658,6 @@ namespace Nikse.SubtitleEdit.Forms
return; return;
} }
if (string.IsNullOrEmpty(_videoFileName) || _videoInfo == null || _videoInfo.Width == 0 || _videoInfo.Height == 0)
{
MessageBox.Show(LanguageSettings.Current.General.NoVideoLoaded);
return;
}
if (!RequireFfmpegOk()) if (!RequireFfmpegOk())
{ {
return; return;
@ -35660,6 +35674,12 @@ namespace Nikse.SubtitleEdit.Forms
return; return;
} }
if (form.BatchMode)
{
MessageBox.Show(form.BatchInfo);
}
else
{
var encodingTime = new TimeCode(form.MillisecondsEncoding).ToString(); 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)) using (var f = new ExportPngXmlDialogOpenFolder(string.Format(LanguageSettings.Current.GenerateVideoWithBurnedInSubs.XGeneratedWithBurnedInSubsInX, Path.GetFileName(form.VideoFileName), encodingTime), Path.GetDirectoryName(form.VideoFileName), form.VideoFileName))
{ {
@ -35667,10 +35687,17 @@ namespace Nikse.SubtitleEdit.Forms
} }
} }
} }
}
private int? PrepareBurn(Subtitle sub) private int? PrepareBurn(Subtitle sub)
{ {
int? fontSize = null; int? fontSize = null;
if (_videoInfo == null)
{
return fontSize;
}
if (string.IsNullOrEmpty(sub.Header) || !IsAssa()) if (string.IsNullOrEmpty(sub.Header) || !IsAssa())
{ {
sub.Header = AdvancedSubStationAlpha.DefaultHeader; sub.Header = AdvancedSubStationAlpha.DefaultHeader;