Remove legacy dedupe, fix mpdecimate parsing, delete partial outputs on cancel

This commit is contained in:
N00MKRAD
2025-03-05 22:57:13 +01:00
parent 2253ddae06
commit ac0a9398b5
7 changed files with 34 additions and 34 deletions

View File

@@ -107,6 +107,8 @@
this.browseInputFileBtn = new HTAlt.WinForms.HTButton(); this.browseInputFileBtn = new HTAlt.WinForms.HTButton();
this.browseInputBtn = new HTAlt.WinForms.HTButton(); this.browseInputBtn = new HTAlt.WinForms.HTButton();
this.quickSettingsTab = new System.Windows.Forms.TabPage(); this.quickSettingsTab = new System.Windows.Forms.TabPage();
this.vfrHandling = new System.Windows.Forms.ComboBox();
this.label5 = new System.Windows.Forms.Label();
this.label20 = new System.Windows.Forms.Label(); this.label20 = new System.Windows.Forms.Label();
this.maxFps = new System.Windows.Forms.ComboBox(); this.maxFps = new System.Windows.Forms.ComboBox();
this.label24 = new System.Windows.Forms.Label(); this.label24 = new System.Windows.Forms.Label();
@@ -141,8 +143,6 @@
this.cancelBtn = new System.Windows.Forms.Button(); this.cancelBtn = new System.Windows.Forms.Button();
this.menuStripQueue = new System.Windows.Forms.ContextMenuStrip(this.components); this.menuStripQueue = new System.Windows.Forms.ContextMenuStrip(this.components);
this.addCurrentConfigurationToQueueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.addCurrentConfigurationToQueueToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.label5 = new System.Windows.Forms.Label();
this.vfrHandling = new System.Windows.Forms.ComboBox();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox4)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox3)).BeginInit();
@@ -1200,6 +1200,29 @@
this.quickSettingsTab.Text = "Quick Settings"; this.quickSettingsTab.Text = "Quick Settings";
this.quickSettingsTab.Enter += new System.EventHandler(this.LoadQuickSettings); this.quickSettingsTab.Enter += new System.EventHandler(this.LoadQuickSettings);
// //
// vfrHandling
//
this.vfrHandling.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.vfrHandling.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.vfrHandling.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.vfrHandling.ForeColor = System.Drawing.Color.White;
this.vfrHandling.FormattingEnabled = true;
this.vfrHandling.Location = new System.Drawing.Point(280, 187);
this.vfrHandling.Name = "vfrHandling";
this.vfrHandling.Size = new System.Drawing.Size(249, 23);
this.vfrHandling.TabIndex = 92;
//
// label5
//
this.label5.AutoSize = true;
this.label5.ForeColor = System.Drawing.Color.White;
this.label5.Location = new System.Drawing.Point(6, 189);
this.label5.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(185, 15);
this.label5.TabIndex = 91;
this.label5.Text = "Detect Variable Frame Rate Videos";
//
// label20 // label20
// //
this.label20.AutoSize = true; this.label20.AutoSize = true;
@@ -1338,8 +1361,7 @@
this.dedupMode.FormattingEnabled = true; this.dedupMode.FormattingEnabled = true;
this.dedupMode.Items.AddRange(new object[] { this.dedupMode.Items.AddRange(new object[] {
"Disabled", "Disabled",
"1: After Extraction - Slow, Accurate", "Enabled (mpdecimate)"});
"2: During Extraction - Fast, Less Accurate"});
this.dedupMode.Location = new System.Drawing.Point(279, 67); this.dedupMode.Location = new System.Drawing.Point(279, 67);
this.dedupMode.Name = "dedupMode"; this.dedupMode.Name = "dedupMode";
this.dedupMode.Size = new System.Drawing.Size(250, 23); this.dedupMode.Size = new System.Drawing.Size(250, 23);
@@ -1671,29 +1693,6 @@
this.addCurrentConfigurationToQueueToolStripMenuItem.Text = "Add Current Configuration to Queue"; this.addCurrentConfigurationToQueueToolStripMenuItem.Text = "Add Current Configuration to Queue";
this.addCurrentConfigurationToQueueToolStripMenuItem.Click += new System.EventHandler(this.addCurrentConfigurationToQueueToolStripMenuItem_Click); this.addCurrentConfigurationToQueueToolStripMenuItem.Click += new System.EventHandler(this.addCurrentConfigurationToQueueToolStripMenuItem_Click);
// //
// label5
//
this.label5.AutoSize = true;
this.label5.ForeColor = System.Drawing.Color.White;
this.label5.Location = new System.Drawing.Point(6, 189);
this.label5.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(185, 15);
this.label5.TabIndex = 91;
this.label5.Text = "Detect Variable Frame Rate Videos";
//
// vfrHandling
//
this.vfrHandling.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.vfrHandling.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.vfrHandling.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.vfrHandling.ForeColor = System.Drawing.Color.White;
this.vfrHandling.FormattingEnabled = true;
this.vfrHandling.Location = new System.Drawing.Point(280, 187);
this.vfrHandling.Name = "vfrHandling";
this.vfrHandling.Size = new System.Drawing.Size(249, 23);
this.vfrHandling.TabIndex = 92;
//
// Form1 // Form1
// //
this.AllowDrop = true; this.AllowDrop = true;

View File

@@ -843,8 +843,7 @@ namespace Flowframes.Forms.Main
private void dedupMode_SelectedIndexChanged(object sender, EventArgs e) private void dedupMode_SelectedIndexChanged(object sender, EventArgs e)
{ {
dedupeSensLabel.Visible = dedupMode.SelectedIndex != 0; dedupeSensLabel.Visible = dedupMode.SelectedIndex != 0;
magickDedupePanel.Visible = dedupMode.SelectedIndex == 1; mpDedupePanel.Visible = dedupMode.SelectedIndex == 1;
mpDedupePanel.Visible = dedupMode.SelectedIndex == 2;
SaveQuickSettings(null, null); SaveQuickSettings(null, null);
} }

View File

@@ -932,8 +932,7 @@
this.dedupMode.FormattingEnabled = true; this.dedupMode.FormattingEnabled = true;
this.dedupMode.Items.AddRange(new object[] { this.dedupMode.Items.AddRange(new object[] {
"Disabled", "Disabled",
"1: After Extraction - Slow, Accurate", "Enabled (mpdecimate)"});
"2: During Extraction - Fast, Less Accurate"});
this.dedupMode.Location = new System.Drawing.Point(280, 7); this.dedupMode.Location = new System.Drawing.Point(280, 7);
this.dedupMode.Name = "dedupMode"; this.dedupMode.Name = "dedupMode";
this.dedupMode.Size = new System.Drawing.Size(250, 21); this.dedupMode.Size = new System.Drawing.Size(250, 21);

View File

@@ -291,8 +291,7 @@ namespace Flowframes.Forms
private void dedupMode_SelectedIndexChanged(object sender, EventArgs e) private void dedupMode_SelectedIndexChanged(object sender, EventArgs e)
{ {
dedupeSensLabel.Visible = dedupMode.SelectedIndex != 0; dedupeSensLabel.Visible = dedupMode.SelectedIndex != 0;
magickDedupePanel.Visible = dedupMode.SelectedIndex == 1; mpDedupePanel.Visible = dedupMode.SelectedIndex == 1;
mpDedupePanel.Visible = dedupMode.SelectedIndex == 2;
} }
private void clearModelCacheBtn_Click(object sender, EventArgs e) private void clearModelCacheBtn_Click(object sender, EventArgs e)

View File

@@ -70,7 +70,7 @@ namespace Flowframes.IO
public static void LoadComboxIndex(ComboBox comboBox) public static void LoadComboxIndex(ComboBox comboBox)
{ {
comboBox.SelectedIndex = Config.GetInt(comboBox.Name).Clamp(0, int.MaxValue); comboBox.SelectedIndex = Config.GetInt(comboBox.Name).Clamp(0, comboBox.Items.Count - 1);
} }
} }
} }

View File

@@ -271,6 +271,8 @@ namespace Flowframes.Magick
string mpDec = FfmpegCommands.GetMpdecimate(wrap: false); // FfmpegCommands.GetMpdecimate((int)FfmpegCommands.MpDecSensitivity.Normal, false); string mpDec = FfmpegCommands.GetMpdecimate(wrap: false); // FfmpegCommands.GetMpdecimate((int)FfmpegCommands.MpDecSensitivity.Normal, false);
ffmpeg.StartInfo.Arguments = $"{baseCmd} & ffmpeg -loglevel debug -y {videoPath.GetConcStr()} -i {videoPath.Wrap()} -fps_mode vfr -vf {mpDec} -f null NUL 2>&1 | findstr keep_count:"; ffmpeg.StartInfo.Arguments = $"{baseCmd} & ffmpeg -loglevel debug -y {videoPath.GetConcStr()} -i {videoPath.Wrap()} -fps_mode vfr -vf {mpDec} -f null NUL 2>&1 | findstr keep_count:";
var ffmpegOutputLines = (await Task.Run(() => OsUtils.GetProcStdOut(ffmpeg, true))).SplitIntoLines(); var ffmpegOutputLines = (await Task.Run(() => OsUtils.GetProcStdOut(ffmpeg, true))).SplitIntoLines();
ffmpegOutputLines = ffmpegOutputLines.Where(l => l.Contains("keep_count")).Select(l => l.Split(']').Last()).ToArray();
var test = string.Join("\n", ffmpegOutputLines);
var frames = new Dictionary<int, List<int>>(); var frames = new Dictionary<int, List<int>>();
int frameCount = 0; int frameCount = 0;

View File

@@ -294,6 +294,8 @@ namespace Flowframes
// } // }
} }
IoUtils.TryDeleteIfExists(currentSettings.FullOutPath); // Partial output file might exist
AutoEncode.busy = false; AutoEncode.busy = false;
Program.mainForm.Invoke(() => Program.mainForm.SetWorking(false)); Program.mainForm.Invoke(() => Program.mainForm.SetWorking(false));
Program.mainForm.Invoke(() => Program.mainForm.SetTab(Program.mainForm.interpOptsTab.Name)); Program.mainForm.Invoke(() => Program.mainForm.SetTab(Program.mainForm.interpOptsTab.Name));