Work on gen video w sub

This commit is contained in:
niksedk 2021-09-16 20:03:11 +02:00
parent 6e76611883
commit baf22da4b8
4 changed files with 588 additions and 395 deletions

View File

@ -39,49 +39,53 @@ namespace Nikse.SubtitleEdit.Forms
this.timer1 = new System.Windows.Forms.Timer(this.components); this.timer1 = new System.Windows.Forms.Timer(this.components);
this.labelProgress = new System.Windows.Forms.Label(); this.labelProgress = new System.Windows.Forms.Label();
this.groupBoxSettings = new System.Windows.Forms.GroupBox(); this.groupBoxSettings = new System.Windows.Forms.GroupBox();
this.comboBoxTune = new System.Windows.Forms.ComboBox(); this.comboBoxSubtitleFont = new System.Windows.Forms.ComboBox();
this.labelTune = new System.Windows.Forms.Label(); this.labelSubtitleFont = new System.Windows.Forms.Label();
this.comboBoxAudioSampleRate = new System.Windows.Forms.ComboBox(); this.buttonPreview = new System.Windows.Forms.Button();
this.labelAudioSampleRate = new System.Windows.Forms.Label(); this.groupBoxVideo = new System.Windows.Forms.GroupBox();
this.checkBoxMakeStereo = new System.Windows.Forms.CheckBox();
this.comboBoxAudioEnc = new System.Windows.Forms.ComboBox();
this.labelAudioEnc = new System.Windows.Forms.Label();
this.comboBoxVideoEncoding = new System.Windows.Forms.ComboBox();
this.labelVideoEncoding = new System.Windows.Forms.Label();
this.comboBoxCrf = new System.Windows.Forms.ComboBox();
this.labelCRF = new System.Windows.Forms.Label();
this.comboBoxPreset = new System.Windows.Forms.ComboBox();
this.labelPreset = new System.Windows.Forms.Label();
this.labelFileName = new System.Windows.Forms.Label();
this.labelX = new System.Windows.Forms.Label();
this.labelResolution = new System.Windows.Forms.Label(); this.labelResolution = new System.Windows.Forms.Label();
this.numericUpDownHeight = new System.Windows.Forms.NumericUpDown();
this.numericUpDownWidth = new System.Windows.Forms.NumericUpDown(); this.numericUpDownWidth = new System.Windows.Forms.NumericUpDown();
this.numericUpDownHeight = new System.Windows.Forms.NumericUpDown();
this.labelX = new System.Windows.Forms.Label();
this.labelPreset = new System.Windows.Forms.Label();
this.comboBoxTune = new System.Windows.Forms.ComboBox();
this.comboBoxPreset = new System.Windows.Forms.ComboBox();
this.labelTune = new System.Windows.Forms.Label();
this.labelCRF = new System.Windows.Forms.Label();
this.comboBoxVideoEncoding = new System.Windows.Forms.ComboBox();
this.comboBoxCrf = new System.Windows.Forms.ComboBox();
this.labelVideoEncoding = new System.Windows.Forms.Label();
this.groupBoxAudio = new System.Windows.Forms.GroupBox();
this.labelAudioEnc = new System.Windows.Forms.Label();
this.comboBoxAudioBitRate = new System.Windows.Forms.ComboBox();
this.comboBoxAudioEnc = new System.Windows.Forms.ComboBox();
this.labelAudioBitRate = new System.Windows.Forms.Label();
this.checkBoxMakeStereo = new System.Windows.Forms.CheckBox();
this.labelAudioSampleRate = new System.Windows.Forms.Label();
this.comboBoxAudioSampleRate = new System.Windows.Forms.ComboBox();
this.numericUpDownTargetFileSize = new System.Windows.Forms.NumericUpDown();
this.labelFileSize = new System.Windows.Forms.Label();
this.checkBoxTargetFileSize = new System.Windows.Forms.CheckBox();
this.labelFileName = new System.Windows.Forms.Label();
this.linkLabelHelp = new System.Windows.Forms.LinkLabel(); this.linkLabelHelp = new System.Windows.Forms.LinkLabel();
this.textBoxLog = new System.Windows.Forms.TextBox(); this.textBoxLog = new System.Windows.Forms.TextBox();
this.labelInfo = new System.Windows.Forms.Label(); this.labelInfo = new System.Windows.Forms.Label();
this.checkBoxTargetFileSize = new System.Windows.Forms.CheckBox();
this.numericUpDownTargetFileSize = new System.Windows.Forms.NumericUpDown();
this.labelFileSize = new System.Windows.Forms.Label();
this.labelPass = new System.Windows.Forms.Label(); this.labelPass = new System.Windows.Forms.Label();
this.comboBoxAudioBitRate = new System.Windows.Forms.ComboBox(); this.checkBoxRightToLeft = new System.Windows.Forms.CheckBox();
this.labelAudioBitRate = new System.Windows.Forms.Label();
this.groupBoxAudio = new System.Windows.Forms.GroupBox();
this.groupBoxVideo = new System.Windows.Forms.GroupBox();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownFontSize)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownFontSize)).BeginInit();
this.groupBoxSettings.SuspendLayout(); this.groupBoxSettings.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownHeight)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWidth)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownTargetFileSize)).BeginInit();
this.groupBoxAudio.SuspendLayout();
this.groupBoxVideo.SuspendLayout(); this.groupBoxVideo.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWidth)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownHeight)).BeginInit();
this.groupBoxAudio.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownTargetFileSize)).BeginInit();
this.SuspendLayout(); this.SuspendLayout();
// //
// progressBar1 // progressBar1
// //
this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) this.progressBar1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right))); | System.Windows.Forms.AnchorStyles.Right)));
this.progressBar1.Location = new System.Drawing.Point(12, 438); this.progressBar1.Location = new System.Drawing.Point(12, 515);
this.progressBar1.Name = "progressBar1"; this.progressBar1.Name = "progressBar1";
this.progressBar1.Size = new System.Drawing.Size(628, 11); this.progressBar1.Size = new System.Drawing.Size(628, 11);
this.progressBar1.TabIndex = 22; this.progressBar1.TabIndex = 22;
@ -91,7 +95,7 @@ namespace Nikse.SubtitleEdit.Forms
// //
this.buttonOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); 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.ImeMode = System.Windows.Forms.ImeMode.NoControl;
this.buttonOK.Location = new System.Drawing.Point(646, 438); this.buttonOK.Location = new System.Drawing.Point(646, 515);
this.buttonOK.Name = "buttonOK"; this.buttonOK.Name = "buttonOK";
this.buttonOK.Size = new System.Drawing.Size(121, 23); this.buttonOK.Size = new System.Drawing.Size(121, 23);
this.buttonOK.TabIndex = 23; this.buttonOK.TabIndex = 23;
@ -104,7 +108,7 @@ 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(773, 438); this.buttonCancel.Location = new System.Drawing.Point(773, 515);
this.buttonCancel.Name = "buttonCancel"; this.buttonCancel.Name = "buttonCancel";
this.buttonCancel.Size = new System.Drawing.Size(75, 23); this.buttonCancel.Size = new System.Drawing.Size(75, 23);
this.buttonCancel.TabIndex = 24; this.buttonCancel.TabIndex = 24;
@ -116,7 +120,7 @@ namespace Nikse.SubtitleEdit.Forms
// //
this.labelPleaseWait.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.labelPleaseWait.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.labelPleaseWait.AutoSize = true; this.labelPleaseWait.AutoSize = true;
this.labelPleaseWait.Location = new System.Drawing.Point(12, 422); this.labelPleaseWait.Location = new System.Drawing.Point(12, 499);
this.labelPleaseWait.Name = "labelPleaseWait"; this.labelPleaseWait.Name = "labelPleaseWait";
this.labelPleaseWait.Size = new System.Drawing.Size(70, 13); this.labelPleaseWait.Size = new System.Drawing.Size(70, 13);
this.labelPleaseWait.TabIndex = 25; this.labelPleaseWait.TabIndex = 25;
@ -124,7 +128,7 @@ namespace Nikse.SubtitleEdit.Forms
// //
// numericUpDownFontSize // numericUpDownFontSize
// //
this.numericUpDownFontSize.Location = new System.Drawing.Point(104, 33); this.numericUpDownFontSize.Location = new System.Drawing.Point(120, 33);
this.numericUpDownFontSize.Maximum = new decimal(new int[] { this.numericUpDownFontSize.Maximum = new decimal(new int[] {
1000, 1000,
0, 0,
@ -162,7 +166,7 @@ namespace Nikse.SubtitleEdit.Forms
// //
this.labelProgress.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.labelProgress.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.labelProgress.AutoSize = true; this.labelProgress.AutoSize = true;
this.labelProgress.Location = new System.Drawing.Point(12, 452); this.labelProgress.Location = new System.Drawing.Point(12, 529);
this.labelProgress.Name = "labelProgress"; this.labelProgress.Name = "labelProgress";
this.labelProgress.Size = new System.Drawing.Size(88, 13); this.labelProgress.Size = new System.Drawing.Size(88, 13);
this.labelProgress.TabIndex = 29; this.labelProgress.TabIndex = 29;
@ -173,6 +177,10 @@ 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.checkBoxRightToLeft);
this.groupBoxSettings.Controls.Add(this.comboBoxSubtitleFont);
this.groupBoxSettings.Controls.Add(this.labelSubtitleFont);
this.groupBoxSettings.Controls.Add(this.buttonPreview);
this.groupBoxSettings.Controls.Add(this.groupBoxVideo); this.groupBoxSettings.Controls.Add(this.groupBoxVideo);
this.groupBoxSettings.Controls.Add(this.groupBoxAudio); this.groupBoxSettings.Controls.Add(this.groupBoxAudio);
this.groupBoxSettings.Controls.Add(this.numericUpDownTargetFileSize); this.groupBoxSettings.Controls.Add(this.numericUpDownTargetFileSize);
@ -183,192 +191,62 @@ namespace Nikse.SubtitleEdit.Forms
this.groupBoxSettings.Controls.Add(this.labelFontSize); this.groupBoxSettings.Controls.Add(this.labelFontSize);
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(836, 370); this.groupBoxSettings.Size = new System.Drawing.Size(836, 447);
this.groupBoxSettings.TabIndex = 30; this.groupBoxSettings.TabIndex = 30;
this.groupBoxSettings.TabStop = false; this.groupBoxSettings.TabStop = false;
this.groupBoxSettings.Text = "Settings"; this.groupBoxSettings.Text = "Settings";
// //
// comboBoxTune // comboBoxSubtitleFont
// //
this.comboBoxTune.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.comboBoxSubtitleFont.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxTune.FormattingEnabled = true; this.comboBoxSubtitleFont.DropDownWidth = 250;
this.comboBoxTune.Items.AddRange(new object[] { this.comboBoxSubtitleFont.FormattingEnabled = true;
"", this.comboBoxSubtitleFont.Location = new System.Drawing.Point(120, 63);
"film", this.comboBoxSubtitleFont.Name = "comboBoxSubtitleFont";
"animation", this.comboBoxSubtitleFont.Size = new System.Drawing.Size(250, 21);
"grain"}); this.comboBoxSubtitleFont.TabIndex = 58;
this.comboBoxTune.Location = new System.Drawing.Point(101, 139);
this.comboBoxTune.Name = "comboBoxTune";
this.comboBoxTune.Size = new System.Drawing.Size(121, 21);
this.comboBoxTune.TabIndex = 48;
// //
// labelTune // labelSubtitleFont
// //
this.labelTune.AutoSize = true; this.labelSubtitleFont.AutoSize = true;
this.labelTune.Location = new System.Drawing.Point(16, 141); this.labelSubtitleFont.Location = new System.Drawing.Point(19, 66);
this.labelTune.Name = "labelTune"; this.labelSubtitleFont.Name = "labelSubtitleFont";
this.labelTune.Size = new System.Drawing.Size(32, 13); this.labelSubtitleFont.Size = new System.Drawing.Size(63, 13);
this.labelTune.TabIndex = 47; this.labelSubtitleFont.TabIndex = 57;
this.labelTune.Text = "Tune"; this.labelSubtitleFont.Text = "Subtitle font";
// //
// comboBoxAudioSampleRate // buttonPreview
// //
this.comboBoxAudioSampleRate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.buttonPreview.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
this.comboBoxAudioSampleRate.FormattingEnabled = true; | System.Windows.Forms.AnchorStyles.Right)));
this.comboBoxAudioSampleRate.Items.AddRange(new object[] { this.buttonPreview.Location = new System.Drawing.Point(726, 19);
"44100 Hz", this.buttonPreview.Name = "buttonPreview";
"48000 Hz", this.buttonPreview.Size = new System.Drawing.Size(95, 23);
"88200 Hz", this.buttonPreview.TabIndex = 56;
"96000 Hz", this.buttonPreview.Text = "Preview";
"192000 Hz"}); this.buttonPreview.UseVisualStyleBackColor = true;
this.comboBoxAudioSampleRate.Location = new System.Drawing.Point(97, 83); this.buttonPreview.Click += new System.EventHandler(this.buttonPreview_Click);
this.comboBoxAudioSampleRate.Name = "comboBoxAudioSampleRate";
this.comboBoxAudioSampleRate.Size = new System.Drawing.Size(121, 21);
this.comboBoxAudioSampleRate.TabIndex = 45;
// //
// labelAudioSampleRate // groupBoxVideo
// //
this.labelAudioSampleRate.AutoSize = true; this.groupBoxVideo.Controls.Add(this.labelResolution);
this.labelAudioSampleRate.Location = new System.Drawing.Point(20, 85); this.groupBoxVideo.Controls.Add(this.numericUpDownWidth);
this.labelAudioSampleRate.Name = "labelAudioSampleRate"; this.groupBoxVideo.Controls.Add(this.numericUpDownHeight);
this.labelAudioSampleRate.Size = new System.Drawing.Size(63, 13); this.groupBoxVideo.Controls.Add(this.labelX);
this.labelAudioSampleRate.TabIndex = 44; this.groupBoxVideo.Controls.Add(this.labelPreset);
this.labelAudioSampleRate.Text = "Sample rate"; this.groupBoxVideo.Controls.Add(this.comboBoxTune);
// this.groupBoxVideo.Controls.Add(this.comboBoxPreset);
// checkBoxMakeStereo this.groupBoxVideo.Controls.Add(this.labelTune);
// this.groupBoxVideo.Controls.Add(this.labelCRF);
this.checkBoxMakeStereo.AutoSize = true; this.groupBoxVideo.Controls.Add(this.comboBoxVideoEncoding);
this.checkBoxMakeStereo.Checked = true; this.groupBoxVideo.Controls.Add(this.comboBoxCrf);
this.checkBoxMakeStereo.CheckState = System.Windows.Forms.CheckState.Checked; this.groupBoxVideo.Controls.Add(this.labelVideoEncoding);
this.checkBoxMakeStereo.Location = new System.Drawing.Point(97, 58); this.groupBoxVideo.Location = new System.Drawing.Point(6, 136);
this.checkBoxMakeStereo.Name = "checkBoxMakeStereo"; this.groupBoxVideo.Name = "groupBoxVideo";
this.checkBoxMakeStereo.Size = new System.Drawing.Size(57, 17); this.groupBoxVideo.Size = new System.Drawing.Size(364, 197);
this.checkBoxMakeStereo.TabIndex = 43; this.groupBoxVideo.TabIndex = 55;
this.checkBoxMakeStereo.Text = "Stereo"; this.groupBoxVideo.TabStop = false;
this.checkBoxMakeStereo.UseVisualStyleBackColor = true; this.groupBoxVideo.Text = "Video";
//
// comboBoxAudioEnc
//
this.comboBoxAudioEnc.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxAudioEnc.FormattingEnabled = true;
this.comboBoxAudioEnc.Items.AddRange(new object[] {
"copy",
"aac"});
this.comboBoxAudioEnc.Location = new System.Drawing.Point(97, 29);
this.comboBoxAudioEnc.Name = "comboBoxAudioEnc";
this.comboBoxAudioEnc.Size = new System.Drawing.Size(121, 21);
this.comboBoxAudioEnc.TabIndex = 42;
this.comboBoxAudioEnc.SelectedIndexChanged += new System.EventHandler(this.comboBoxAudioEnc_SelectedIndexChanged);
//
// labelAudioEnc
//
this.labelAudioEnc.AutoSize = true;
this.labelAudioEnc.Location = new System.Drawing.Point(20, 31);
this.labelAudioEnc.Name = "labelAudioEnc";
this.labelAudioEnc.Size = new System.Drawing.Size(52, 13);
this.labelAudioEnc.TabIndex = 41;
this.labelAudioEnc.Text = "Encoding";
//
// comboBoxVideoEncoding
//
this.comboBoxVideoEncoding.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxVideoEncoding.FormattingEnabled = true;
this.comboBoxVideoEncoding.Items.AddRange(new object[] {
"libx264",
"libx264rgb",
"libx265",
"libvpx-vp9"});
this.comboBoxVideoEncoding.Location = new System.Drawing.Point(101, 58);
this.comboBoxVideoEncoding.Name = "comboBoxVideoEncoding";
this.comboBoxVideoEncoding.Size = new System.Drawing.Size(121, 21);
this.comboBoxVideoEncoding.TabIndex = 40;
this.comboBoxVideoEncoding.SelectedIndexChanged += new System.EventHandler(this.comboBoxVideoEncoding_SelectedIndexChanged);
//
// labelVideoEncoding
//
this.labelVideoEncoding.AutoSize = true;
this.labelVideoEncoding.Location = new System.Drawing.Point(16, 60);
this.labelVideoEncoding.Name = "labelVideoEncoding";
this.labelVideoEncoding.Size = new System.Drawing.Size(55, 13);
this.labelVideoEncoding.TabIndex = 39;
this.labelVideoEncoding.Text = "Video enc";
//
// comboBoxCrf
//
this.comboBoxCrf.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxCrf.FormattingEnabled = true;
this.comboBoxCrf.Items.AddRange(new object[] {
"17",
"18",
"19",
"20",
"21",
"22",
"23",
"24",
"25",
"26",
"27",
"28"});
this.comboBoxCrf.Location = new System.Drawing.Point(101, 112);
this.comboBoxCrf.Name = "comboBoxCrf";
this.comboBoxCrf.Size = new System.Drawing.Size(121, 21);
this.comboBoxCrf.TabIndex = 38;
//
// labelCRF
//
this.labelCRF.AutoSize = true;
this.labelCRF.Location = new System.Drawing.Point(16, 114);
this.labelCRF.Name = "labelCRF";
this.labelCRF.Size = new System.Drawing.Size(28, 13);
this.labelCRF.TabIndex = 37;
this.labelCRF.Text = "CRF";
//
// comboBoxPreset
//
this.comboBoxPreset.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxPreset.FormattingEnabled = true;
this.comboBoxPreset.Items.AddRange(new object[] {
"ultrafast",
"superfast",
"veryfast",
"faster",
"fast",
"medium",
"slow",
"slower",
"veryslow "});
this.comboBoxPreset.Location = new System.Drawing.Point(101, 85);
this.comboBoxPreset.Name = "comboBoxPreset";
this.comboBoxPreset.Size = new System.Drawing.Size(121, 21);
this.comboBoxPreset.TabIndex = 36;
//
// labelPreset
//
this.labelPreset.AutoSize = true;
this.labelPreset.Location = new System.Drawing.Point(16, 87);
this.labelPreset.Name = "labelPreset";
this.labelPreset.Size = new System.Drawing.Size(37, 13);
this.labelPreset.TabIndex = 35;
this.labelPreset.Text = "Preset";
//
// labelFileName
//
this.labelFileName.AutoSize = true;
this.labelFileName.Location = new System.Drawing.Point(19, 343);
this.labelFileName.Name = "labelFileName";
this.labelFileName.Size = new System.Drawing.Size(52, 13);
this.labelFileName.TabIndex = 33;
this.labelFileName.Text = "File name";
//
// labelX
//
this.labelX.AutoSize = true;
this.labelX.Location = new System.Drawing.Point(172, 28);
this.labelX.Name = "labelX";
this.labelX.Size = new System.Drawing.Size(12, 13);
this.labelX.TabIndex = 31;
this.labelX.Text = "x";
// //
// labelResolution // labelResolution
// //
@ -379,34 +257,6 @@ namespace Nikse.SubtitleEdit.Forms
this.labelResolution.TabIndex = 29; this.labelResolution.TabIndex = 29;
this.labelResolution.Text = "Resolution"; this.labelResolution.Text = "Resolution";
// //
// numericUpDownHeight
//
this.numericUpDownHeight.Increment = new decimal(new int[] {
2,
0,
0,
0});
this.numericUpDownHeight.Location = new System.Drawing.Point(190, 26);
this.numericUpDownHeight.Maximum = new decimal(new int[] {
50000,
0,
0,
0});
this.numericUpDownHeight.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numericUpDownHeight.Name = "numericUpDownHeight";
this.numericUpDownHeight.Size = new System.Drawing.Size(64, 20);
this.numericUpDownHeight.TabIndex = 32;
this.numericUpDownHeight.Value = new decimal(new int[] {
720,
0,
0,
0});
this.numericUpDownHeight.ValueChanged += new System.EventHandler(this.numericUpDownHeight_ValueChanged);
//
// numericUpDownWidth // numericUpDownWidth
// //
this.numericUpDownWidth.Increment = new decimal(new int[] { this.numericUpDownWidth.Increment = new decimal(new int[] {
@ -435,50 +285,253 @@ namespace Nikse.SubtitleEdit.Forms
0}); 0});
this.numericUpDownWidth.ValueChanged += new System.EventHandler(this.numericUpDownWidth_ValueChanged); this.numericUpDownWidth.ValueChanged += new System.EventHandler(this.numericUpDownWidth_ValueChanged);
// //
// linkLabelHelp // numericUpDownHeight
// //
this.linkLabelHelp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.numericUpDownHeight.Increment = new decimal(new int[] {
this.linkLabelHelp.AutoSize = true; 2,
this.linkLabelHelp.Location = new System.Drawing.Point(819, 386); 0,
this.linkLabelHelp.Name = "linkLabelHelp"; 0,
this.linkLabelHelp.Size = new System.Drawing.Size(29, 13); 0});
this.linkLabelHelp.TabIndex = 46; this.numericUpDownHeight.Location = new System.Drawing.Point(190, 26);
this.linkLabelHelp.TabStop = true; this.numericUpDownHeight.Maximum = new decimal(new int[] {
this.linkLabelHelp.Text = "Help"; 50000,
this.linkLabelHelp.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelHelp_LinkClicked); 0,
0,
0});
this.numericUpDownHeight.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numericUpDownHeight.Name = "numericUpDownHeight";
this.numericUpDownHeight.Size = new System.Drawing.Size(64, 20);
this.numericUpDownHeight.TabIndex = 32;
this.numericUpDownHeight.Value = new decimal(new int[] {
720,
0,
0,
0});
this.numericUpDownHeight.ValueChanged += new System.EventHandler(this.numericUpDownHeight_ValueChanged);
// //
// textBoxLog // labelX
// //
this.textBoxLog.Location = new System.Drawing.Point(12, 13); this.labelX.AutoSize = true;
this.textBoxLog.Multiline = true; this.labelX.Location = new System.Drawing.Point(172, 28);
this.textBoxLog.Name = "textBoxLog"; this.labelX.Name = "labelX";
this.textBoxLog.Size = new System.Drawing.Size(188, 26); this.labelX.Size = new System.Drawing.Size(12, 13);
this.textBoxLog.TabIndex = 31; this.labelX.TabIndex = 31;
this.labelX.Text = "x";
// //
// labelInfo // labelPreset
// //
this.labelInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.labelPreset.AutoSize = true;
this.labelInfo.AutoSize = true; this.labelPreset.Location = new System.Drawing.Point(16, 87);
this.labelInfo.Location = new System.Drawing.Point(12, 386); this.labelPreset.Name = "labelPreset";
this.labelInfo.Name = "labelInfo"; this.labelPreset.Size = new System.Drawing.Size(37, 13);
this.labelInfo.Size = new System.Drawing.Size(25, 13); this.labelPreset.TabIndex = 35;
this.labelInfo.TabIndex = 46; this.labelPreset.Text = "Preset";
this.labelInfo.Text = "Info";
// //
// checkBoxTargetFileSize // comboBoxTune
// //
this.checkBoxTargetFileSize.AutoSize = true; this.comboBoxTune.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.checkBoxTargetFileSize.Location = new System.Drawing.Point(22, 277); this.comboBoxTune.FormattingEnabled = true;
this.checkBoxTargetFileSize.Name = "checkBoxTargetFileSize"; this.comboBoxTune.Items.AddRange(new object[] {
this.checkBoxTargetFileSize.Size = new System.Drawing.Size(192, 17); "",
this.checkBoxTargetFileSize.TabIndex = 49; "film",
this.checkBoxTargetFileSize.Text = "Target file size (two pass encoding)"; "animation",
this.checkBoxTargetFileSize.UseVisualStyleBackColor = true; "grain"});
this.checkBoxTargetFileSize.CheckedChanged += new System.EventHandler(this.checkBoxTargetFileSize_CheckedChanged); this.comboBoxTune.Location = new System.Drawing.Point(101, 139);
this.comboBoxTune.Name = "comboBoxTune";
this.comboBoxTune.Size = new System.Drawing.Size(121, 21);
this.comboBoxTune.TabIndex = 48;
//
// comboBoxPreset
//
this.comboBoxPreset.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxPreset.FormattingEnabled = true;
this.comboBoxPreset.Items.AddRange(new object[] {
"ultrafast",
"superfast",
"veryfast",
"faster",
"fast",
"medium",
"slow",
"slower",
"veryslow "});
this.comboBoxPreset.Location = new System.Drawing.Point(101, 85);
this.comboBoxPreset.Name = "comboBoxPreset";
this.comboBoxPreset.Size = new System.Drawing.Size(121, 21);
this.comboBoxPreset.TabIndex = 36;
//
// labelTune
//
this.labelTune.AutoSize = true;
this.labelTune.Location = new System.Drawing.Point(16, 141);
this.labelTune.Name = "labelTune";
this.labelTune.Size = new System.Drawing.Size(32, 13);
this.labelTune.TabIndex = 47;
this.labelTune.Text = "Tune";
//
// labelCRF
//
this.labelCRF.AutoSize = true;
this.labelCRF.Location = new System.Drawing.Point(16, 114);
this.labelCRF.Name = "labelCRF";
this.labelCRF.Size = new System.Drawing.Size(28, 13);
this.labelCRF.TabIndex = 37;
this.labelCRF.Text = "CRF";
//
// comboBoxVideoEncoding
//
this.comboBoxVideoEncoding.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxVideoEncoding.FormattingEnabled = true;
this.comboBoxVideoEncoding.Items.AddRange(new object[] {
"libx264",
"libx264rgb",
"libx265",
"libvpx-vp9"});
this.comboBoxVideoEncoding.Location = new System.Drawing.Point(101, 58);
this.comboBoxVideoEncoding.Name = "comboBoxVideoEncoding";
this.comboBoxVideoEncoding.Size = new System.Drawing.Size(121, 21);
this.comboBoxVideoEncoding.TabIndex = 40;
this.comboBoxVideoEncoding.SelectedIndexChanged += new System.EventHandler(this.comboBoxVideoEncoding_SelectedIndexChanged);
//
// comboBoxCrf
//
this.comboBoxCrf.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxCrf.FormattingEnabled = true;
this.comboBoxCrf.Items.AddRange(new object[] {
"17",
"18",
"19",
"20",
"21",
"22",
"23",
"24",
"25",
"26",
"27",
"28"});
this.comboBoxCrf.Location = new System.Drawing.Point(101, 112);
this.comboBoxCrf.Name = "comboBoxCrf";
this.comboBoxCrf.Size = new System.Drawing.Size(121, 21);
this.comboBoxCrf.TabIndex = 38;
//
// labelVideoEncoding
//
this.labelVideoEncoding.AutoSize = true;
this.labelVideoEncoding.Location = new System.Drawing.Point(16, 60);
this.labelVideoEncoding.Name = "labelVideoEncoding";
this.labelVideoEncoding.Size = new System.Drawing.Size(55, 13);
this.labelVideoEncoding.TabIndex = 39;
this.labelVideoEncoding.Text = "Video enc";
//
// groupBoxAudio
//
this.groupBoxAudio.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.groupBoxAudio.Controls.Add(this.labelAudioEnc);
this.groupBoxAudio.Controls.Add(this.comboBoxAudioBitRate);
this.groupBoxAudio.Controls.Add(this.comboBoxAudioEnc);
this.groupBoxAudio.Controls.Add(this.labelAudioBitRate);
this.groupBoxAudio.Controls.Add(this.checkBoxMakeStereo);
this.groupBoxAudio.Controls.Add(this.labelAudioSampleRate);
this.groupBoxAudio.Controls.Add(this.comboBoxAudioSampleRate);
this.groupBoxAudio.Location = new System.Drawing.Point(376, 136);
this.groupBoxAudio.Name = "groupBoxAudio";
this.groupBoxAudio.Size = new System.Drawing.Size(445, 222);
this.groupBoxAudio.TabIndex = 54;
this.groupBoxAudio.TabStop = false;
this.groupBoxAudio.Text = "Audio";
//
// labelAudioEnc
//
this.labelAudioEnc.AutoSize = true;
this.labelAudioEnc.Location = new System.Drawing.Point(20, 31);
this.labelAudioEnc.Name = "labelAudioEnc";
this.labelAudioEnc.Size = new System.Drawing.Size(52, 13);
this.labelAudioEnc.TabIndex = 41;
this.labelAudioEnc.Text = "Encoding";
//
// comboBoxAudioBitRate
//
this.comboBoxAudioBitRate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxAudioBitRate.FormattingEnabled = true;
this.comboBoxAudioBitRate.Items.AddRange(new object[] {
"64k",
"128k",
"160k",
"196k",
"320k"});
this.comboBoxAudioBitRate.Location = new System.Drawing.Point(97, 110);
this.comboBoxAudioBitRate.Name = "comboBoxAudioBitRate";
this.comboBoxAudioBitRate.Size = new System.Drawing.Size(121, 21);
this.comboBoxAudioBitRate.TabIndex = 53;
//
// comboBoxAudioEnc
//
this.comboBoxAudioEnc.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxAudioEnc.FormattingEnabled = true;
this.comboBoxAudioEnc.Items.AddRange(new object[] {
"copy",
"aac"});
this.comboBoxAudioEnc.Location = new System.Drawing.Point(97, 29);
this.comboBoxAudioEnc.Name = "comboBoxAudioEnc";
this.comboBoxAudioEnc.Size = new System.Drawing.Size(121, 21);
this.comboBoxAudioEnc.TabIndex = 42;
this.comboBoxAudioEnc.SelectedIndexChanged += new System.EventHandler(this.comboBoxAudioEnc_SelectedIndexChanged);
//
// labelAudioBitRate
//
this.labelAudioBitRate.AutoSize = true;
this.labelAudioBitRate.Location = new System.Drawing.Point(20, 112);
this.labelAudioBitRate.Name = "labelAudioBitRate";
this.labelAudioBitRate.Size = new System.Drawing.Size(40, 13);
this.labelAudioBitRate.TabIndex = 52;
this.labelAudioBitRate.Text = "Bit rate";
//
// checkBoxMakeStereo
//
this.checkBoxMakeStereo.AutoSize = true;
this.checkBoxMakeStereo.Checked = true;
this.checkBoxMakeStereo.CheckState = System.Windows.Forms.CheckState.Checked;
this.checkBoxMakeStereo.Location = new System.Drawing.Point(97, 58);
this.checkBoxMakeStereo.Name = "checkBoxMakeStereo";
this.checkBoxMakeStereo.Size = new System.Drawing.Size(57, 17);
this.checkBoxMakeStereo.TabIndex = 43;
this.checkBoxMakeStereo.Text = "Stereo";
this.checkBoxMakeStereo.UseVisualStyleBackColor = true;
//
// labelAudioSampleRate
//
this.labelAudioSampleRate.AutoSize = true;
this.labelAudioSampleRate.Location = new System.Drawing.Point(20, 85);
this.labelAudioSampleRate.Name = "labelAudioSampleRate";
this.labelAudioSampleRate.Size = new System.Drawing.Size(63, 13);
this.labelAudioSampleRate.TabIndex = 44;
this.labelAudioSampleRate.Text = "Sample rate";
//
// comboBoxAudioSampleRate
//
this.comboBoxAudioSampleRate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.comboBoxAudioSampleRate.FormattingEnabled = true;
this.comboBoxAudioSampleRate.Items.AddRange(new object[] {
"44100 Hz",
"48000 Hz",
"88200 Hz",
"96000 Hz",
"192000 Hz"});
this.comboBoxAudioSampleRate.Location = new System.Drawing.Point(97, 83);
this.comboBoxAudioSampleRate.Name = "comboBoxAudioSampleRate";
this.comboBoxAudioSampleRate.Size = new System.Drawing.Size(121, 21);
this.comboBoxAudioSampleRate.TabIndex = 45;
// //
// numericUpDownTargetFileSize // numericUpDownTargetFileSize
// //
this.numericUpDownTargetFileSize.Location = new System.Drawing.Point(120, 300); this.numericUpDownTargetFileSize.Location = new System.Drawing.Point(120, 372);
this.numericUpDownTargetFileSize.Maximum = new decimal(new int[] { this.numericUpDownTargetFileSize.Maximum = new decimal(new int[] {
25000, 25000,
0, 0,
@ -501,91 +554,87 @@ namespace Nikse.SubtitleEdit.Forms
// labelFileSize // labelFileSize
// //
this.labelFileSize.AutoSize = true; this.labelFileSize.AutoSize = true;
this.labelFileSize.Location = new System.Drawing.Point(35, 302); this.labelFileSize.Location = new System.Drawing.Point(35, 374);
this.labelFileSize.Name = "labelFileSize"; this.labelFileSize.Name = "labelFileSize";
this.labelFileSize.Size = new System.Drawing.Size(74, 13); this.labelFileSize.Size = new System.Drawing.Size(74, 13);
this.labelFileSize.TabIndex = 51; this.labelFileSize.TabIndex = 51;
this.labelFileSize.Text = "File size in MB"; this.labelFileSize.Text = "File size in MB";
// //
// checkBoxTargetFileSize
//
this.checkBoxTargetFileSize.AutoSize = true;
this.checkBoxTargetFileSize.Location = new System.Drawing.Point(22, 349);
this.checkBoxTargetFileSize.Name = "checkBoxTargetFileSize";
this.checkBoxTargetFileSize.Size = new System.Drawing.Size(192, 17);
this.checkBoxTargetFileSize.TabIndex = 49;
this.checkBoxTargetFileSize.Text = "Target file size (two pass encoding)";
this.checkBoxTargetFileSize.UseVisualStyleBackColor = true;
this.checkBoxTargetFileSize.CheckedChanged += new System.EventHandler(this.checkBoxTargetFileSize_CheckedChanged);
//
// labelFileName
//
this.labelFileName.AutoSize = true;
this.labelFileName.Location = new System.Drawing.Point(19, 420);
this.labelFileName.Name = "labelFileName";
this.labelFileName.Size = new System.Drawing.Size(52, 13);
this.labelFileName.TabIndex = 33;
this.labelFileName.Text = "File name";
//
// linkLabelHelp
//
this.linkLabelHelp.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.linkLabelHelp.AutoSize = true;
this.linkLabelHelp.Location = new System.Drawing.Point(819, 463);
this.linkLabelHelp.Name = "linkLabelHelp";
this.linkLabelHelp.Size = new System.Drawing.Size(29, 13);
this.linkLabelHelp.TabIndex = 46;
this.linkLabelHelp.TabStop = true;
this.linkLabelHelp.Text = "Help";
this.linkLabelHelp.LinkClicked += new System.Windows.Forms.LinkLabelLinkClickedEventHandler(this.linkLabelHelp_LinkClicked);
//
// textBoxLog
//
this.textBoxLog.Location = new System.Drawing.Point(12, 13);
this.textBoxLog.Multiline = true;
this.textBoxLog.Name = "textBoxLog";
this.textBoxLog.Size = new System.Drawing.Size(188, 26);
this.textBoxLog.TabIndex = 31;
//
// labelInfo
//
this.labelInfo.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.labelInfo.AutoSize = true;
this.labelInfo.Location = new System.Drawing.Point(12, 463);
this.labelInfo.Name = "labelInfo";
this.labelInfo.Size = new System.Drawing.Size(25, 13);
this.labelInfo.TabIndex = 46;
this.labelInfo.Text = "Info";
//
// labelPass // labelPass
// //
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(589, 422); this.labelPass.Location = new System.Drawing.Point(589, 499);
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;
this.labelPass.Text = "Pass one"; this.labelPass.Text = "Pass one";
// //
// comboBoxAudioBitRate // checkBoxRightToLeft
// //
this.comboBoxAudioBitRate.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.checkBoxRightToLeft.AutoSize = true;
this.comboBoxAudioBitRate.FormattingEnabled = true; this.checkBoxRightToLeft.Location = new System.Drawing.Point(120, 90);
this.comboBoxAudioBitRate.Items.AddRange(new object[] { this.checkBoxRightToLeft.Name = "checkBoxRightToLeft";
"64k", this.checkBoxRightToLeft.Size = new System.Drawing.Size(80, 17);
"128k", this.checkBoxRightToLeft.TabIndex = 59;
"160k", this.checkBoxRightToLeft.Text = "Right to left";
"196k", this.checkBoxRightToLeft.UseVisualStyleBackColor = true;
"320k"});
this.comboBoxAudioBitRate.Location = new System.Drawing.Point(97, 110);
this.comboBoxAudioBitRate.Name = "comboBoxAudioBitRate";
this.comboBoxAudioBitRate.Size = new System.Drawing.Size(121, 21);
this.comboBoxAudioBitRate.TabIndex = 53;
//
// labelAudioBitRate
//
this.labelAudioBitRate.AutoSize = true;
this.labelAudioBitRate.Location = new System.Drawing.Point(20, 112);
this.labelAudioBitRate.Name = "labelAudioBitRate";
this.labelAudioBitRate.Size = new System.Drawing.Size(40, 13);
this.labelAudioBitRate.TabIndex = 52;
this.labelAudioBitRate.Text = "Bit rate";
//
// groupBoxAudio
//
this.groupBoxAudio.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.groupBoxAudio.Controls.Add(this.labelAudioEnc);
this.groupBoxAudio.Controls.Add(this.comboBoxAudioBitRate);
this.groupBoxAudio.Controls.Add(this.comboBoxAudioEnc);
this.groupBoxAudio.Controls.Add(this.labelAudioBitRate);
this.groupBoxAudio.Controls.Add(this.checkBoxMakeStereo);
this.groupBoxAudio.Controls.Add(this.labelAudioSampleRate);
this.groupBoxAudio.Controls.Add(this.comboBoxAudioSampleRate);
this.groupBoxAudio.Location = new System.Drawing.Point(376, 64);
this.groupBoxAudio.Name = "groupBoxAudio";
this.groupBoxAudio.Size = new System.Drawing.Size(445, 197);
this.groupBoxAudio.TabIndex = 54;
this.groupBoxAudio.TabStop = false;
this.groupBoxAudio.Text = "Audio";
//
// groupBoxVideo
//
this.groupBoxVideo.Controls.Add(this.labelResolution);
this.groupBoxVideo.Controls.Add(this.numericUpDownWidth);
this.groupBoxVideo.Controls.Add(this.numericUpDownHeight);
this.groupBoxVideo.Controls.Add(this.labelX);
this.groupBoxVideo.Controls.Add(this.labelPreset);
this.groupBoxVideo.Controls.Add(this.comboBoxTune);
this.groupBoxVideo.Controls.Add(this.comboBoxPreset);
this.groupBoxVideo.Controls.Add(this.labelTune);
this.groupBoxVideo.Controls.Add(this.labelCRF);
this.groupBoxVideo.Controls.Add(this.comboBoxVideoEncoding);
this.groupBoxVideo.Controls.Add(this.comboBoxCrf);
this.groupBoxVideo.Controls.Add(this.labelVideoEncoding);
this.groupBoxVideo.Location = new System.Drawing.Point(6, 64);
this.groupBoxVideo.Name = "groupBoxVideo";
this.groupBoxVideo.Size = new System.Drawing.Size(364, 197);
this.groupBoxVideo.TabIndex = 55;
this.groupBoxVideo.TabStop = false;
this.groupBoxVideo.Text = "Video";
// //
// 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(860, 473); this.ClientSize = new System.Drawing.Size(860, 550);
this.Controls.Add(this.labelPass); this.Controls.Add(this.labelPass);
this.Controls.Add(this.labelInfo); this.Controls.Add(this.labelInfo);
this.Controls.Add(this.groupBoxSettings); this.Controls.Add(this.groupBoxSettings);
@ -605,19 +654,18 @@ namespace Nikse.SubtitleEdit.Forms
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
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.Load += new System.EventHandler(this.GenerateVideoWithHardSubs_Load);
this.Shown += new System.EventHandler(this.GenerateVideoWithHardSubs_Shown); this.Shown += new System.EventHandler(this.GenerateVideoWithHardSubs_Shown);
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.GenerateVideoWithHardSubs_KeyDown); this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.GenerateVideoWithHardSubs_KeyDown);
((System.ComponentModel.ISupportInitialize)(this.numericUpDownFontSize)).EndInit(); ((System.ComponentModel.ISupportInitialize)(this.numericUpDownFontSize)).EndInit();
this.groupBoxSettings.ResumeLayout(false); this.groupBoxSettings.ResumeLayout(false);
this.groupBoxSettings.PerformLayout(); this.groupBoxSettings.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownHeight)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWidth)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownTargetFileSize)).EndInit();
this.groupBoxAudio.ResumeLayout(false);
this.groupBoxAudio.PerformLayout();
this.groupBoxVideo.ResumeLayout(false); this.groupBoxVideo.ResumeLayout(false);
this.groupBoxVideo.PerformLayout(); this.groupBoxVideo.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownWidth)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownHeight)).EndInit();
this.groupBoxAudio.ResumeLayout(false);
this.groupBoxAudio.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDownTargetFileSize)).EndInit();
this.ResumeLayout(false); this.ResumeLayout(false);
this.PerformLayout(); this.PerformLayout();
@ -663,5 +711,9 @@ namespace Nikse.SubtitleEdit.Forms
private System.Windows.Forms.Label labelAudioBitRate; private System.Windows.Forms.Label labelAudioBitRate;
private System.Windows.Forms.GroupBox groupBoxAudio; private System.Windows.Forms.GroupBox groupBoxAudio;
private System.Windows.Forms.GroupBox groupBoxVideo; private System.Windows.Forms.GroupBox groupBoxVideo;
private System.Windows.Forms.Button buttonPreview;
private System.Windows.Forms.ComboBox comboBoxSubtitleFont;
private System.Windows.Forms.Label labelSubtitleFont;
private System.Windows.Forms.CheckBox checkBoxRightToLeft;
} }
} }

View File

@ -3,8 +3,10 @@ using Nikse.SubtitleEdit.Core.SubtitleFormats;
using Nikse.SubtitleEdit.Logic; using Nikse.SubtitleEdit.Logic;
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Windows.Forms; using System.Windows.Forms;
@ -37,6 +39,7 @@ namespace Nikse.SubtitleEdit.Forms
buttonOK.Text = LanguageSettings.Current.Watermark.Generate; buttonOK.Text = LanguageSettings.Current.Watermark.Generate;
labelPleaseWait.Text = LanguageSettings.Current.General.PleaseWait; labelPleaseWait.Text = LanguageSettings.Current.General.PleaseWait;
labelFontSize.Text = LanguageSettings.Current.ExportPngXml.FontSize; labelFontSize.Text = LanguageSettings.Current.ExportPngXml.FontSize;
labelSubtitleFont.Text = LanguageSettings.Current.ExportPngXml.FontFamily;
buttonCancel.Text = LanguageSettings.Current.General.Cancel; buttonCancel.Text = LanguageSettings.Current.General.Cancel;
labelAudioEnc.Text = LanguageSettings.Current.GenerateVideoWithBurnedInSubs.Encoding; labelAudioEnc.Text = LanguageSettings.Current.GenerateVideoWithBurnedInSubs.Encoding;
labelVideoEncoding.Text = LanguageSettings.Current.GenerateVideoWithBurnedInSubs.Encoding; labelVideoEncoding.Text = LanguageSettings.Current.GenerateVideoWithBurnedInSubs.Encoding;
@ -46,6 +49,7 @@ namespace Nikse.SubtitleEdit.Forms
labelCRF.Text = LanguageSettings.Current.GenerateVideoWithBurnedInSubs.Crf; labelCRF.Text = LanguageSettings.Current.GenerateVideoWithBurnedInSubs.Crf;
labelPreset.Text = LanguageSettings.Current.GenerateVideoWithBurnedInSubs.Preset; labelPreset.Text = LanguageSettings.Current.GenerateVideoWithBurnedInSubs.Preset;
labelTune.Text = LanguageSettings.Current.GenerateVideoWithBurnedInSubs.TuneFor; labelTune.Text = LanguageSettings.Current.GenerateVideoWithBurnedInSubs.TuneFor;
buttonPreview.Text = LanguageSettings.Current.General.Preview;
progressBar1.Visible = false; progressBar1.Visible = false;
labelPleaseWait.Visible = false; labelPleaseWait.Visible = false;
labelProgress.Text = string.Empty; labelProgress.Text = string.Empty;
@ -85,21 +89,46 @@ namespace Nikse.SubtitleEdit.Forms
{ {
numericUpDownFontSize.Value = fontSize.Value; numericUpDownFontSize.Value = fontSize.Value;
} }
var left = Math.Max(labelResolution.Left + labelResolution.Width, labelFontSize.Left + labelFontSize.Width) + 5;
numericUpDownFontSize.Left = left;
numericUpDownWidth.Left = left;
labelX.Left = numericUpDownWidth.Left + numericUpDownWidth.Width + 3;
numericUpDownHeight.Left = labelX.Left + labelX.Width + 3;
labelInfo.Text = LanguageSettings.Current.GenerateVideoWithBurnedInSubs.InfoAssaOff;
} }
else else
{ {
numericUpDownFontSize.Visible = false; numericUpDownFontSize.Visible = false;
buttonPreview.Visible = false;
labelFontSize.Visible = false; labelFontSize.Visible = false;
labelInfo.Text = LanguageSettings.Current.GenerateVideoWithBurnedInSubs.InfoAssaOn; labelInfo.Text = LanguageSettings.Current.GenerateVideoWithBurnedInSubs.InfoAssaOn;
} }
var left = Math.Max(Math.Max(labelResolution.Left + labelResolution.Width, labelFontSize.Left + labelFontSize.Width), labelSubtitleFont.Left + labelSubtitleFont.Width) + 5;
numericUpDownFontSize.Left = left;
comboBoxSubtitleFont.Left = left;
numericUpDownWidth.Left = left;
labelX.Left = numericUpDownWidth.Left + numericUpDownWidth.Width + 3;
numericUpDownHeight.Left = labelX.Left + labelX.Width + 3;
labelInfo.Text = LanguageSettings.Current.GenerateVideoWithBurnedInSubs.InfoAssaOff;
checkBoxRightToLeft.Left = left;
var initialFont = Configuration.Settings.Tools.ExportBluRayFontName;
if (string.IsNullOrEmpty(initialFont))
{
initialFont = UiUtil.GetDefaultFont().Name;
}
foreach (var x in FontFamily.Families)
{
if (x.IsStyleAvailable(FontStyle.Regular) || x.IsStyleAvailable(FontStyle.Bold))
{
comboBoxSubtitleFont.Items.Add(x.Name);
if (x.Name.Equals(initialFont, StringComparison.OrdinalIgnoreCase))
{
comboBoxSubtitleFont.SelectedIndex = comboBoxSubtitleFont.Items.Count - 1;
}
}
}
if (comboBoxSubtitleFont.SelectedIndex < 0 && comboBoxSubtitleFont.Items.Count > 0)
{
comboBoxSubtitleFont.SelectedIndex = 0;
}
checkBoxRightToLeft.Checked = Configuration.Settings.General.RightToLeftMode && LanguageAutoDetect.CouldBeRightToLeftLanguage(_assaSubtitle);
textBoxLog.Visible = false; textBoxLog.Visible = false;
} }
@ -119,7 +148,7 @@ namespace Nikse.SubtitleEdit.Forms
return; return;
} }
_log.AppendLine(outLine.Data); _log?.AppendLine(outLine.Data);
var match = FrameFinderRegex.Match(outLine.Data); var match = FrameFinderRegex.Match(outLine.Data);
if (!match.Success) if (!match.Success)
@ -141,6 +170,7 @@ namespace Nikse.SubtitleEdit.Forms
private void buttonOK_Click(object sender, EventArgs e) private void buttonOK_Click(object sender, EventArgs e)
{ {
_log = new StringBuilder();
buttonOK.Enabled = false; buttonOK.Enabled = false;
numericUpDownFontSize.Enabled = false; numericUpDownFontSize.Enabled = false;
using (var saveDialog = new SaveFileDialog { FileName = string.Empty, Filter = "MP4|*.mp4|Matroska|*.mkv|WebM|*.webm" }) using (var saveDialog = new SaveFileDialog { FileName = string.Empty, Filter = "MP4|*.mp4|Matroska|*.mkv|WebM|*.webm" })
@ -170,26 +200,18 @@ namespace Nikse.SubtitleEdit.Forms
} }
labelFileName.Text = string.Format(LanguageSettings.Current.GenerateVideoWithBurnedInSubs.TargetFileName, VideoFileName); labelFileName.Text = string.Format(LanguageSettings.Current.GenerateVideoWithBurnedInSubs.TargetFileName, VideoFileName);
if (numericUpDownFontSize.Visible) if (numericUpDownFontSize.Visible) // not ASSA format
{ {
var fontSize = (int)numericUpDownFontSize.Value; var fontSize = (int)numericUpDownFontSize.Value;
var style = AdvancedSubStationAlpha.GetSsaStyle("Default", _assaSubtitle.Header); var style = AdvancedSubStationAlpha.GetSsaStyle("Default", _assaSubtitle.Header);
style.FontSize = fontSize; style.FontSize = fontSize;
var styleLine = style.ToRawAss(); var styleLine = style.ToRawAss();
_assaSubtitle.Header = AdvancedSubStationAlpha.AddTagToHeader("Style", styleLine, "[V4+ Styles]", _assaSubtitle.Header); _assaSubtitle.Header = AdvancedSubStationAlpha.AddTagToHeader("Style", styleLine, "[V4+ Styles]", _assaSubtitle.Header);
_assaSubtitle.Header = AdvancedSubStationAlpha.AddTagToHeader("PlayResX", "PlayResX: " + ((int)numericUpDownWidth.Value).ToString(CultureInfo.InvariantCulture), "[Script Info]", _assaSubtitle.Header);
_assaSubtitle.Header = AdvancedSubStationAlpha.AddTagToHeader("PlayResY", "PlayResY: " + ((int)numericUpDownHeight.Value).ToString(CultureInfo.InvariantCulture), "[Script Info]", _assaSubtitle.Header);
} }
if (Configuration.Settings.General.RightToLeftMode && LanguageAutoDetect.CouldBeRightToLeftLanguage(_assaSubtitle)) FixRightToLeft(_assaSubtitle);
{
for (var index = 0; index < _assaSubtitle.Paragraphs.Count; index++)
{
var paragraph = _assaSubtitle.Paragraphs[index];
if (LanguageAutoDetect.ContainsRightToLeftLetter(paragraph.Text))
{
paragraph.Text = Utilities.FixRtlViaUnicodeChars(paragraph.Text);
}
}
}
var format = new AdvancedSubStationAlpha(); var format = new AdvancedSubStationAlpha();
var assaTempFileName = Path.Combine(Path.GetTempPath(), Guid.NewGuid() + ".ass"); var assaTempFileName = Path.Combine(Path.GetTempPath(), Guid.NewGuid() + ".ass");
@ -227,6 +249,21 @@ namespace Nikse.SubtitleEdit.Forms
DialogResult = _abort ? DialogResult.Cancel : DialogResult.OK; DialogResult = _abort ? DialogResult.Cancel : DialogResult.OK;
} }
private void FixRightToLeft(Subtitle subtitle)
{
if (checkBoxRightToLeft.Checked)
{
for (var index = 0; index < subtitle.Paragraphs.Count; index++)
{
var paragraph = subtitle.Paragraphs[index];
if (LanguageAutoDetect.ContainsRightToLeftLetter(paragraph.Text))
{
paragraph.Text = Utilities.FixRtlViaUnicodeChars(paragraph.Text);
}
}
}
}
private void RunTwoPassEncoding(string assaTempFileName) private void RunTwoPassEncoding(string assaTempFileName)
{ {
labelPass.Text = string.Format(LanguageSettings.Current.GenerateVideoWithBurnedInSubs.PassX, "1"); labelPass.Text = string.Format(LanguageSettings.Current.GenerateVideoWithBurnedInSubs.PassX, "1");
@ -252,7 +289,7 @@ namespace Nikse.SubtitleEdit.Forms
return; return;
} }
var process = GetFfmpegProcess(assaTempFileName, 1, videoBitRate); var process = GetFfmpegProcess(_inputVideoFileName, VideoFileName, assaTempFileName, 1, videoBitRate);
_log.AppendLine("ffmpeg arguments pass 1: " + process.StartInfo.Arguments); _log.AppendLine("ffmpeg arguments pass 1: " + process.StartInfo.Arguments);
process.Start(); process.Start();
process.BeginOutputReadLine(); process.BeginOutputReadLine();
@ -279,7 +316,7 @@ namespace Nikse.SubtitleEdit.Forms
labelPass.Text = string.Format(LanguageSettings.Current.GenerateVideoWithBurnedInSubs.PassX, "2"); labelPass.Text = string.Format(LanguageSettings.Current.GenerateVideoWithBurnedInSubs.PassX, "2");
process = GetFfmpegProcess(assaTempFileName, 2, videoBitRate); process = GetFfmpegProcess(_inputVideoFileName, VideoFileName, assaTempFileName, 2, videoBitRate);
_log.AppendLine("ffmpeg arguments pass 2: " + process.StartInfo.Arguments); _log.AppendLine("ffmpeg arguments pass 2: " + process.StartInfo.Arguments);
process.Start(); process.Start();
process.BeginOutputReadLine(); process.BeginOutputReadLine();
@ -349,7 +386,7 @@ namespace Nikse.SubtitleEdit.Forms
private void RunOnePassEncoding(string assaTempFileName) private void RunOnePassEncoding(string assaTempFileName)
{ {
var process = GetFfmpegProcess(assaTempFileName, null); var process = GetFfmpegProcess(_inputVideoFileName, VideoFileName, assaTempFileName, null);
_log.AppendLine("ffmpeg arguments: " + process.StartInfo.Arguments); _log.AppendLine("ffmpeg arguments: " + process.StartInfo.Arguments);
process.Start(); process.Start();
process.BeginOutputReadLine(); process.BeginOutputReadLine();
@ -374,7 +411,7 @@ namespace Nikse.SubtitleEdit.Forms
} }
} }
private Process GetFfmpegProcess(string assaTempFileName, int? passNumber = null, string twoPassBitRate = null) private Process GetFfmpegProcess(string inputVideoFileName, string outputVideoFileName, string assaTempFileName, int? passNumber = null, string twoPassBitRate = null)
{ {
var pass = string.Empty; var pass = string.Empty;
if (passNumber.HasValue) if (passNumber.HasValue)
@ -383,9 +420,9 @@ namespace Nikse.SubtitleEdit.Forms
} }
return VideoPreviewGenerator.GenerateHardcodedVideoFile( return VideoPreviewGenerator.GenerateHardcodedVideoFile(
_inputVideoFileName, inputVideoFileName,
assaTempFileName, assaTempFileName,
VideoFileName, outputVideoFileName,
(int)numericUpDownWidth.Value, (int)numericUpDownWidth.Value,
(int)numericUpDownHeight.Value, (int)numericUpDownHeight.Value,
comboBoxVideoEncoding.Text, comboBoxVideoEncoding.Text,
@ -479,7 +516,7 @@ namespace Nikse.SubtitleEdit.Forms
log.AppendLine("Video info total frames: " + _videoInfo.TotalFrames); log.AppendLine("Video info total frames: " + _videoInfo.TotalFrames);
log.AppendLine("Video info total seconds: " + _videoInfo.TotalSeconds); log.AppendLine("Video info total seconds: " + _videoInfo.TotalSeconds);
log.AppendLine(); log.AppendLine();
log.AppendLine("ffmpeg " + GetFfmpegProcess("input.ass", null).StartInfo.Arguments); log.AppendLine("ffmpeg " + GetFfmpegProcess(_inputVideoFileName, VideoFileName, "input.ass", null).StartInfo.Arguments);
textBoxLog.Text = log.ToString(); textBoxLog.Text = log.ToString();
} }
else else
@ -573,11 +610,6 @@ namespace Nikse.SubtitleEdit.Forms
comboBoxCrf.EndUpdate(); comboBoxCrf.EndUpdate();
} }
private void GenerateVideoWithHardSubs_Load(object sender, EventArgs e)
{
}
private void GenerateVideoWithHardSubs_Shown(object sender, EventArgs e) private void GenerateVideoWithHardSubs_Shown(object sender, EventArgs e)
{ {
var targetFileSizeMb = (int)Math.Round(new FileInfo(_inputVideoFileName).Length / 1024.0 / 1024); var targetFileSizeMb = (int)Math.Round(new FileInfo(_inputVideoFileName).Length / 1024.0 / 1024);
@ -598,5 +630,102 @@ namespace Nikse.SubtitleEdit.Forms
comboBoxAudioBitRate.Enabled = false; comboBoxAudioBitRate.Enabled = false;
} }
} }
private void buttonPreview_Click(object sender, EventArgs e)
{
try
{
buttonPreview.Enabled = false;
Cursor = Cursors.WaitCursor;
// generate blank video
var tempVideoFileName = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".mkv");
var process = VideoPreviewGenerator.GenerateVideoFile(
tempVideoFileName,
10,
(int)numericUpDownWidth.Value,
(int)numericUpDownHeight.Value,
Color.Black,
true,
25);
process.Start();
while (!process.HasExited)
{
System.Threading.Thread.Sleep(100);
Application.DoEvents();
}
// make temp assa file with font
var assaTempFileName = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".ass");
var sub = new Subtitle();
sub.Paragraphs.Add(new Paragraph(GetPreviewText(), 0, 10_000));
sub.Header = AdvancedSubStationAlpha.DefaultHeader;
var style = AdvancedSubStationAlpha.GetSsaStyle("Default", sub.Header);
style.FontSize = (float)numericUpDownFontSize.Value;
style.FontName = comboBoxSubtitleFont.Text;
sub.Header = AdvancedSubStationAlpha.GetHeaderAndStylesFromAdvancedSubStationAlpha(sub.Header, new System.Collections.Generic.List<SsaStyle>() { style });
sub.Header = AdvancedSubStationAlpha.AddTagToHeader("PlayResX", "PlayResX: " + ((int)numericUpDownWidth.Value).ToString(CultureInfo.InvariantCulture), "[Script Info]", sub.Header);
sub.Header = AdvancedSubStationAlpha.AddTagToHeader("PlayResY", "PlayResY: " + ((int)numericUpDownHeight.Value).ToString(CultureInfo.InvariantCulture), "[Script Info]", sub.Header);
FixRightToLeft(sub);
File.WriteAllText(assaTempFileName, new AdvancedSubStationAlpha().ToText(sub, string.Empty));
// hardcode subtitle
var outputVideoFileName = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".mp4");
process = GetFfmpegProcess(tempVideoFileName, outputVideoFileName, assaTempFileName);
process.Start();
process.BeginOutputReadLine();
process.BeginErrorReadLine();
while (!process.HasExited)
{
System.Threading.Thread.Sleep(100);
Application.DoEvents();
}
Cursor = Cursors.Default;
var bmpFileName = VideoPreviewGenerator.GetScreenShot(outputVideoFileName, "00:00:01");
using (var bmp = new Bitmap(bmpFileName))
{
using (var form = new ExportPngXmlPreview(bmp))
{
form.AllowNext = false;
form.AllowPrevious = false;
form.ShowDialog(this);
}
}
try
{
File.Delete(tempVideoFileName);
File.Delete(assaTempFileName);
File.Delete(outputVideoFileName);
File.Delete(bmpFileName);
}
catch
{
// ignore
}
}
finally
{
Cursor = Cursors.Default;
buttonPreview.Enabled = true;
}
}
private string GetPreviewText()
{
string text = string.Empty;
_assaSubtitle.Renumber();
if (_assaSubtitle.Paragraphs.Count > 2)
{
var longest = _assaSubtitle.Paragraphs.Where(p => p.Number > 1).OrderByDescending(p => p.Text.Length).FirstOrDefault();
if (longest != null)
{
return longest.Text;
}
}
return "Example text";
}
} }
} }

View File

@ -20359,7 +20359,7 @@ namespace Nikse.SubtitleEdit.Forms
var oldPlayResY = AdvancedSubStationAlpha.GetTagValueFromHeader("PlayResY", "[Script Info]", _subtitle.Header); var oldPlayResY = AdvancedSubStationAlpha.GetTagValueFromHeader("PlayResY", "[Script Info]", _subtitle.Header);
if (oldPlayResX == _videoInfo.Width.ToString(CultureInfo.InvariantCulture) && if (oldPlayResX == _videoInfo.Width.ToString(CultureInfo.InvariantCulture) &&
oldPlayResY == _videoInfo.Height.ToString(CultureInfo.InvariantCulture)) oldPlayResY == _videoInfo.Height.ToString(CultureInfo.InvariantCulture))
{ {
// all good - correct resolution // all good - correct resolution
} }

View File

@ -126,17 +126,11 @@ namespace Nikse.SubtitleEdit.Logic
} }
} }
var ffmpegLocation = Configuration.Settings.General.FFmpegLocation;
if (!Configuration.IsRunningOnWindows && (string.IsNullOrEmpty(ffmpegLocation) || !File.Exists(ffmpegLocation)))
{
ffmpegLocation = "ffmpeg";
}
var processMakeVideo = new Process var processMakeVideo = new Process
{ {
StartInfo = StartInfo =
{ {
FileName = ffmpegLocation, FileName = GetFfmpegLocation(),
Arguments = $"-i \"{inputVideoFileName}\" -vf \"ass={Path.GetFileName(assaSubtitleFileName)}\",yadif,format=yuv420p -g 30 -bf 2 -s {width}x{height} {videoEncodingSettings} {passSettings} {presetSettings} {crfSettings} {audioSettings}{tuneParameter} -use_editlist 0 -movflags +faststart {outputVideoFileName}", Arguments = $"-i \"{inputVideoFileName}\" -vf \"ass={Path.GetFileName(assaSubtitleFileName)}\",yadif,format=yuv420p -g 30 -bf 2 -s {width}x{height} {videoEncodingSettings} {passSettings} {presetSettings} {crfSettings} {audioSettings}{tuneParameter} -use_editlist 0 -movflags +faststart {outputVideoFileName}",
UseShellExecute = false, UseShellExecute = false,
CreateNoWindow = true, CreateNoWindow = true,
@ -156,17 +150,11 @@ namespace Nikse.SubtitleEdit.Logic
private static Process GetFFmpegProcess(string imageFileName, string outputFileName, int videoWidth, int videoHeight, int seconds, decimal frameRate) private static Process GetFFmpegProcess(string imageFileName, string outputFileName, int videoWidth, int videoHeight, int seconds, decimal frameRate)
{ {
var ffmpegLocation = Configuration.Settings.General.FFmpegLocation;
if (!Configuration.IsRunningOnWindows && (string.IsNullOrEmpty(ffmpegLocation) || !File.Exists(ffmpegLocation)))
{
ffmpegLocation = "ffmpeg";
}
return new Process return new Process
{ {
StartInfo = StartInfo =
{ {
FileName = ffmpegLocation, FileName = GetFfmpegLocation(),
Arguments = $"-t {seconds} -loop 1 -r {frameRate.ToString(CultureInfo.InvariantCulture)} -i \"{imageFileName}\" -c:v libx264 -tune stillimage -shortest -s {videoWidth}x{videoHeight} \"{outputFileName}\"", Arguments = $"-t {seconds} -loop 1 -r {frameRate.ToString(CultureInfo.InvariantCulture)} -i \"{imageFileName}\" -c:v libx264 -tune stillimage -shortest -s {videoWidth}x{videoHeight} \"{outputFileName}\"",
UseShellExecute = false, UseShellExecute = false,
CreateNoWindow = true CreateNoWindow = true
@ -176,24 +164,48 @@ namespace Nikse.SubtitleEdit.Logic
private static Process GetFFmpegProcess(Color color, string outputFileName, int videoWidth, int videoHeight, int seconds, decimal frameRate) private static Process GetFFmpegProcess(Color color, string outputFileName, int videoWidth, int videoHeight, int seconds, decimal frameRate)
{ {
var ffmpegLocation = Configuration.Settings.General.FFmpegLocation;
if (!Configuration.IsRunningOnWindows && (string.IsNullOrEmpty(ffmpegLocation) || !File.Exists(ffmpegLocation)))
{
ffmpegLocation = "ffmpeg";
}
var htmlColor = $"#{(color.R.ToString("X2") + color.G.ToString("X2") + color.B.ToString("X2")).ToUpperInvariant()}"; var htmlColor = $"#{(color.R.ToString("X2") + color.G.ToString("X2") + color.B.ToString("X2")).ToUpperInvariant()}";
return new Process return new Process
{ {
StartInfo = StartInfo =
{ {
FileName = ffmpegLocation, FileName = GetFfmpegLocation(),
Arguments = $"-t {seconds} -f lavfi -i color=c={htmlColor}:r={frameRate.ToString(CultureInfo.InvariantCulture)}:s={videoWidth}x{videoHeight} -c:v libx264 -tune stillimage -shortest -s {videoWidth}x{videoHeight} \"{outputFileName}\"", Arguments = $"-t {seconds} -f lavfi -i color=c={htmlColor}:r={frameRate.ToString(CultureInfo.InvariantCulture)}:s={videoWidth}x{videoHeight} -c:v libx264 -tune stillimage -shortest -s {videoWidth}x{videoHeight} \"{outputFileName}\"",
UseShellExecute = false, UseShellExecute = false,
CreateNoWindow = true CreateNoWindow = true
} }
}; };
} }
public static string GetScreenShot(string inputFileName, string timeCode)
{
var outputFileName = Path.Combine(Path.GetTempPath(), $"{Guid.NewGuid()}.png");
var process = new Process
{
StartInfo =
{
FileName = GetFfmpegLocation(),
Arguments = $"-ss {timeCode} -i \"{inputFileName}\" -frames:v 1 -q:v 2 \"{outputFileName}\"",
UseShellExecute = false,
CreateNoWindow = true
}
};
process.Start();
process.WaitForExit();
return outputFileName;
}
private static string GetFfmpegLocation()
{
var ffmpegLocation = Configuration.Settings.General.FFmpegLocation;
if (!Configuration.IsRunningOnWindows && (string.IsNullOrEmpty(ffmpegLocation) || !File.Exists(ffmpegLocation)))
{
ffmpegLocation = "ffmpeg";
}
return ffmpegLocation;
}
} }
} }