diff --git a/Code/Forms/SettingsForm.Designer.cs b/Code/Forms/SettingsForm.Designer.cs index 717c5c1..4d91d99 100644 --- a/Code/Forms/SettingsForm.Designer.cs +++ b/Code/Forms/SettingsForm.Designer.cs @@ -176,6 +176,10 @@ this.cmdDebugMode = new System.Windows.Forms.ComboBox(); this.titleLabel = new System.Windows.Forms.Label(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); + this.label16 = new System.Windows.Forms.Label(); + this.autoEncBackupMode = new System.Windows.Forms.ComboBox(); + this.label41 = new System.Windows.Forms.Label(); + this.pictureBox2 = new System.Windows.Forms.PictureBox(); this.settingsTabList.SuspendLayout(); this.generalTab.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.info1)).BeginInit(); @@ -193,6 +197,7 @@ ((System.ComponentModel.ISupportInitialize)(this.mp4Crf)).BeginInit(); this.debugTab.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).BeginInit(); this.SuspendLayout(); // // settingsTabList @@ -529,6 +534,10 @@ // tabListPage2 // this.tabListPage2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + this.tabListPage2.Controls.Add(this.pictureBox2); + this.tabListPage2.Controls.Add(this.label41); + this.tabListPage2.Controls.Add(this.autoEncBackupMode); + this.tabListPage2.Controls.Add(this.label16); this.tabListPage2.Controls.Add(this.label74); this.tabListPage2.Controls.Add(this.jpegFrames); this.tabListPage2.Controls.Add(this.label63); @@ -1857,7 +1866,7 @@ this.ffEncArgs.Location = new System.Drawing.Point(280, 240); this.ffEncArgs.MinimumSize = new System.Drawing.Size(4, 21); this.ffEncArgs.Name = "ffEncArgs"; - this.ffEncArgs.Size = new System.Drawing.Size(400, 21); + this.ffEncArgs.Size = new System.Drawing.Size(400, 20); this.ffEncArgs.TabIndex = 85; // // label56 @@ -1962,7 +1971,7 @@ this.ffEncThreads.Location = new System.Drawing.Point(280, 180); this.ffEncThreads.MinimumSize = new System.Drawing.Size(4, 21); this.ffEncThreads.Name = "ffEncThreads"; - this.ffEncThreads.Size = new System.Drawing.Size(250, 21); + this.ffEncThreads.Size = new System.Drawing.Size(250, 20); this.ffEncThreads.TabIndex = 70; // // label37 @@ -2052,6 +2061,54 @@ this.titleLabel.TabIndex = 1; this.titleLabel.Text = "Settings"; // + // label16 + // + this.label16.AutoSize = true; + this.label16.Location = new System.Drawing.Point(10, 360); + this.label16.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7); + this.label16.Name = "label16"; + this.label16.Size = new System.Drawing.Size(114, 13); + this.label16.TabIndex = 87; + this.label16.Text = "Auto-Encode Backups"; + // + // autoEncBackupMode + // + this.autoEncBackupMode.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64))))); + this.autoEncBackupMode.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.autoEncBackupMode.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.autoEncBackupMode.ForeColor = System.Drawing.Color.White; + this.autoEncBackupMode.FormattingEnabled = true; + this.autoEncBackupMode.Items.AddRange(new object[] { + "Disabled", + "Enabled (Only Video)", + "Enabled (Complete - With Audio, Subtitles)"}); + this.autoEncBackupMode.Location = new System.Drawing.Point(280, 357); + this.autoEncBackupMode.Name = "autoEncBackupMode"; + this.autoEncBackupMode.Size = new System.Drawing.Size(250, 21); + this.autoEncBackupMode.TabIndex = 88; + // + // label41 + // + this.label41.AutoSize = true; + this.label41.ForeColor = System.Drawing.Color.Silver; + this.label41.Location = new System.Drawing.Point(578, 360); + this.label41.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7); + this.label41.Name = "label41"; + this.label41.Size = new System.Drawing.Size(158, 13); + this.label41.TabIndex = 89; + this.label41.Text = "Can cause slowdown on HDDs!"; + // + // pictureBox2 + // + this.pictureBox2.BackgroundImage = global::Flowframes.Properties.Resources.questmark_72px_bordeer; + this.pictureBox2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom; + this.pictureBox2.Location = new System.Drawing.Point(536, 357); + this.pictureBox2.Name = "pictureBox2"; + this.pictureBox2.Size = new System.Drawing.Size(29, 21); + this.pictureBox2.TabIndex = 90; + this.pictureBox2.TabStop = false; + this.toolTip1.SetToolTip(this.pictureBox2, resources.GetString("pictureBox2.ToolTip")); + // // SettingsForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -2091,6 +2148,7 @@ this.debugTab.ResumeLayout(false); this.debugTab.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox2)).EndInit(); this.ResumeLayout(false); this.PerformLayout(); @@ -2244,5 +2302,9 @@ private System.Windows.Forms.NumericUpDown mp4Crf; private System.Windows.Forms.NumericUpDown vp9Crf; private System.Windows.Forms.Label label13; + private System.Windows.Forms.Label label41; + private System.Windows.Forms.ComboBox autoEncBackupMode; + private System.Windows.Forms.Label label16; + private System.Windows.Forms.PictureBox pictureBox2; } } \ No newline at end of file diff --git a/Code/Forms/SettingsForm.cs b/Code/Forms/SettingsForm.cs index 4a913d4..0ba4893 100644 --- a/Code/Forms/SettingsForm.cs +++ b/Code/Forms/SettingsForm.cs @@ -83,6 +83,7 @@ namespace Flowframes.Forms ConfigParser.SaveGuiElement(scnDetectValue); ConfigParser.SaveComboxIndex(sceneChangeFillMode); ConfigParser.SaveComboxIndex(autoEncMode); + ConfigParser.SaveComboxIndex(autoEncBackupMode); ConfigParser.SaveGuiElement(sbsAllowAutoEnc); // AI ConfigParser.SaveGuiElement(torchGpus); @@ -141,6 +142,7 @@ namespace Flowframes.Forms ConfigParser.LoadGuiElement(scnDetectValue); ConfigParser.LoadComboxIndex(sceneChangeFillMode); ConfigParser.LoadComboxIndex(autoEncMode); + ConfigParser.LoadComboxIndex(autoEncBackupMode); ConfigParser.LoadGuiElement(sbsAllowAutoEnc); // AI ConfigParser.LoadGuiElement(torchGpus); diff --git a/Code/Forms/SettingsForm.resx b/Code/Forms/SettingsForm.resx index 4032c6f..087cdfb 100644 --- a/Code/Forms/SettingsForm.resx +++ b/Code/Forms/SettingsForm.resx @@ -135,6 +135,10 @@ The loop suffix gets added if the output gets looped. You can use the following placeholders: [LOOPS] for how many times it was looped [PLAYS] for how many times it plays (includes first play, so it's LOOPS+1) + + + If this is enabled together with Auto-Encode, a backup video will be created from already encoded chunks, after each chunk has finished encoding. +This causes a minimal CPU load but requires lots of storage bandwidth - It's only recommended to use this on SSDs for longer videos. Specify, which download mirror to use for to download the models from. diff --git a/Code/IO/Config.cs b/Code/IO/Config.cs index 7afea8e..1c79d2e 100644 --- a/Code/IO/Config.cs +++ b/Code/IO/Config.cs @@ -284,7 +284,7 @@ namespace Flowframes.IO allowSymlinkEncoding, allowSymlinkImport, autoDedupFrames, - autoEncBackup, + autoEncBackupMode, autoEncDebug, autoEncMode, autoEncSafeBufferFlavrCuda, diff --git a/Code/Main/AutoEncode.cs b/Code/Main/AutoEncode.cs index 567bb75..0f21ca6 100644 --- a/Code/Main/AutoEncode.cs +++ b/Code/Main/AutoEncode.cs @@ -131,10 +131,13 @@ namespace Flowframes.Main videoIndex++; - if(aiRunning && (currentMuxTask == null || (currentMuxTask != null && currentMuxTask.IsCompleted))) - currentMuxTask = Task.Run(() => CreateVideo.ChunksToVideos(Interpolate.current.tempFolder, videoChunksFolder, Interpolate.current.outPath, true)); - else - Logger.Log($"[AE] Skipping backup because {(!aiRunning ? "this is the final chunk" : "previous mux task has not finished yet")}!", true, false, "ffmpeg"); + if(Config.GetInt(Config.Key.autoEncBackupMode) > 0) + { + if (aiRunning && (currentMuxTask == null || (currentMuxTask != null && currentMuxTask.IsCompleted))) + currentMuxTask = Task.Run(() => CreateVideo.ChunksToVideos(Interpolate.current.tempFolder, videoChunksFolder, Interpolate.current.outPath, true)); + else + Logger.Log($"[AE] Skipping backup because {(!aiRunning ? "this is the final chunk" : "previous mux task has not finished yet")}!", true, false, "ffmpeg"); + } busy = false; } diff --git a/Code/Main/CreateVideo.cs b/Code/Main/CreateVideo.cs index a146463..8a91213 100644 --- a/Code/Main/CreateVideo.cs +++ b/Code/Main/CreateVideo.cs @@ -138,7 +138,6 @@ namespace Flowframes.Main static async Task Encode(I.OutMode mode, string framesPath, string outPath, Fraction fps, Fraction resampleFps) { - string currentOutFile = outPath; string framesFile = Path.Combine(framesPath.GetParentDir(), Paths.GetFrameOrderFilename(I.current.interpFactor)); if (!File.Exists(framesFile)) @@ -157,15 +156,12 @@ namespace Flowframes.Main VidExtraData extraData = await FfmpegCommands.GetVidExtraInfo(I.current.inPath); await FfmpegEncode.FramesToVideo(framesFile, outPath, mode, fps, resampleFps, extraData); await MuxOutputVideo(I.current.inPath, outPath); - await Loop(currentOutFile, await GetLoopTimes()); + await Loop(outPath, await GetLoopTimes()); } } public static async Task ChunksToVideos(string tempFolder, string chunksFolder, string baseOutPath, bool isBackup = false) { - if (isBackup && !Config.GetBool(Config.Key.autoEncBackup)) - return; - if (IOUtils.GetAmountOfFiles(chunksFolder, true, "*" + FFmpegUtils.GetExt(I.current.outMode)) < 1) { I.Cancel("No video chunks found - An error must have occured during chunk encoding!", AiProcess.hasShownError); @@ -210,18 +206,20 @@ namespace Flowframes.Main Logger.Log($"Merged video chunks in {sw.GetElapsedStr()}", true); } - static async Task MergeChunks(string framesFile, string outPath, bool isIncomplete = false) + static async Task MergeChunks(string framesFile, string outPath, bool isBackup = false) { - if (isIncomplete) + if (isBackup) { outPath = IOUtils.FilenameSuffix(outPath, Paths.backupSuffix); await IOUtils.TryDeleteIfExistsAsync(outPath); } - await FfmpegCommands.ConcatVideos(framesFile, outPath, -1, !isIncomplete); - await MuxOutputVideo(I.current.inPath, outPath, isIncomplete, !isIncomplete); + await FfmpegCommands.ConcatVideos(framesFile, outPath, -1, !isBackup); - if(!isIncomplete) + if(!isBackup || (isBackup && Config.GetInt(Config.Key.autoEncBackupMode) == 2)) // Mux if no backup, or if backup AND muxing is enabled for backups + await MuxOutputVideo(I.current.inPath, outPath, isBackup, !isBackup); + + if(!isBackup) await Loop(outPath, await GetLoopTimes()); }