Support for AutoEnc in SBS mode, fix MKV ext, auto skip magick dedupe by default

This commit is contained in:
N00MKRAD 2020-12-07 12:34:12 +01:00
parent a29c654dbb
commit b579fcbab2
11 changed files with 148 additions and 128 deletions

View File

@ -49,7 +49,7 @@ namespace Flowframes
ffmpeg.BeginErrorReadLine();
while (!ffmpeg.HasExited)
await Task.Delay(100);
Logger.Log("Done running ffmpeg.", true);
//Logger.Log("Done running ffmpeg.", true);
}
static void FfmpegOutputHandler(object sendingProcess, DataReceivedEventArgs outLine)

View File

@ -1,5 +1,6 @@
using Flowframes.Data;
using Flowframes.IO;
using System;
using System.Drawing;
using System.Globalization;
using System.IO;
@ -21,8 +22,10 @@ namespace Flowframes
public static async Task ExtractSceneChanges(string inputFile, string frameFolderPath)
{
Logger.Log("Extracting scene changes using FFmpeg...");
Logger.Log("Extracting scene changes...");
await VideoToFrames(inputFile, frameFolderPath, (Config.GetInt("dedupMode") == 2), false, new Size(320, 180), true, true);
bool hiddenLog = Interpolate.currentInputFrameCount <= 50;
Logger.Log($"Detected {IOUtils.GetAmountOfFiles(frameFolderPath, false)} scene changes.".Replace(" 0 ", " no "), false, !hiddenLog);
}
public static async Task VideoToFrames(string inputFile, string frameFolderPath, bool deDupe, bool delSrc, bool timecodes = true)
@ -32,7 +35,7 @@ namespace Flowframes
public static async Task VideoToFrames(string inputFile, string frameFolderPath, bool deDupe, bool delSrc, Size size, bool timecodes = true, bool sceneDetect = false)
{
if(!sceneDetect) Logger.Log("Extracting video frames using FFmpeg...");
if(!sceneDetect) Logger.Log("Extracting video frames from input video...");
string sizeStr = (size.Width > 1 && size.Height > 1) ? $"-s {size.Width}x{size.Height}" : "";
IOUtils.CreateDir(frameFolderPath);
string timecodeStr = timecodes ? "-copyts -r 1000 -frame_pts true" : "";
@ -44,7 +47,8 @@ namespace Flowframes
string mpStr = (Config.GetInt("mpdecimateMode") == 0) ? mpDecDef : mpDecAggr;
args = $"-i {inputFile.Wrap()} {pngComprArg} -vsync 0 -pix_fmt rgb24 {timecodeStr} -vf {scnDetect}{mpStr},{divisionFilter} {sizeStr} \"{frameFolderPath}/%{pad}d.png\"";
}
await AvProcess.RunFfmpeg(args, AvProcess.LogMode.OnlyLastLine);
AvProcess.LogMode logMode = Interpolate.currentInputFrameCount > 50 ? AvProcess.LogMode.OnlyLastLine : AvProcess.LogMode.Hidden;
await AvProcess.RunFfmpeg(args, logMode);
await Task.Delay(1);
if (delSrc)
DeleteSource(inputFile);
@ -259,8 +263,10 @@ namespace Flowframes
Logger.Log("Failed to merge audio!");
return;
}
string movePath = Path.ChangeExtension(inputFile, Path.GetExtension(tempPath));
File.Delete(movePath);
File.Delete(inputFile);
File.Move(tempPath, inputFile);
File.Move(tempPath, movePath);
}
public static float GetFramerate (string inputFile)
@ -323,7 +329,7 @@ namespace Flowframes
string[] entries = info.SplitIntoLines();
try
{
Logger.Log("[FFCmds] ReadFrameCountFfprobe - ffprobe output: " + info, true);
Logger.Log("[FFCmds] ReadFrameCountFfprobe - ffprobe output: " + info.Remove(Environment.NewLine), true);
if (readFramesSlow)
return info.GetInt();
foreach (string entry in entries)

View File

@ -47,6 +47,9 @@
this.deleteLogsOnStartup = new System.Windows.Forms.CheckBox();
this.label11 = new System.Windows.Forms.Label();
this.tabListPage2 = new Cyotek.Windows.Forms.TabListPage();
this.autoEncMode = new System.Windows.Forms.ComboBox();
this.label49 = new System.Windows.Forms.Label();
this.panel14 = new System.Windows.Forms.Panel();
this.label52 = new System.Windows.Forms.Label();
this.scnDetectValue = new System.Windows.Forms.ComboBox();
this.label51 = new System.Windows.Forms.Label();
@ -120,9 +123,6 @@
this.minOutVidLength = new System.Windows.Forms.ComboBox();
this.debugTab = new Cyotek.Windows.Forms.TabListPage();
this.label54 = new System.Windows.Forms.Label();
this.label53 = new System.Windows.Forms.Label();
this.vfrMode = new System.Windows.Forms.ComboBox();
this.label48 = new System.Windows.Forms.Label();
this.ffEncPreset = new System.Windows.Forms.ComboBox();
this.label47 = new System.Windows.Forms.Label();
this.label46 = new System.Windows.Forms.Label();
@ -141,9 +141,9 @@
this.cmdDebugMode = new System.Windows.Forms.ComboBox();
this.titleLabel = new System.Windows.Forms.Label();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.panel14 = new System.Windows.Forms.Panel();
this.label49 = new System.Windows.Forms.Label();
this.autoEncMode = new System.Windows.Forms.ComboBox();
this.label48 = new System.Windows.Forms.Label();
this.label53 = new System.Windows.Forms.Label();
this.sbsAllowAutoEnc = new System.Windows.Forms.CheckBox();
this.settingsTabList.SuspendLayout();
this.generalTab.SuspendLayout();
this.tabListPage2.SuspendLayout();
@ -357,6 +357,8 @@
// tabListPage2
//
this.tabListPage2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.tabListPage2.Controls.Add(this.sbsAllowAutoEnc);
this.tabListPage2.Controls.Add(this.label53);
this.tabListPage2.Controls.Add(this.autoEncMode);
this.tabListPage2.Controls.Add(this.label49);
this.tabListPage2.Controls.Add(this.panel14);
@ -384,6 +386,42 @@
this.tabListPage2.Size = new System.Drawing.Size(762, 419);
this.tabListPage2.Text = "Interpolation";
//
// autoEncMode
//
this.autoEncMode.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.autoEncMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.autoEncMode.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.autoEncMode.ForeColor = System.Drawing.Color.White;
this.autoEncMode.FormattingEnabled = true;
this.autoEncMode.Items.AddRange(new object[] {
"Disabled",
"Enabled (Keep Interpolated Frames)",
"Enabled (Delete Frames Once Encoded)"});
this.autoEncMode.Location = new System.Drawing.Point(280, 187);
this.autoEncMode.Name = "autoEncMode";
this.autoEncMode.Size = new System.Drawing.Size(250, 21);
this.autoEncMode.TabIndex = 70;
//
// label49
//
this.label49.AutoSize = true;
this.label49.Location = new System.Drawing.Point(10, 190);
this.label49.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
this.label49.Name = "label49";
this.label49.Size = new System.Drawing.Size(206, 13);
this.label49.TabIndex = 69;
this.label49.Text = "Auto-Encode (Encode While Interpolating)";
//
// panel14
//
this.panel14.BackgroundImage = global::Flowframes.Properties.Resources.baseline_create_white_18dp_semiTransparent;
this.panel14.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.panel14.Location = new System.Drawing.Point(475, 157);
this.panel14.Name = "panel14";
this.panel14.Size = new System.Drawing.Size(21, 21);
this.panel14.TabIndex = 68;
this.toolTip1.SetToolTip(this.panel14, "Allows custom input.");
//
// label52
//
this.label52.AutoSize = true;
@ -570,7 +608,7 @@
//
this.label27.AutoSize = true;
this.label27.ForeColor = System.Drawing.Color.Silver;
this.label27.Location = new System.Drawing.Point(308, 271);
this.label27.Location = new System.Drawing.Point(308, 301);
this.label27.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
this.label27.Name = "label27";
this.label27.Size = new System.Drawing.Size(449, 13);
@ -581,7 +619,7 @@
// jpegInterps
//
this.jpegInterps.AutoSize = true;
this.jpegInterps.Location = new System.Drawing.Point(280, 270);
this.jpegInterps.Location = new System.Drawing.Point(280, 300);
this.jpegInterps.Name = "jpegInterps";
this.jpegInterps.Size = new System.Drawing.Size(15, 14);
this.jpegInterps.TabIndex = 48;
@ -590,7 +628,7 @@
// label25
//
this.label25.AutoSize = true;
this.label25.Location = new System.Drawing.Point(10, 270);
this.label25.Location = new System.Drawing.Point(10, 300);
this.label25.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
this.label25.Name = "label25";
this.label25.Size = new System.Drawing.Size(149, 13);
@ -601,7 +639,7 @@
//
this.label26.AutoSize = true;
this.label26.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold);
this.label26.Location = new System.Drawing.Point(10, 240);
this.label26.Location = new System.Drawing.Point(10, 270);
this.label26.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
this.label26.Name = "label26";
this.label26.Size = new System.Drawing.Size(76, 16);
@ -1256,10 +1294,8 @@
// debugTab
//
this.debugTab.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
this.debugTab.Controls.Add(this.label54);
this.debugTab.Controls.Add(this.label53);
this.debugTab.Controls.Add(this.vfrMode);
this.debugTab.Controls.Add(this.label48);
this.debugTab.Controls.Add(this.label54);
this.debugTab.Controls.Add(this.ffEncPreset);
this.debugTab.Controls.Add(this.label47);
this.debugTab.Controls.Add(this.label46);
@ -1291,42 +1327,6 @@
this.label54.TabIndex = 82;
this.label54.Text = "Slower is more efficient.\r\n";
//
// label53
//
this.label53.AutoSize = true;
this.label53.ForeColor = System.Drawing.Color.Silver;
this.label53.Location = new System.Drawing.Point(543, 214);
this.label53.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
this.label53.Name = "label53";
this.label53.Size = new System.Drawing.Size(186, 13);
this.label53.TabIndex = 81;
this.label53.Text = "CFR is recommended for compatibility.";
//
// vfrMode
//
this.vfrMode.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.vfrMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.vfrMode.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.vfrMode.ForeColor = System.Drawing.Color.White;
this.vfrMode.FormattingEnabled = true;
this.vfrMode.Items.AddRange(new object[] {
"CFR (Reduplicate Or Drop Frames)",
"VFR (Extend Or Drop Frames)"});
this.vfrMode.Location = new System.Drawing.Point(280, 210);
this.vfrMode.Name = "vfrMode";
this.vfrMode.Size = new System.Drawing.Size(250, 21);
this.vfrMode.TabIndex = 80;
//
// label48
//
this.label48.AutoSize = true;
this.label48.Location = new System.Drawing.Point(10, 213);
this.label48.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
this.label48.Name = "label48";
this.label48.Size = new System.Drawing.Size(88, 13);
this.label48.TabIndex = 79;
this.label48.Text = "Timestamp Mode";
//
// ffEncPreset
//
this.ffEncPreset.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
@ -1383,7 +1383,7 @@
//
this.label41.AutoSize = true;
this.label41.ForeColor = System.Drawing.Color.Silver;
this.label41.Location = new System.Drawing.Point(308, 243);
this.label41.Location = new System.Drawing.Point(308, 213);
this.label41.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
this.label41.Name = "label41";
this.label41.Size = new System.Drawing.Size(423, 13);
@ -1394,7 +1394,7 @@
// ffprobeCountFrames
//
this.ffprobeCountFrames.AutoSize = true;
this.ffprobeCountFrames.Location = new System.Drawing.Point(280, 243);
this.ffprobeCountFrames.Location = new System.Drawing.Point(280, 213);
this.ffprobeCountFrames.Name = "ffprobeCountFrames";
this.ffprobeCountFrames.Size = new System.Drawing.Size(15, 14);
this.ffprobeCountFrames.TabIndex = 73;
@ -1403,7 +1403,7 @@
// label40
//
this.label40.AutoSize = true;
this.label40.Location = new System.Drawing.Point(10, 243);
this.label40.Location = new System.Drawing.Point(10, 213);
this.label40.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
this.label40.Name = "label40";
this.label40.Size = new System.Drawing.Size(162, 13);
@ -1468,12 +1468,12 @@
this.autoDedupFrames.ForeColor = System.Drawing.Color.White;
this.autoDedupFrames.FormattingEnabled = true;
this.autoDedupFrames.Items.AddRange(new object[] {
"5",
"10",
"20",
"30",
"45",
"60"});
"0",
"25",
"50",
"100",
"250",
"500"});
this.autoDedupFrames.Location = new System.Drawing.Point(280, 67);
this.autoDedupFrames.Name = "autoDedupFrames";
this.autoDedupFrames.Size = new System.Drawing.Size(250, 21);
@ -1485,9 +1485,9 @@
this.label7.Location = new System.Drawing.Point(10, 70);
this.label7.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(228, 13);
this.label7.Size = new System.Drawing.Size(224, 13);
this.label7.TabIndex = 33;
this.label7.Text = "Amount Of Frames To Check For Auto-Dedupe";
this.label7.Text = "Amount Of Non-Dupe Frames Before Skipping";
//
// label3
//
@ -1528,41 +1528,35 @@
this.titleLabel.TabIndex = 1;
this.titleLabel.Text = "Settings";
//
// panel14
// label48
//
this.panel14.BackgroundImage = global::Flowframes.Properties.Resources.baseline_create_white_18dp_semiTransparent;
this.panel14.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.panel14.Location = new System.Drawing.Point(475, 157);
this.panel14.Name = "panel14";
this.panel14.Size = new System.Drawing.Size(21, 21);
this.panel14.TabIndex = 68;
this.toolTip1.SetToolTip(this.panel14, "Allows custom input.");
this.label48.AutoSize = true;
this.label48.ForeColor = System.Drawing.Color.Silver;
this.label48.Location = new System.Drawing.Point(570, 71);
this.label48.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
this.label48.Name = "label48";
this.label48.Size = new System.Drawing.Size(169, 13);
this.label48.TabIndex = 83;
this.label48.Text = "Use 0 to disable (check all frames)";
//
// label49
// label53
//
this.label49.AutoSize = true;
this.label49.Location = new System.Drawing.Point(10, 190);
this.label49.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
this.label49.Name = "label49";
this.label49.Size = new System.Drawing.Size(206, 13);
this.label49.TabIndex = 69;
this.label49.Text = "Auto-Encode (Encode While Interpolating)";
this.label53.AutoSize = true;
this.label53.Location = new System.Drawing.Point(10, 220);
this.label53.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
this.label53.Name = "label53";
this.label53.Size = new System.Drawing.Size(203, 13);
this.label53.TabIndex = 71;
this.label53.Text = "Allow Auto-Encode in Step-By-Step Mode";
//
// autoEncMode
// sbsAllowAutoEnc
//
this.autoEncMode.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
this.autoEncMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.autoEncMode.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
this.autoEncMode.ForeColor = System.Drawing.Color.White;
this.autoEncMode.FormattingEnabled = true;
this.autoEncMode.Items.AddRange(new object[] {
"Disabled",
"Enabled (Keep Interpolated Frames)",
"Enabled (Delete Frames Once Encoded)"});
this.autoEncMode.Location = new System.Drawing.Point(280, 187);
this.autoEncMode.Name = "autoEncMode";
this.autoEncMode.Size = new System.Drawing.Size(250, 21);
this.autoEncMode.TabIndex = 70;
this.sbsAllowAutoEnc.AutoSize = true;
this.sbsAllowAutoEnc.Location = new System.Drawing.Point(280, 220);
this.sbsAllowAutoEnc.Name = "sbsAllowAutoEnc";
this.sbsAllowAutoEnc.Size = new System.Drawing.Size(15, 14);
this.sbsAllowAutoEnc.TabIndex = 72;
this.sbsAllowAutoEnc.UseVisualStyleBackColor = true;
//
// SettingsForm
//
@ -1702,19 +1696,19 @@
private System.Windows.Forms.Label label47;
private System.Windows.Forms.Label label46;
private System.Windows.Forms.Label label45;
private System.Windows.Forms.ComboBox vfrMode;
private System.Windows.Forms.Label label48;
private System.Windows.Forms.ComboBox scnDetectValue;
private System.Windows.Forms.Label label51;
private System.Windows.Forms.CheckBox scnDetect;
private System.Windows.Forms.Label label50;
private System.Windows.Forms.Label label52;
private System.Windows.Forms.Label label53;
private System.Windows.Forms.Label label54;
private System.Windows.Forms.ComboBox loopMode;
private System.Windows.Forms.Label label55;
private System.Windows.Forms.Panel panel14;
private System.Windows.Forms.Label label49;
private System.Windows.Forms.ComboBox autoEncMode;
private System.Windows.Forms.Label label48;
private System.Windows.Forms.CheckBox sbsAllowAutoEnc;
private System.Windows.Forms.Label label53;
}
}

View File

@ -63,6 +63,7 @@ namespace Flowframes.Forms
ConfigParser.SaveGuiElement(scnDetect);
ConfigParser.SaveGuiElement(scnDetectValue, ConfigParser.StringMode.Float);
ConfigParser.SaveComboxIndex(autoEncMode);
ConfigParser.SaveGuiElement(sbsAllowAutoEnc);
// AI
ConfigParser.SaveComboxIndex(rifeMode);
ConfigParser.SaveGuiElement(torchGpus);
@ -83,14 +84,10 @@ namespace Flowframes.Forms
ConfigParser.SaveGuiElement(ffEncThreads);
ConfigParser.SaveGuiElement(ffEncPreset);
ConfigParser.SaveGuiElement(ffprobeCountFrames);
ConfigParser.SaveComboxIndex(vfrMode);
}
void LoadSettings()
{
// REMOVE ME ONCE FINISHED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//processingMode.SelectedIndex = 0;
// General
ConfigParser.LoadComboxIndex(processingMode);
ConfigParser.LoadGuiElement(maxVidHeight);
@ -108,6 +105,7 @@ namespace Flowframes.Forms
ConfigParser.LoadGuiElement(scnDetect);
ConfigParser.LoadGuiElement(scnDetectValue);
ConfigParser.LoadComboxIndex(autoEncMode);
ConfigParser.LoadGuiElement(sbsAllowAutoEnc);
// AI
ConfigParser.LoadComboxIndex(rifeMode);
ConfigParser.LoadGuiElement(torchGpus);
@ -128,7 +126,6 @@ namespace Flowframes.Forms
ConfigParser.LoadGuiElement(ffEncThreads);
ConfigParser.LoadGuiElement(ffEncPreset);
ConfigParser.LoadGuiElement(ffprobeCountFrames);
ConfigParser.LoadComboxIndex(vfrMode);
}
private void dedupThresh_Leave(object sender, EventArgs e)

View File

@ -94,7 +94,7 @@ namespace Flowframes.IO
if (key == "dedupMode") return WriteDefault(key, "2");
if (key == "dedupThresh") return WriteDefault(key, "2");
if (key == "enableAudio") return WriteDefault(key, "True");
if (key == "autoDedupFrames") return WriteDefault(key, "15");
if (key == "autoDedupFrames") return WriteDefault(key, "100");
if (key == "vfrDedupe") return WriteDefault(key, "True");
if (key == "timingMode") return WriteDefault(key, "1");
if (key == "scnDetectValue") return WriteDefault(key, "0.2");

View File

@ -553,5 +553,20 @@ namespace Flowframes.IO
}
}
}
public static bool CheckImageValid (string path)
{
try
{
Image img = GetImage(path);
if (img.Width > 1 && img.Height > 1)
return true;
return false;
}
catch
{
return false;
}
}
}
}

View File

@ -58,5 +58,16 @@ namespace Flowframes
// this if fine, i forgot why
}
}
public static void Clear ()
{
textbox.Text = "";
}
public static string GetLastLine ()
{
string[] lines = textbox.Text.SplitIntoLines();
return lines.Last();
}
}
}

View File

@ -23,30 +23,17 @@ namespace Flowframes.Magick
public static async Task Run(string path, bool testRun = false, bool setStatus = true)
{
UpdateCurrentMode();
if (currentMode == Mode.None)
return;
currentMode = Mode.Auto;
Program.mainForm.SetStatus("Running frame de-duplication");
currentThreshold = Config.GetFloat("dedupThresh");
Logger.Log("Running frame de-duplication with mode " + currentMode.ToString().Wrap());
Logger.Log("Running accurate frame de-duplication...");
if (currentMode == Mode.Enabled || currentMode == Mode.Auto)
await RemoveDupeFrames(path, currentThreshold, "png", testRun, false, (currentMode == Mode.Auto));
}
static void UpdateCurrentMode ()
{
switch (Config.GetInt("dedupMode"))
{
case 0: currentMode = Mode.None; break;
case 1: currentMode = Mode.Enabled; break;
case 2: currentMode = Mode.Auto; break;
}
}
public static Dictionary<string, MagickImage> imageCache = new Dictionary<string, MagickImage>();
static MagickImage GetImage(string path)
{
@ -179,7 +166,7 @@ namespace Flowframes.Magick
if (Interpolate.canceled) return;
if (!testRun && skipIfNoDupes && !hasEncounteredAnyDupes && i >= skipAfterNoDupesFrames)
if (!testRun && skipIfNoDupes && !hasEncounteredAnyDupes && skipAfterNoDupesFrames > 0 && i >= skipAfterNoDupesFrames)
{
skipped = true;
break;
@ -192,7 +179,7 @@ namespace Flowframes.Magick
if (Interpolate.canceled) return;
if (skipped)
{
Logger.Log($"[FrameDedup] First {skipAfterNoDupesFrames} frames did not have any duplicates - Skipping the rest!");
Logger.Log($"[FrameDedup] First {skipAfterNoDupesFrames} frames did not have any duplicates - Skipping the rest!", false, true);
}
else
{

View File

@ -171,12 +171,12 @@ namespace Flowframes
public static async Task RunAi(string outpath, int targetFrames, int tilesize, AI ai, bool stepByStep = false)
{
if (!stepByStep && Config.GetInt("autoEncMode") > 0)
if ((stepByStep && Config.GetBool("sbsAllowAutoEnc")) || (!stepByStep && Config.GetInt("autoEncMode") > 0))
currentlyUsingAutoEnc = IOUtils.GetAmountOfFiles(currentFramesPath, false) * lastInterpFactor >= (AutoEncode.chunkSize + AutoEncode.safetyBufferFrames) * 1.1f;
else
currentlyUsingAutoEnc = false;
Directory.CreateDirectory(outpath);
IOUtils.CreateDir(outpath);
List<Task> tasks = new List<Task>();
@ -194,7 +194,7 @@ namespace Flowframes
if (currentlyUsingAutoEnc)
{
Logger.Log("Using Auto-Encode.");
Logger.Log($"{Logger.GetLastLine()} (Using Auto-Encode)", true);
tasks.Add(AutoEncode.MainLoop(outpath));
}
await Task.WhenAll(tasks);

View File

@ -63,7 +63,6 @@ namespace Flowframes.Main
{
BatchEntry e = Program.mainForm.GetBatchEntry();
interpFactor = e.interpFactor;
Logger.Log("interpFactor from gui batchentry: " + interpFactor);
currentAi = e.ai;
try
@ -157,6 +156,9 @@ namespace Flowframes.Main
IOUtils.ReverseRenaming(AiProcess.filenameMap, true); // Get timestamps back
lastInterpFactor = interpFactor;
if (Config.GetBool("sbsAllowAutoEnc"))
nextOutPath = Path.Combine(currentOutPath, Path.GetFileNameWithoutExtension(currentInPath) + IOUtils.GetAiSuffix(currentAi, lastInterpFactor) + InterpolateUtils.GetExt(currentOutMode));
await PostProcessFrames(true);
int frames = IOUtils.GetAmountOfFiles(currentFramesPath, false, "*.png");
@ -171,6 +173,14 @@ namespace Flowframes.Main
public static async Task CreateOutputVid()
{
string[] outFrames = Directory.GetFiles(currentInterpFramesDir, $"*.{InterpolateUtils.lastExt}");
if (outFrames.Length > 0 && !IOUtils.CheckImageValid(outFrames[0]))
{
InterpolateUtils.ShowMessage("Invalid frame files detected!\n\nIf you used Auto-Encode, this is normal, and you don't need to run " +
"this step as the video was already created in the \"Interpolate\" step.", "Error");
return;
}
currentOutMode = Program.mainForm.GetBatchEntry().outMode;
string outPath = Path.Combine(currentOutPath, Path.GetFileNameWithoutExtension(currentInPath) + IOUtils.GetAiSuffix(currentAi, lastInterpFactor) + InterpolateUtils.GetExt(currentOutMode));
await CreateVideo.Export(currentInterpFramesDir, outPath, currentOutMode);

View File

@ -72,13 +72,13 @@ namespace Flowframes.OS
bool isInstalled = false;
Logger.Log("Checking if system Python is available...");
Logger.Log("Checking if system Python is available...", true);
string sysPyVer = GetSysPyVersion();
if (!string.IsNullOrWhiteSpace(sysPyVer) && !sysPyVer.ToLower().Contains("not found") && sysPyVer.Length <= 35)
{
isInstalled = true;
Logger.Log("Using Python installation: " + sysPyVer, false, true);
Logger.Log("Using Python installation: " + sysPyVer, true);
}
hasCheckedSysPy = true;