diff --git a/Code/Forms/SettingsForm.Designer.cs b/Code/Forms/SettingsForm.Designer.cs index e556eeb..fe5a8eb 100644 --- a/Code/Forms/SettingsForm.Designer.cs +++ b/Code/Forms/SettingsForm.Designer.cs @@ -40,8 +40,6 @@ this.label67 = new System.Windows.Forms.Label(); this.clearModelCacheBtn = new HTAlt.WinForms.HTButton(); this.label64 = new System.Windows.Forms.Label(); - this.modelSuffix = new System.Windows.Forms.CheckBox(); - this.label63 = new System.Windows.Forms.Label(); this.label62 = new System.Windows.Forms.Label(); this.clearLogOnInput = new System.Windows.Forms.CheckBox(); this.label61 = new System.Windows.Forms.Label(); @@ -181,6 +179,7 @@ this.cmdDebugMode = new System.Windows.Forms.ComboBox(); this.titleLabel = new System.Windows.Forms.Label(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); + this.keepMeta = new System.Windows.Forms.CheckBox(); this.settingsTabList.SuspendLayout(); this.generalTab.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.info1)).BeginInit(); @@ -225,8 +224,6 @@ this.generalTab.Controls.Add(this.label67); this.generalTab.Controls.Add(this.clearModelCacheBtn); this.generalTab.Controls.Add(this.label64); - this.generalTab.Controls.Add(this.modelSuffix); - this.generalTab.Controls.Add(this.label63); this.generalTab.Controls.Add(this.label62); this.generalTab.Controls.Add(this.clearLogOnInput); this.generalTab.Controls.Add(this.label61); @@ -315,7 +312,7 @@ this.clearModelCacheBtn.FlatAppearance.BorderSize = 0; this.clearModelCacheBtn.FlatStyle = System.Windows.Forms.FlatStyle.Flat; this.clearModelCacheBtn.ForeColor = System.Drawing.Color.White; - this.clearModelCacheBtn.Location = new System.Drawing.Point(280, 246); + this.clearModelCacheBtn.Location = new System.Drawing.Point(280, 216); this.clearModelCacheBtn.Name = "clearModelCacheBtn"; this.clearModelCacheBtn.Size = new System.Drawing.Size(206, 23); this.clearModelCacheBtn.TabIndex = 79; @@ -326,32 +323,13 @@ // label64 // this.label64.AutoSize = true; - this.label64.Location = new System.Drawing.Point(10, 251); + this.label64.Location = new System.Drawing.Point(10, 221); this.label64.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7); this.label64.Name = "label64"; this.label64.Size = new System.Drawing.Size(157, 13); this.label64.TabIndex = 78; this.label64.Text = "Delete Downloaded Model Files"; // - // modelSuffix - // - this.modelSuffix.AutoSize = true; - this.modelSuffix.Location = new System.Drawing.Point(280, 221); - this.modelSuffix.Name = "modelSuffix"; - this.modelSuffix.Size = new System.Drawing.Size(15, 14); - this.modelSuffix.TabIndex = 77; - this.modelSuffix.UseVisualStyleBackColor = true; - // - // label63 - // - this.label63.AutoSize = true; - this.label63.Location = new System.Drawing.Point(10, 221); - this.label63.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7); - this.label63.Name = "label63"; - this.label63.Size = new System.Drawing.Size(210, 13); - this.label63.TabIndex = 76; - this.label63.Text = "Include AI Model Name In Output Filename"; - // // label62 // this.label62.AutoSize = true; @@ -551,6 +529,7 @@ // tabListPage2 // this.tabListPage2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48))))); + this.tabListPage2.Controls.Add(this.keepMeta); this.tabListPage2.Controls.Add(this.sceneChangeFillMode); this.tabListPage2.Controls.Add(this.label71); this.tabListPage2.Controls.Add(this.label4); @@ -2113,6 +2092,16 @@ this.titleLabel.TabIndex = 1; this.titleLabel.Text = "Settings"; // + // keepMeta + // + this.keepMeta.AutoSize = true; + this.keepMeta.Location = new System.Drawing.Point(467, 39); + this.keepMeta.Name = "keepMeta"; + this.keepMeta.Size = new System.Drawing.Size(131, 17); + this.keepMeta.TabIndex = 81; + this.keepMeta.Text = "Keep Metadata (MKV)"; + this.keepMeta.UseVisualStyleBackColor = true; + // // SettingsForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -2268,8 +2257,6 @@ private System.Windows.Forms.Label label62; private System.Windows.Forms.CheckBox clearLogOnInput; private System.Windows.Forms.Label label61; - private System.Windows.Forms.CheckBox modelSuffix; - private System.Windows.Forms.Label label63; private System.Windows.Forms.Label label64; private HTAlt.WinForms.HTButton clearModelCacheBtn; private System.Windows.Forms.NumericUpDown scnDetectValue; @@ -2306,5 +2293,6 @@ private System.Windows.Forms.CheckBox fixOutputDuration; private System.Windows.Forms.Label label72; private System.Windows.Forms.ComboBox gifDitherType; + private System.Windows.Forms.CheckBox keepMeta; } } \ No newline at end of file diff --git a/Code/Forms/SettingsForm.cs b/Code/Forms/SettingsForm.cs index 8c64956..a8d5df0 100644 --- a/Code/Forms/SettingsForm.cs +++ b/Code/Forms/SettingsForm.cs @@ -75,10 +75,10 @@ namespace Flowframes.Forms ConfigParser.SaveGuiElement(exportNamePatternLoop); ConfigParser.SaveGuiElement(delLogsOnStartup); ConfigParser.SaveGuiElement(clearLogOnInput); - ConfigParser.SaveGuiElement(modelSuffix); // Interpolation ConfigParser.SaveGuiElement(keepAudio); ConfigParser.SaveGuiElement(keepSubs); + ConfigParser.SaveGuiElement(keepMeta); ConfigParser.SaveComboxIndex(dedupMode); ConfigParser.SaveComboxIndex(mpdecimateMode); ConfigParser.SaveGuiElement(dedupThresh); @@ -133,10 +133,10 @@ namespace Flowframes.Forms ConfigParser.LoadGuiElement(exportNamePattern); ConfigParser.LoadGuiElement(exportNamePatternLoop); ConfigParser.LoadGuiElement(clearLogOnInput); - ConfigParser.LoadGuiElement(modelSuffix); // Interpolation ConfigParser.LoadGuiElement(keepAudio); ConfigParser.LoadGuiElement(keepSubs); + ConfigParser.LoadGuiElement(keepMeta); ConfigParser.LoadComboxIndex(dedupMode); ConfigParser.LoadComboxIndex(mpdecimateMode); ConfigParser.LoadGuiElement(dedupThresh); diff --git a/Code/IO/Config.cs b/Code/IO/Config.cs index a437e48..ae36c0f 100644 --- a/Code/IO/Config.cs +++ b/Code/IO/Config.cs @@ -145,6 +145,7 @@ namespace Flowframes.IO if (key == "dedupThresh") return WriteDefault(key, "2"); if (key == "keepAudio") return WriteDefault(key, "True"); if (key == "keepSubs") return WriteDefault(key, "True"); + if (key == "keepMeta") return WriteDefault(key, "True"); if (key == "autoDedupFrames") return WriteDefault(key, "100"); if (key == "scnDetectValue") return WriteDefault(key, "0.2"); if (key == "sceneChangeFillMode") return WriteDefault(key, "1"); diff --git a/Code/Media/FfmpegAudioAndMetadata.cs b/Code/Media/FfmpegAudioAndMetadata.cs index 8419a4a..0e37563 100644 --- a/Code/Media/FfmpegAudioAndMetadata.cs +++ b/Code/Media/FfmpegAudioAndMetadata.cs @@ -195,16 +195,19 @@ namespace Flowframes.Media if (!audioCompat) Logger.Log("Warning: Input audio format(s) not fully supported in output container - Will re-encode.", true, false, "ffmpeg"); - bool enableAudio = Config.GetBool("keepAudio"); - bool enableSubs = Config.GetBool("keepSubs"); + bool audio = Config.GetBool("keepAudio"); + bool subs = Config.GetBool("keepSubs"); + bool meta = Config.GetBool("keepMeta"); - if (!enableAudio) + if (!audio) audioArgs = "-an"; - if (!enableSubs || (enableSubs && !Utils.ContainerSupportsSubs(containerExt))) + if (!subs || (subs && !Utils.ContainerSupportsSubs(containerExt))) subArgs = "-sn"; - string mkvFix = I.current.outMode == I.OutMode.VidMkv ? "-max_interleave_delta 0" : ""; // https://www.reddit.com/r/ffmpeg/comments/efddfs/starting_new_cluster_due_to_timestamp/ + bool isMkv = I.current.outMode == I.OutMode.VidMkv; + string mkvFix = isMkv ? "-max_interleave_delta 0" : ""; // https://reddit.com/r/ffmpeg/comments/efddfs/starting_new_cluster_due_to_timestamp/ + string metaArg = (isMkv && meta) ? "-map 1:t" : ""; // https://reddit.com/r/ffmpeg/comments/fw4jnh/how_to_make_ffmpeg_keep_attached_images_in_mkv_as/ if (QuickSettingsTab.trimEnabled) { @@ -214,14 +217,14 @@ namespace Flowframes.Media string args1 = $"{trim[0]} -i {inputVideo.Wrap()} {trim[1]} -vn -map 0 -c copy {audioArgs} {subArgs} {otherStreamsName}"; // Extract trimmed await RunFfmpeg(args1, tempFolder, LogMode.Hidden); - string args2 = $"-i {inName} -i {otherStreamsName} -map 0:v:0 -map 1:a:? -map 1:s:? -c copy {audioArgs} {subArgs} {mkvFix} {outName}"; // Merge interp + trimmed original + string args2 = $"-i {inName} -i {otherStreamsName} -map 0:v:0 -map 1:a:? -map 1:s:? {metaArg} -c copy {audioArgs} {subArgs} {mkvFix} {outName}"; // Merge interp + trimmed original await RunFfmpeg(args2, tempFolder, LogMode.Hidden); IOUtils.TryDeleteIfExists(Path.Combine(tempFolder, otherStreamsName)); } else // If trimming is disabled we can pull the streams directly from the input file { - string args = $"-i {inName} -i {inputVideo.Wrap()} -map 0:v:0 -map 1:a:? -map 1:s:? -c copy {audioArgs} {subArgs} {mkvFix} {outName}"; + string args = $"-i {inName} -i {inputVideo.Wrap()} -map 0:v:0 -map 1:a:? -map 1:s:? {metaArg} -c copy {audioArgs} {subArgs} {mkvFix} {outName}"; await RunFfmpeg(args, tempFolder, LogMode.Hidden); }