mirror of
https://github.com/SubtitleEdit/subtitleedit.git
synced 2024-10-27 22:42:38 +01:00
Show bit rate for two pass enc - thx Marko :)
This commit is contained in:
parent
7e4f1397bb
commit
ddb47c01db
@ -839,6 +839,7 @@ Note: Do check free disk space.</WaveFileMalformed>
|
||||
<PassX>Pass {0}</PassX>
|
||||
<Encoding>Encoding</Encoding>
|
||||
<BitRate>Bit rate</BitRate>
|
||||
<TotalBitRateX>Total bit rate: {0}</TotalBitRateX>
|
||||
<SampleRate>Sample rate</SampleRate>
|
||||
<Audio>Audio</Audio>
|
||||
<Stereo>Stereo</Stereo>
|
||||
|
22
src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs
generated
22
src/ui/Forms/GenerateVideoWithHardSubs.Designer.cs
generated
@ -91,6 +91,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.nTSC720x480ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.x352ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.x272ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.labelVideoBitrate = new System.Windows.Forms.Label();
|
||||
((System.ComponentModel.ISupportInitialize)(this.numericUpDownFontSize)).BeginInit();
|
||||
this.groupBoxSettings.SuspendLayout();
|
||||
this.groupBoxVideo.SuspendLayout();
|
||||
@ -197,6 +198,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.groupBoxSettings.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.groupBoxSettings.Controls.Add(this.labelVideoBitrate);
|
||||
this.groupBoxSettings.Controls.Add(this.checkBoxBox);
|
||||
this.groupBoxSettings.Controls.Add(this.labelPreviewPleaseWait);
|
||||
this.groupBoxSettings.Controls.Add(this.checkBoxAlignRight);
|
||||
@ -306,7 +308,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.groupBoxVideo.Controls.Add(this.labelVideoEncoding);
|
||||
this.groupBoxVideo.Location = new System.Drawing.Point(6, 165);
|
||||
this.groupBoxVideo.Name = "groupBoxVideo";
|
||||
this.groupBoxVideo.Size = new System.Drawing.Size(364, 197);
|
||||
this.groupBoxVideo.Size = new System.Drawing.Size(388, 197);
|
||||
this.groupBoxVideo.TabIndex = 8;
|
||||
this.groupBoxVideo.TabStop = false;
|
||||
this.groupBoxVideo.Text = "Video";
|
||||
@ -317,7 +319,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.buttonVideoChooseStandardRes.Location = new System.Drawing.Point(263, 24);
|
||||
this.buttonVideoChooseStandardRes.Name = "buttonVideoChooseStandardRes";
|
||||
this.buttonVideoChooseStandardRes.Size = new System.Drawing.Size(27, 23);
|
||||
this.buttonVideoChooseStandardRes.Size = new System.Drawing.Size(51, 23);
|
||||
this.buttonVideoChooseStandardRes.TabIndex = 14;
|
||||
this.buttonVideoChooseStandardRes.Text = "...";
|
||||
this.buttonVideoChooseStandardRes.UseVisualStyleBackColor = true;
|
||||
@ -518,9 +520,9 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
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, 165);
|
||||
this.groupBoxAudio.Location = new System.Drawing.Point(400, 165);
|
||||
this.groupBoxAudio.Name = "groupBoxAudio";
|
||||
this.groupBoxAudio.Size = new System.Drawing.Size(445, 277);
|
||||
this.groupBoxAudio.Size = new System.Drawing.Size(421, 277);
|
||||
this.groupBoxAudio.TabIndex = 10;
|
||||
this.groupBoxAudio.TabStop = false;
|
||||
this.groupBoxAudio.Text = "Audio";
|
||||
@ -548,6 +550,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.comboBoxAudioBitRate.Name = "comboBoxAudioBitRate";
|
||||
this.comboBoxAudioBitRate.Size = new System.Drawing.Size(121, 21);
|
||||
this.comboBoxAudioBitRate.TabIndex = 5;
|
||||
this.comboBoxAudioBitRate.SelectedValueChanged += new System.EventHandler(this.comboBoxAudioBitRate_SelectedValueChanged);
|
||||
//
|
||||
// comboBoxAudioEnc
|
||||
//
|
||||
@ -628,6 +631,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
0,
|
||||
0,
|
||||
0});
|
||||
this.numericUpDownTargetFileSize.ValueChanged += new System.EventHandler(this.numericUpDownTargetFileSize_ValueChanged);
|
||||
//
|
||||
// labelFileSize
|
||||
//
|
||||
@ -816,6 +820,15 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
this.x272ToolStripMenuItem.Text = "640x272";
|
||||
this.x272ToolStripMenuItem.Click += new System.EventHandler(this.ResolutionPickClick);
|
||||
//
|
||||
// labelVideoBitrate
|
||||
//
|
||||
this.labelVideoBitrate.AutoSize = true;
|
||||
this.labelVideoBitrate.Location = new System.Drawing.Point(193, 403);
|
||||
this.labelVideoBitrate.Name = "labelVideoBitrate";
|
||||
this.labelVideoBitrate.Size = new System.Drawing.Size(86, 13);
|
||||
this.labelVideoBitrate.TabIndex = 14;
|
||||
this.labelVideoBitrate.Text = "labelVideoBitrate";
|
||||
//
|
||||
// GenerateVideoWithHardSubs
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
@ -921,5 +934,6 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
private System.Windows.Forms.ToolStripMenuItem nTSC720x480ToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem x352ToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem x272ToolStripMenuItem;
|
||||
private System.Windows.Forms.Label labelVideoBitrate;
|
||||
}
|
||||
}
|
@ -92,6 +92,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
checkBoxAlignRight.Checked = Configuration.Settings.Tools.GenVideoNonAssaAlignRight;
|
||||
checkBoxRightToLeft.Checked = Configuration.Settings.Tools.GenVideoNonAssaAlignRight;
|
||||
|
||||
labelVideoBitrate.Text = string.Empty;
|
||||
|
||||
numericUpDownWidth.Value = _videoInfo.Width;
|
||||
numericUpDownHeight.Value = _videoInfo.Height;
|
||||
|
||||
@ -355,19 +357,7 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
{
|
||||
labelPass.Text = string.Format(LanguageSettings.Current.GenerateVideoWithBurnedInSubs.PassX, "1");
|
||||
|
||||
var audioMb = 0;
|
||||
if (comboBoxAudioEnc.Text == "copy")
|
||||
{
|
||||
audioMb = GetAudioFileSizeInMb();
|
||||
}
|
||||
|
||||
// (MiB * 8192 [converts MiB to kBit]) / video seconds = kBit/s total bitrate
|
||||
var bitRate = (int)Math.Round(((double)numericUpDownTargetFileSize.Value - audioMb) * 8192.0 / _videoInfo.TotalSeconds);
|
||||
if (comboBoxAudioEnc.Text != "copy" && !string.IsNullOrWhiteSpace(comboBoxAudioBitRate.Text))
|
||||
{
|
||||
var audioBitRate = int.Parse(comboBoxAudioBitRate.Text.RemoveChar('k').TrimEnd());
|
||||
bitRate -= audioBitRate;
|
||||
}
|
||||
var bitRate = GetVideoBitRate();
|
||||
var videoBitRate = bitRate.ToString(CultureInfo.InvariantCulture) + "k";
|
||||
|
||||
if (bitRate < 10)
|
||||
@ -938,6 +928,8 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
labelAudioBitRate.Enabled = false;
|
||||
comboBoxAudioBitRate.Enabled = false;
|
||||
}
|
||||
|
||||
numericUpDownTargetFileSize_ValueChanged(null, null);
|
||||
}
|
||||
|
||||
private void buttonPreview_Click(object sender, EventArgs e)
|
||||
@ -1108,5 +1100,53 @@ namespace Nikse.SubtitleEdit.Forms
|
||||
var coordinates = buttonVideoChooseStandardRes.PointToClient(Cursor.Position);
|
||||
contextMenuStripRes.Show(buttonVideoChooseStandardRes, coordinates);
|
||||
}
|
||||
|
||||
private int GetVideoBitRate()
|
||||
{
|
||||
var audioMb = 0;
|
||||
if (comboBoxAudioEnc.Text == "copy")
|
||||
{
|
||||
audioMb = GetAudioFileSizeInMb();
|
||||
}
|
||||
|
||||
// (MiB * 8192 [converts MiB to kBit]) / video seconds = kBit/s total bitrate
|
||||
var bitRate = (int)Math.Round(((double)numericUpDownTargetFileSize.Value - audioMb) * 8192.0 / _videoInfo.TotalSeconds);
|
||||
if (comboBoxAudioEnc.Text != "copy" && !string.IsNullOrWhiteSpace(comboBoxAudioBitRate.Text))
|
||||
{
|
||||
var audioBitRate = int.Parse(comboBoxAudioBitRate.Text.RemoveChar('k').TrimEnd());
|
||||
bitRate -= audioBitRate;
|
||||
}
|
||||
|
||||
return bitRate;
|
||||
}
|
||||
|
||||
private void numericUpDownTargetFileSize_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
labelVideoBitrate.Text = string.Empty;
|
||||
if (!checkBoxTargetFileSize.Checked)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
var videoBitRate = GetVideoBitRate();
|
||||
var separateAudio = comboBoxAudioEnc.Text != "copy" && !string.IsNullOrWhiteSpace(comboBoxAudioBitRate.Text);
|
||||
var audioBitRate = 0;
|
||||
if (separateAudio)
|
||||
{
|
||||
audioBitRate = int.Parse(comboBoxAudioBitRate.Text.RemoveChar('k').TrimEnd());
|
||||
}
|
||||
|
||||
labelVideoBitrate.Left = numericUpDownTargetFileSize.Right + 5;
|
||||
labelVideoBitrate.Text = string.Format(LanguageSettings.Current.GenerateVideoWithBurnedInSubs.TotalBitRateX, $"{(videoBitRate + audioBitRate):#,###,##0}k");
|
||||
if (separateAudio)
|
||||
{
|
||||
labelVideoBitrate.Text += $" ({videoBitRate:#,###,##0}k + {audioBitRate:#,###,##0}k)";
|
||||
}
|
||||
}
|
||||
|
||||
private void comboBoxAudioBitRate_SelectedValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
numericUpDownTargetFileSize_ValueChanged(null, null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1062,6 +1062,7 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
PassX = "Pass {0}",
|
||||
Encoding = "Encoding",
|
||||
BitRate = "Bit rate",
|
||||
TotalBitRateX = "Total bit rate: {0}",
|
||||
SampleRate = "Sample rate",
|
||||
Audio = "Audio",
|
||||
Stereo = "Stereo",
|
||||
|
@ -2230,6 +2230,9 @@ namespace Nikse.SubtitleEdit.Logic
|
||||
case "GenerateVideoWithBurnedInSubs/BitRate":
|
||||
language.GenerateVideoWithBurnedInSubs.BitRate = reader.Value;
|
||||
break;
|
||||
case "GenerateVideoWithBurnedInSubs/TotalBitRateX":
|
||||
language.GenerateVideoWithBurnedInSubs.TotalBitRateX = reader.Value;
|
||||
break;
|
||||
case "GenerateVideoWithBurnedInSubs/SampleRate":
|
||||
language.GenerateVideoWithBurnedInSubs.SampleRate = reader.Value;
|
||||
break;
|
||||
|
@ -922,6 +922,7 @@
|
||||
public string PassX { get; set; }
|
||||
public string Encoding { get; set; }
|
||||
public string BitRate { get; set; }
|
||||
public string TotalBitRateX { get; set; }
|
||||
public string SampleRate { get; set; }
|
||||
public string Audio { get; set; }
|
||||
public string Stereo { get; set; }
|
||||
|
Loading…
Reference in New Issue
Block a user