More blank video

Related to #5478
This commit is contained in:
niksedk 2021-11-14 21:08:53 +01:00
parent 01c83cebc2
commit f207ef2bf8
5 changed files with 86 additions and 56 deletions

View File

@ -69,6 +69,7 @@ namespace Nikse.SubtitleEdit.Forms
this.x272ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.buttonVideoChooseStandardRes = new System.Windows.Forms.Button();
this.buttonChooseDuration = new System.Windows.Forms.Button();
this.toolStripMenuItemResBrowse = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWidth)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownHeight)).BeginInit();
this.groupBoxBackground.SuspendLayout();
@ -364,9 +365,10 @@ namespace Nikse.SubtitleEdit.Forms
this.pAL720x576ToolStripMenuItem,
this.nTSC720x480ToolStripMenuItem,
this.x352ToolStripMenuItem,
this.x272ToolStripMenuItem});
this.x272ToolStripMenuItem,
this.toolStripMenuItemResBrowse});
this.contextMenuStripRes.Name = "contextMenuStripRes";
this.contextMenuStripRes.Size = new System.Drawing.Size(204, 312);
this.contextMenuStripRes.Size = new System.Drawing.Size(204, 356);
//
// x2160ToolStripMenuItem
//
@ -486,6 +488,13 @@ namespace Nikse.SubtitleEdit.Forms
this.buttonChooseDuration.UseVisualStyleBackColor = true;
this.buttonChooseDuration.Click += new System.EventHandler(this.buttonChooseDuration_Click);
//
// toolStripMenuItemResBrowse
//
this.toolStripMenuItemResBrowse.Name = "toolStripMenuItemResBrowse";
this.toolStripMenuItemResBrowse.Size = new System.Drawing.Size(203, 22);
this.toolStripMenuItemResBrowse.Text = "...";
this.toolStripMenuItemResBrowse.Click += new System.EventHandler(this.toolStripMenuItemResBrowse_Click);
//
// GenerateVideo
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@ -516,7 +525,6 @@ namespace Nikse.SubtitleEdit.Forms
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "GenerateVideo";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.GenerateVideo_FormClosing);
this.Load += new System.EventHandler(this.GenerateVideo_Load);
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWidth)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownHeight)).EndInit();
this.groupBoxBackground.ResumeLayout(false);
@ -568,5 +576,6 @@ namespace Nikse.SubtitleEdit.Forms
private System.Windows.Forms.Button buttonChooseImageFile;
private System.Windows.Forms.RadioButton radioButtonImage;
private System.Windows.Forms.Button buttonChooseDuration;
private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemResBrowse;
}
}

View File

@ -20,7 +20,7 @@ namespace Nikse.SubtitleEdit.Forms
private static readonly Regex FrameFinderRegex = new Regex(@"[Ff]rame=\s*\d+", RegexOptions.Compiled);
private Bitmap _backgroundImage;
public GenerateVideo(Subtitle subtitle)
public GenerateVideo(Subtitle subtitle, VideoInfo videoInfo)
{
UiUtil.PreInitialize(this);
InitializeComponent();
@ -81,7 +81,13 @@ namespace Nikse.SubtitleEdit.Forms
break;
}
}
if (videoInfo != null && videoInfo.Success && videoInfo.TotalSeconds > 0)
{
numericUpDownDurationMinutes.Value = (decimal)(videoInfo.TotalSeconds / 60.0);
}
}
private void OutputHandler(object sendingProcess, DataReceivedEventArgs outLine)
{
if (string.IsNullOrWhiteSpace(outLine.Data))
@ -308,9 +314,24 @@ namespace Nikse.SubtitleEdit.Forms
}
}
private void GenerateVideo_Load(object sender, EventArgs e)
private void toolStripMenuItemResBrowse_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.FileName = string.Empty;
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
var info = UiUtil.GetVideoInfo(openFileDialog1.FileName);
if (info != null && info.Success && info.Width > 0 && info.Height > 0)
{
numericUpDownWidth.Value = info.Width;
numericUpDownHeight.Value = info.Height;
}
}
}
}
}
}

View File

@ -278,10 +278,10 @@ namespace Nikse.SubtitleEdit.Forms
this.toolStripMenuItemSetLanguage = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemWebVTT = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemPreview = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemDelete = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemInsertBefore = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemInsertAfter = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemInsertSubtitle = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemDelete = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemCopySourceText = new System.Windows.Forms.ToolStripMenuItem();
this.toolStripMenuItemColumn = new System.Windows.Forms.ToolStripMenuItem();
this.columnDeleteTextOnlyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@ -2536,7 +2536,7 @@ namespace Nikse.SubtitleEdit.Forms
this.toolStripMenuItemSelectedLines,
this.toolStripMenuItemGoogleMicrosoftTranslateSelLine});
this.contextMenuStripListView.Name = "contextMenuStripListView";
this.contextMenuStripListView.Size = new System.Drawing.Size(285, 798);
this.contextMenuStripListView.Size = new System.Drawing.Size(285, 776);
this.contextMenuStripListView.Closed += new System.Windows.Forms.ToolStripDropDownClosedEventHandler(this.MenuClosed);
this.contextMenuStripListView.Opening += new System.ComponentModel.CancelEventHandler(this.ContextMenuStripListViewOpening);
this.contextMenuStripListView.Opened += new System.EventHandler(this.MenuOpened);
@ -2629,6 +2629,13 @@ namespace Nikse.SubtitleEdit.Forms
this.toolStripMenuItemPreview.Text = "WebVTT browser preview";
this.toolStripMenuItemPreview.Click += new System.EventHandler(this.toolStripMenuItemPreview_Click);
//
// toolStripMenuItemDelete
//
this.toolStripMenuItemDelete.Name = "toolStripMenuItemDelete";
this.toolStripMenuItemDelete.Size = new System.Drawing.Size(284, 22);
this.toolStripMenuItemDelete.Text = "Delete";
this.toolStripMenuItemDelete.Click += new System.EventHandler(this.ToolStripMenuItemDeleteClick);
//
// toolStripMenuItemInsertBefore
//
this.toolStripMenuItemInsertBefore.Name = "toolStripMenuItemInsertBefore";
@ -2650,13 +2657,6 @@ namespace Nikse.SubtitleEdit.Forms
this.toolStripMenuItemInsertSubtitle.Text = "Insert subtitle file after this line...";
this.toolStripMenuItemInsertSubtitle.Click += new System.EventHandler(this.ToolStripMenuItemInsertSubtitleClick);
//
// toolStripMenuItemDelete
//
this.toolStripMenuItemDelete.Name = "toolStripMenuItemDelete";
this.toolStripMenuItemDelete.Size = new System.Drawing.Size(284, 22);
this.toolStripMenuItemDelete.Text = "Delete";
this.toolStripMenuItemDelete.Click += new System.EventHandler(this.ToolStripMenuItemDeleteClick);
//
// toolStripMenuItemCopySourceText
//
this.toolStripMenuItemCopySourceText.Name = "toolStripMenuItemCopySourceText";

View File

@ -32047,7 +32047,7 @@ namespace Nikse.SubtitleEdit.Forms
}
}
using (var form = new GenerateVideo(_subtitle))
using (var form = new GenerateVideo(_subtitle, _videoInfo))
{
var result = form.ShowDialog(this);
if (result != DialogResult.OK)

View File

@ -790,46 +790,46 @@
<value>
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAADw
CAAAAk1TRnQBSQFMAgEBAgEABCwBEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEoAwABQAMA
ARADAAEBAQABCAYAAQQYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB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AAQdSQA
AewB9AQAAewB9AQABHUB7AV1AewFdSQAAewBDwHyAwAB7AEPAfIDAAR1AewBDwR1AewBDwR1JAAB7AFJ
AQ8B8gIAAewBSQEPAfICAAR1AewBSQEPA3UB7AFJAQ8DdSAAAewBEQFDARUBFAFyAUkBDwEHAesBFAFy
AUkBDwHyAQAB7AERAUMBFQEUAXIBSQEPAQcB6wEUAXIBSQEPAnUgAAHtAQgBeARyAUkBDwRyAUkBDwHy
Ae0BCAF4BHIBSQEPBHIBSQEPAXUgAAGSAQgDmAJ4AnIBbQGYAngCcgFtAZIBCAOYAngCcgFtAZgCeAJy
AW0gAAEcAcIECAJ4AewBmQIIAngB7AHzARwBwgQIAngB7AGZAggCeAHsAXUgAAGYARwBkgHtAewBCAGY
AewB8AHvAewBCAGYAewB8wEAAZgBHAGSAe0B7AEIAZgB7AHwAe8B7AEIAZgB7AJ1JAAB7QEIAewB8wIA
Ae0BCAHsAfMCAAR1Ae0BCAHsA3UB7QEIAewDdSQAAZIB7AHzAwABkgHsAfMDAAR1AZIB7AR1AZIB7AR1
JAABHAH0BAABHAH0BAAEdQEcBXUBHAV1MAAQdTAAEHUgAAFCAU0BPgcAAT4DAAEoAwABQAMAARADAAEB
AQABAQUAAYAXAAP/AQAC/wYAAv8GAAL/BgAB8wHPBgAB8QHHBgAB8AHDBwABAR8AAQEGAAHwAcMGAAHx
AccGAAHzAc8GAAL/BgAC/wYACw==
</value>
</data>
<metadata name="timerTextUndo.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">