mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-11-22 11:12:36 +01:00
Add "image" option for "gen blank video" - thx Thomas :)
Related to #5478
This commit is contained in:
parent
2f369991c6
commit
01c83cebc2
101
src/ui/Forms/GenerateVideo.Designer.cs
generated
101
src/ui/Forms/GenerateVideo.Designer.cs
generated
@ -41,6 +41,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.labelResolution = new System.Windows.Forms.Label();
|
||||
this.labelX = new System.Windows.Forms.Label();
|
||||
this.groupBoxBackground = new System.Windows.Forms.GroupBox();
|
||||
this.labelImageFileName = new System.Windows.Forms.Label();
|
||||
this.buttonChooseImageFile = new System.Windows.Forms.Button();
|
||||
this.radioButtonImage = new System.Windows.Forms.RadioButton();
|
||||
this.radioButtonColor = new System.Windows.Forms.RadioButton();
|
||||
this.radioButtonCheckeredImage = new System.Windows.Forms.RadioButton();
|
||||
this.numericUpDownDurationMinutes = new System.Windows.Forms.NumericUpDown();
|
||||
@ -65,6 +68,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.x352ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.x272ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.buttonVideoChooseStandardRes = new System.Windows.Forms.Button();
|
||||
this.buttonChooseDuration = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWidth)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownHeight)).BeginInit();
|
||||
this.groupBoxBackground.SuspendLayout();
|
||||
@ -95,7 +99,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
//
|
||||
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonOK.ImeMode = System.Windows.Forms.ImeMode.NoControl;
|
||||
this.buttonOK.Location = new System.Drawing.Point(499, 155);
|
||||
this.buttonOK.Location = new System.Drawing.Point(549, 217);
|
||||
this.buttonOK.Name = "buttonOK";
|
||||
this.buttonOK.Size = new System.Drawing.Size(121, 23);
|
||||
this.buttonOK.TabIndex = 20;
|
||||
@ -108,7 +112,7 @@ 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(626, 155);
|
||||
this.buttonCancel.Location = new System.Drawing.Point(676, 217);
|
||||
this.buttonCancel.Name = "buttonCancel";
|
||||
this.buttonCancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.buttonCancel.TabIndex = 21;
|
||||
@ -120,9 +124,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
//
|
||||
this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.progressBar1.Location = new System.Drawing.Point(12, 155);
|
||||
this.progressBar1.Location = new System.Drawing.Point(12, 217);
|
||||
this.progressBar1.Name = "progressBar1";
|
||||
this.progressBar1.Size = new System.Drawing.Size(481, 10);
|
||||
this.progressBar1.Size = new System.Drawing.Size(531, 10);
|
||||
this.progressBar1.TabIndex = 8;
|
||||
this.progressBar1.Visible = false;
|
||||
//
|
||||
@ -142,7 +146,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericUpDownWidth.Location = new System.Drawing.Point(165, 56);
|
||||
this.numericUpDownWidth.Location = new System.Drawing.Point(165, 60);
|
||||
this.numericUpDownWidth.Maximum = new decimal(new int[] {
|
||||
50000,
|
||||
0,
|
||||
@ -155,7 +159,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
0});
|
||||
this.numericUpDownWidth.Name = "numericUpDownWidth";
|
||||
this.numericUpDownWidth.Size = new System.Drawing.Size(64, 20);
|
||||
this.numericUpDownWidth.TabIndex = 3;
|
||||
this.numericUpDownWidth.TabIndex = 2;
|
||||
this.numericUpDownWidth.Value = new decimal(new int[] {
|
||||
1280,
|
||||
0,
|
||||
@ -170,7 +174,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericUpDownHeight.Location = new System.Drawing.Point(253, 56);
|
||||
this.numericUpDownHeight.Location = new System.Drawing.Point(253, 60);
|
||||
this.numericUpDownHeight.Maximum = new decimal(new int[] {
|
||||
50000,
|
||||
0,
|
||||
@ -183,7 +187,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
0});
|
||||
this.numericUpDownHeight.Name = "numericUpDownHeight";
|
||||
this.numericUpDownHeight.Size = new System.Drawing.Size(64, 20);
|
||||
this.numericUpDownHeight.TabIndex = 5;
|
||||
this.numericUpDownHeight.TabIndex = 4;
|
||||
this.numericUpDownHeight.Value = new decimal(new int[] {
|
||||
720,
|
||||
0,
|
||||
@ -194,7 +198,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
// labelResolution
|
||||
//
|
||||
this.labelResolution.AutoSize = true;
|
||||
this.labelResolution.Location = new System.Drawing.Point(12, 58);
|
||||
this.labelResolution.Location = new System.Drawing.Point(12, 62);
|
||||
this.labelResolution.Name = "labelResolution";
|
||||
this.labelResolution.Size = new System.Drawing.Size(57, 13);
|
||||
this.labelResolution.TabIndex = 2;
|
||||
@ -203,25 +207,60 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
// labelX
|
||||
//
|
||||
this.labelX.AutoSize = true;
|
||||
this.labelX.Location = new System.Drawing.Point(235, 58);
|
||||
this.labelX.Location = new System.Drawing.Point(235, 62);
|
||||
this.labelX.Name = "labelX";
|
||||
this.labelX.Size = new System.Drawing.Size(12, 13);
|
||||
this.labelX.TabIndex = 4;
|
||||
this.labelX.TabIndex = 3;
|
||||
this.labelX.Text = "x";
|
||||
//
|
||||
// groupBoxBackground
|
||||
//
|
||||
this.groupBoxBackground.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBoxBackground.Controls.Add(this.labelImageFileName);
|
||||
this.groupBoxBackground.Controls.Add(this.buttonChooseImageFile);
|
||||
this.groupBoxBackground.Controls.Add(this.radioButtonImage);
|
||||
this.groupBoxBackground.Controls.Add(this.radioButtonColor);
|
||||
this.groupBoxBackground.Controls.Add(this.radioButtonCheckeredImage);
|
||||
this.groupBoxBackground.Controls.Add(this.buttonColor);
|
||||
this.groupBoxBackground.Controls.Add(this.panelColor);
|
||||
this.groupBoxBackground.Location = new System.Drawing.Point(387, 12);
|
||||
this.groupBoxBackground.Name = "groupBoxBackground";
|
||||
this.groupBoxBackground.Size = new System.Drawing.Size(314, 118);
|
||||
this.groupBoxBackground.Size = new System.Drawing.Size(366, 186);
|
||||
this.groupBoxBackground.TabIndex = 7;
|
||||
this.groupBoxBackground.TabStop = false;
|
||||
this.groupBoxBackground.Text = "Background";
|
||||
//
|
||||
// labelImageFileName
|
||||
//
|
||||
this.labelImageFileName.AutoSize = true;
|
||||
this.labelImageFileName.Location = new System.Drawing.Point(39, 135);
|
||||
this.labelImageFileName.Name = "labelImageFileName";
|
||||
this.labelImageFileName.Size = new System.Drawing.Size(102, 13);
|
||||
this.labelImageFileName.TabIndex = 34;
|
||||
this.labelImageFileName.Text = "labelImageFileName";
|
||||
//
|
||||
// buttonChooseImageFile
|
||||
//
|
||||
this.buttonChooseImageFile.Location = new System.Drawing.Point(78, 109);
|
||||
this.buttonChooseImageFile.Name = "buttonChooseImageFile";
|
||||
this.buttonChooseImageFile.Size = new System.Drawing.Size(25, 23);
|
||||
this.buttonChooseImageFile.TabIndex = 33;
|
||||
this.buttonChooseImageFile.Text = "...";
|
||||
this.buttonChooseImageFile.UseVisualStyleBackColor = true;
|
||||
this.buttonChooseImageFile.Click += new System.EventHandler(this.buttonChooseImageFile_Click);
|
||||
//
|
||||
// radioButtonImage
|
||||
//
|
||||
this.radioButtonImage.AutoSize = true;
|
||||
this.radioButtonImage.Location = new System.Drawing.Point(18, 112);
|
||||
this.radioButtonImage.Name = "radioButtonImage";
|
||||
this.radioButtonImage.Size = new System.Drawing.Size(54, 17);
|
||||
this.radioButtonImage.TabIndex = 12;
|
||||
this.radioButtonImage.Text = "Image";
|
||||
this.radioButtonImage.UseVisualStyleBackColor = true;
|
||||
this.radioButtonImage.CheckedChanged += new System.EventHandler(this.radioButtonImage_CheckedChanged);
|
||||
//
|
||||
// radioButtonColor
|
||||
//
|
||||
this.radioButtonColor.AutoSize = true;
|
||||
@ -259,7 +298,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
0});
|
||||
this.numericUpDownDurationMinutes.Name = "numericUpDownDurationMinutes";
|
||||
this.numericUpDownDurationMinutes.Size = new System.Drawing.Size(64, 20);
|
||||
this.numericUpDownDurationMinutes.TabIndex = 1;
|
||||
this.numericUpDownDurationMinutes.TabIndex = 0;
|
||||
this.numericUpDownDurationMinutes.Value = new decimal(new int[] {
|
||||
10,
|
||||
0,
|
||||
@ -270,7 +309,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
//
|
||||
this.labelPleaseWait.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.labelPleaseWait.AutoSize = true;
|
||||
this.labelPleaseWait.Location = new System.Drawing.Point(12, 135);
|
||||
this.labelPleaseWait.Location = new System.Drawing.Point(12, 197);
|
||||
this.labelPleaseWait.Name = "labelPleaseWait";
|
||||
this.labelPleaseWait.Size = new System.Drawing.Size(70, 13);
|
||||
this.labelPleaseWait.TabIndex = 7;
|
||||
@ -279,7 +318,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
// labelFrameRate
|
||||
//
|
||||
this.labelFrameRate.AutoSize = true;
|
||||
this.labelFrameRate.Location = new System.Drawing.Point(12, 83);
|
||||
this.labelFrameRate.Location = new System.Drawing.Point(12, 89);
|
||||
this.labelFrameRate.Name = "labelFrameRate";
|
||||
this.labelFrameRate.Size = new System.Drawing.Size(57, 13);
|
||||
this.labelFrameRate.TabIndex = 11;
|
||||
@ -289,7 +328,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
//
|
||||
this.comboBoxFrameRate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
|
||||
this.comboBoxFrameRate.FormattingEnabled = true;
|
||||
this.comboBoxFrameRate.Location = new System.Drawing.Point(165, 83);
|
||||
this.comboBoxFrameRate.Location = new System.Drawing.Point(165, 89);
|
||||
this.comboBoxFrameRate.Name = "comboBoxFrameRate";
|
||||
this.comboBoxFrameRate.Size = new System.Drawing.Size(121, 21);
|
||||
this.comboBoxFrameRate.TabIndex = 6;
|
||||
@ -303,7 +342,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
//
|
||||
this.labelProgress.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.labelProgress.AutoSize = true;
|
||||
this.labelProgress.Location = new System.Drawing.Point(12, 168);
|
||||
this.labelProgress.Location = new System.Drawing.Point(12, 230);
|
||||
this.labelProgress.Name = "labelProgress";
|
||||
this.labelProgress.Size = new System.Drawing.Size(88, 13);
|
||||
this.labelProgress.TabIndex = 30;
|
||||
@ -327,7 +366,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.x352ToolStripMenuItem,
|
||||
this.x272ToolStripMenuItem});
|
||||
this.contextMenuStripRes.Name = "contextMenuStripRes";
|
||||
this.contextMenuStripRes.Size = new System.Drawing.Size(204, 334);
|
||||
this.contextMenuStripRes.Size = new System.Drawing.Size(204, 312);
|
||||
//
|
||||
// x2160ToolStripMenuItem
|
||||
//
|
||||
@ -429,21 +468,30 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
//
|
||||
// buttonVideoChooseStandardRes
|
||||
//
|
||||
this.buttonVideoChooseStandardRes.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonVideoChooseStandardRes.Location = new System.Drawing.Point(323, 56);
|
||||
this.buttonVideoChooseStandardRes.Location = new System.Drawing.Point(323, 60);
|
||||
this.buttonVideoChooseStandardRes.Name = "buttonVideoChooseStandardRes";
|
||||
this.buttonVideoChooseStandardRes.Size = new System.Drawing.Size(27, 23);
|
||||
this.buttonVideoChooseStandardRes.TabIndex = 32;
|
||||
this.buttonVideoChooseStandardRes.Size = new System.Drawing.Size(25, 23);
|
||||
this.buttonVideoChooseStandardRes.TabIndex = 5;
|
||||
this.buttonVideoChooseStandardRes.Text = "...";
|
||||
this.buttonVideoChooseStandardRes.UseVisualStyleBackColor = true;
|
||||
this.buttonVideoChooseStandardRes.Click += new System.EventHandler(this.buttonVideoChooseStandardRes_Click);
|
||||
//
|
||||
// buttonChooseDuration
|
||||
//
|
||||
this.buttonChooseDuration.Location = new System.Drawing.Point(236, 29);
|
||||
this.buttonChooseDuration.Name = "buttonChooseDuration";
|
||||
this.buttonChooseDuration.Size = new System.Drawing.Size(25, 23);
|
||||
this.buttonChooseDuration.TabIndex = 1;
|
||||
this.buttonChooseDuration.Text = "...";
|
||||
this.buttonChooseDuration.UseVisualStyleBackColor = true;
|
||||
this.buttonChooseDuration.Click += new System.EventHandler(this.buttonChooseDuration_Click);
|
||||
//
|
||||
// GenerateVideo
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(713, 190);
|
||||
this.ClientSize = new System.Drawing.Size(763, 252);
|
||||
this.Controls.Add(this.buttonChooseDuration);
|
||||
this.Controls.Add(this.buttonVideoChooseStandardRes);
|
||||
this.Controls.Add(this.labelProgress);
|
||||
this.Controls.Add(this.comboBoxFrameRate);
|
||||
@ -468,6 +516,7 @@ 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);
|
||||
@ -515,5 +564,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
private System.Windows.Forms.ToolStripMenuItem x352ToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem x272ToolStripMenuItem;
|
||||
private System.Windows.Forms.Button buttonVideoChooseStandardRes;
|
||||
private System.Windows.Forms.Label labelImageFileName;
|
||||
private System.Windows.Forms.Button buttonChooseImageFile;
|
||||
private System.Windows.Forms.RadioButton radioButtonImage;
|
||||
private System.Windows.Forms.Button buttonChooseDuration;
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
using Nikse.SubtitleEdit.Logic;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
@ -11,13 +12,13 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
public sealed partial class GenerateVideo : Form
|
||||
{
|
||||
|
||||
public string VideoFileName { get; private set; }
|
||||
private bool _abort;
|
||||
private long _processedFrames;
|
||||
private long _startTicks;
|
||||
private long _totalFrames;
|
||||
private static readonly Regex FrameFinderRegex = new Regex(@"[Ff]rame=\s*\d+", RegexOptions.Compiled);
|
||||
private Bitmap _backgroundImage;
|
||||
|
||||
public GenerateVideo(Subtitle subtitle)
|
||||
{
|
||||
@ -49,9 +50,11 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
progressBar1.Visible = false;
|
||||
labelPleaseWait.Visible = false;
|
||||
labelProgress.Text = string.Empty;
|
||||
labelImageFileName.Text = string.Empty;
|
||||
|
||||
var left = Math.Max(labelResolution.Left + labelResolution.Width, labelDuration.Left + labelDuration.Width) + 5;
|
||||
numericUpDownDurationMinutes.Left = left;
|
||||
buttonChooseDuration.Left = numericUpDownDurationMinutes.Left + numericUpDownDurationMinutes.Width + 9;
|
||||
numericUpDownWidth.Left = left;
|
||||
labelX.Left = numericUpDownWidth.Left + numericUpDownWidth.Width + 3;
|
||||
numericUpDownHeight.Left = labelX.Left + labelX.Width + 3;
|
||||
@ -107,7 +110,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
private void buttonOK_Click(object sender, EventArgs e)
|
||||
{
|
||||
EnableDisableControls(false);
|
||||
var fileName = radioButtonColor.Checked ? "blank_video_solid" : "blank_video_checkered";
|
||||
var fileName = radioButtonColor.Checked ? "blank_video_solid" : (radioButtonCheckeredImage.Checked ? "blank_video_checkered" : "blank_video_image");
|
||||
using (var saveDialog = new SaveFileDialog { FileName = fileName, Filter = "MP4|*.mp4|Matroska|*.mkv|WebM|*.webm" })
|
||||
{
|
||||
if (saveDialog.ShowDialog(this) != DialogResult.OK)
|
||||
@ -134,6 +137,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
panelColor.BackColor,
|
||||
radioButtonCheckeredImage.Checked,
|
||||
decimal.Parse(comboBoxFrameRate.Text),
|
||||
radioButtonImage.Checked ? _backgroundImage : null,
|
||||
OutputHandler);
|
||||
|
||||
process.Start();
|
||||
@ -198,6 +202,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
Configuration.Settings.Tools.BlankVideoUseCheckeredImage = radioButtonCheckeredImage.Checked;
|
||||
Configuration.Settings.Tools.BlankVideoMinutes = (int)numericUpDownDurationMinutes.Value;
|
||||
Configuration.Settings.Tools.BlankVideoFrameRate = Convert.ToDecimal(comboBoxFrameRate.Text, CultureInfo.CurrentCulture);
|
||||
|
||||
_backgroundImage?.Dispose();
|
||||
}
|
||||
|
||||
private void buttonCancel_Click(object sender, EventArgs e)
|
||||
@ -255,5 +261,56 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
var coordinates = buttonVideoChooseStandardRes.PointToClient(Cursor.Position);
|
||||
contextMenuStripRes.Show(buttonVideoChooseStandardRes, coordinates);
|
||||
}
|
||||
|
||||
private void buttonChooseImageFile_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (var openFileDialog1 = new OpenFileDialog())
|
||||
{
|
||||
openFileDialog1.Title = "Open...";
|
||||
openFileDialog1.FileName = string.Empty;
|
||||
openFileDialog1.Filter = "Images|*.png;*.jpg;*.jpeg;*.gif;*.tiff;*.bmp";
|
||||
if (openFileDialog1.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
_backgroundImage?.Dispose();
|
||||
_backgroundImage = (Bitmap)Bitmap.FromFile(openFileDialog1.FileName);
|
||||
labelImageFileName.Text = openFileDialog1.FileName;
|
||||
numericUpDownWidth.Value = _backgroundImage.Width;
|
||||
numericUpDownHeight.Value = _backgroundImage.Height;
|
||||
radioButtonImage.Checked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void radioButtonImage_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (radioButtonImage.Checked && _backgroundImage == null)
|
||||
{
|
||||
buttonChooseImageFile_Click(null, null);
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonChooseDuration_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.TotalSeconds > 0)
|
||||
{
|
||||
numericUpDownDurationMinutes.Value = (decimal)(info.TotalSeconds / 60.0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void GenerateVideo_Load(object sender, EventArgs e)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -719,7 +719,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
(int)numericUpDownHeight.Value,
|
||||
Color.Black,
|
||||
true,
|
||||
25);
|
||||
25,
|
||||
null);
|
||||
process.Start();
|
||||
while (!process.HasExited)
|
||||
{
|
||||
|
@ -32020,6 +32020,12 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
|
||||
private void generateBlankVideoToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
var ffmpegFullPath = Path.Combine(Configuration.DataDirectory, "ffmpeg", "ffmpeg.exe");
|
||||
if (Configuration.IsRunningOnWindows && string.IsNullOrWhiteSpace(Configuration.Settings.General.FFmpegLocation) && File.Exists(ffmpegFullPath))
|
||||
{
|
||||
Configuration.Settings.General.FFmpegLocation = ffmpegFullPath;
|
||||
}
|
||||
|
||||
if (Configuration.IsRunningOnWindows && (string.IsNullOrWhiteSpace(Configuration.Settings.General.FFmpegLocation) || !File.Exists(Configuration.Settings.General.FFmpegLocation)))
|
||||
{
|
||||
if (MessageBox.Show(LanguageSettings.Current.Settings.DownloadFFmpeg, "Subtitle Edit", MessageBoxButtons.YesNoCancel) != DialogResult.Yes)
|
||||
@ -32108,6 +32114,12 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
return;
|
||||
}
|
||||
|
||||
var ffmpegFullPath = Path.Combine(Configuration.DataDirectory, "ffmpeg", "ffmpeg.exe");
|
||||
if (Configuration.IsRunningOnWindows && string.IsNullOrWhiteSpace(Configuration.Settings.General.FFmpegLocation) && File.Exists(ffmpegFullPath))
|
||||
{
|
||||
Configuration.Settings.General.FFmpegLocation = ffmpegFullPath;
|
||||
}
|
||||
|
||||
if (Configuration.IsRunningOnWindows && (string.IsNullOrWhiteSpace(Configuration.Settings.General.FFmpegLocation) || !File.Exists(Configuration.Settings.General.FFmpegLocation)))
|
||||
{
|
||||
if (MessageBox.Show(LanguageSettings.Current.Settings.DownloadFFmpeg, "Subtitle Edit", MessageBoxButtons.YesNoCancel) != DialogResult.Yes)
|
||||
|
@ -1,4 +1,5 @@
|
||||
using Nikse.SubtitleEdit.Core.Common;
|
||||
using Nikse.SubtitleEdit.Forms;
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
@ -20,7 +21,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
|
||||
try
|
||||
{
|
||||
var process = GenerateVideoFile(previewFileName, 3, 720, 480, Color.Black, true, 25);
|
||||
var process = GenerateVideoFile(previewFileName, 3, 720, 480, Color.Black, true, 25, null);
|
||||
process.Start();
|
||||
process.WaitForExit();
|
||||
|
||||
@ -32,11 +33,18 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
}
|
||||
}
|
||||
|
||||
public static Process GenerateVideoFile(string previewFileName, int seconds, int width, int height, Color color, bool checkered, decimal frameRate, DataReceivedEventHandler dataReceivedHandler = null)
|
||||
public static Process GenerateVideoFile(string previewFileName, int seconds, int width, int height, Color color, bool checkered, decimal frameRate, Bitmap bitmap, DataReceivedEventHandler dataReceivedHandler = null)
|
||||
{
|
||||
Process processMakeVideo;
|
||||
|
||||
if (checkered)
|
||||
if (bitmap != null)
|
||||
{
|
||||
var tempImageFileName = Path.Combine(Path.GetTempPath(), Guid.NewGuid() + ".png");
|
||||
var backgroundImage = ExportPngXml.ResizeBitmap(bitmap, width, height);
|
||||
backgroundImage.Save(tempImageFileName, ImageFormat.Png);
|
||||
processMakeVideo = GetFFmpegProcess(tempImageFileName, previewFileName, backgroundImage.Width, backgroundImage.Height, seconds, frameRate);
|
||||
}
|
||||
else if (checkered)
|
||||
{
|
||||
const int rectangleSize = 9;
|
||||
var backgroundImage = TextDesigner.MakeBackgroundImage(width, height, rectangleSize, Configuration.Settings.General.UseDarkTheme);
|
||||
|
Loading…
Reference in New Issue
Block a user