mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-22 19:29:24 +01:00
VP9/ProRes/AVI export, support for custom ffmpeg enc args
This commit is contained in:
@@ -8,6 +8,7 @@ using System.IO;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using Utils = Flowframes.AudioVideo.FFmpegUtils;
|
||||||
|
|
||||||
namespace Flowframes
|
namespace Flowframes
|
||||||
{
|
{
|
||||||
@@ -87,15 +88,30 @@ namespace Flowframes
|
|||||||
DeleteSource(inputFile);
|
DeleteSource(inputFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task FramesToMp4Vfr(string framesFile, string outPath, bool useH265, int crf, float fps, AvProcess.LogMode logMode = AvProcess.LogMode.OnlyLastLine)
|
public static async Task FramesToMp4Vfr(string framesFile, string outPath, Utils.Codec codec, int crf, float fps, AvProcess.LogMode logMode = AvProcess.LogMode.OnlyLastLine)
|
||||||
{
|
{
|
||||||
if(logMode != AvProcess.LogMode.Hidden)
|
if(logMode != AvProcess.LogMode.Hidden)
|
||||||
Logger.Log($"Encoding MP4 video with CRF {crf}...");
|
Logger.Log($"Encoding MP4 video with CRF {crf}...");
|
||||||
string enc = useH265 ? "libx265" : "libx264";
|
string enc = Utils.GetEnc(codec);
|
||||||
string presetStr = $"-preset {Config.Get("ffEncPreset")}";
|
string preset = $"-preset {Config.Get("ffEncPreset")}";
|
||||||
string vfrFilename = Path.GetFileName(framesFile);
|
string vfrFilename = Path.GetFileName(framesFile);
|
||||||
string vsync = (Interpolate.current.interpFactor == 2) ? "-vsync 1" : "-vsync 2";
|
string vsync = (Interpolate.current.interpFactor == 2) ? "-vsync 1" : "-vsync 2";
|
||||||
string args = $"{vsync} -f concat -i {vfrFilename} -r {fps.ToString().Replace(",", ".")} -c:v {enc} -crf {crf} {presetStr} {videoEncArgs} -threads {Config.GetInt("ffEncThreads")} -c:a copy {outPath.Wrap()}";
|
string rate = fps.ToString().Replace(",", ".");
|
||||||
|
string extraArgs = Config.Get("ffEncArgs");
|
||||||
|
string args = $"{vsync} -f concat -i {vfrFilename} -r {rate} -c:v {enc} -crf {crf} {preset} {extraArgs} {videoEncArgs} -threads {Config.GetInt("ffEncThreads")} -c:a copy {outPath.Wrap()}";
|
||||||
|
await AvProcess.RunFfmpeg(args, framesFile.GetParentDir(), logMode);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static async Task FramesToVideoVfr(string framesFile, string outPath, Interpolate.OutMode outMode, float fps, AvProcess.LogMode logMode = AvProcess.LogMode.OnlyLastLine)
|
||||||
|
{
|
||||||
|
if (logMode != AvProcess.LogMode.Hidden)
|
||||||
|
Logger.Log($"Encoding video...");
|
||||||
|
string encArgs = Utils.GetEncArgs(Utils.GetCodec(outMode));
|
||||||
|
string vfrFilename = Path.GetFileName(framesFile);
|
||||||
|
string vsync = (Interpolate.current.interpFactor == 2) ? "-vsync 1" : "-vsync 2";
|
||||||
|
string rate = fps.ToString().Replace(",", ".");
|
||||||
|
string extraArgs = Config.Get("ffEncArgs");
|
||||||
|
string args = $"{vsync} -f concat -i {vfrFilename} -r {rate} {encArgs} {extraArgs} {videoEncArgs} -threads {Config.GetInt("ffEncThreads")} -c:a copy {outPath.Wrap()}";
|
||||||
await AvProcess.RunFfmpeg(args, framesFile.GetParentDir(), logMode);
|
await AvProcess.RunFfmpeg(args, framesFile.GetParentDir(), logMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
79
Code/AudioVideo/FFmpegUtils.cs
Normal file
79
Code/AudioVideo/FFmpegUtils.cs
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
using Flowframes.IO;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace Flowframes.AudioVideo
|
||||||
|
{
|
||||||
|
class FFmpegUtils
|
||||||
|
{
|
||||||
|
public enum Codec { H264, H265, VP9, ProRes, AviRaw }
|
||||||
|
|
||||||
|
|
||||||
|
public static Codec GetCodec(Interpolate.OutMode mode)
|
||||||
|
{
|
||||||
|
if (mode == Interpolate.OutMode.VidMp4)
|
||||||
|
{
|
||||||
|
bool h265 = Config.GetInt("mp4Enc") == 1;
|
||||||
|
return h265 ? Codec.H265 : Codec.H264;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mode == Interpolate.OutMode.VidWebm)
|
||||||
|
return Codec.VP9;
|
||||||
|
|
||||||
|
if (mode == Interpolate.OutMode.VidProRes)
|
||||||
|
return Codec.ProRes;
|
||||||
|
|
||||||
|
if (mode == Interpolate.OutMode.VidAviRaw)
|
||||||
|
return Codec.AviRaw;
|
||||||
|
|
||||||
|
return Codec.H264;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetEnc(Codec codec)
|
||||||
|
{
|
||||||
|
switch (codec)
|
||||||
|
{
|
||||||
|
case Codec.H264: return "libx264";
|
||||||
|
case Codec.H265: return "libx265";
|
||||||
|
case Codec.VP9: return "libvpx-vp9";
|
||||||
|
case Codec.ProRes: return "prores_ks";
|
||||||
|
case Codec.AviRaw: return "rawvideo";
|
||||||
|
}
|
||||||
|
return "libx264";
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetEncArgs (Codec codec)
|
||||||
|
{
|
||||||
|
string args = $"-c:v { GetEnc(codec)} ";
|
||||||
|
|
||||||
|
switch (codec)
|
||||||
|
{
|
||||||
|
case Codec.H264: args += $"-crf {Config.GetInt("h264Crf")} -preset {Config.Get("ffEncPreset")}"; break;
|
||||||
|
case Codec.H265: args += $"-crf {Config.GetInt("h265Crf")} -preset {Config.Get("ffEncPreset")}"; break;
|
||||||
|
case Codec.VP9: args += $"-crf {Config.GetInt("vp9Crf")} -preset {Config.Get("ffEncPreset")}"; break;
|
||||||
|
case Codec.ProRes: args += $"-profile:v {Config.GetInt("proResProfile")}"; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return args;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetExt(Interpolate.OutMode outMode, bool dot = true)
|
||||||
|
{
|
||||||
|
string ext = dot ? "." : "";
|
||||||
|
|
||||||
|
switch (outMode)
|
||||||
|
{
|
||||||
|
case Interpolate.OutMode.VidMp4: ext += "mp4"; break;
|
||||||
|
case Interpolate.OutMode.VidWebm: ext += "webm"; break;
|
||||||
|
case Interpolate.OutMode.VidProRes: ext += "mov"; break;
|
||||||
|
case Interpolate.OutMode.VidAviRaw: ext += "avi"; break;
|
||||||
|
case Interpolate.OutMode.VidGif: ext += "gif"; break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ext;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using Flowframes.Data;
|
using Flowframes.AudioVideo;
|
||||||
|
using Flowframes.Data;
|
||||||
using Flowframes.IO;
|
using Flowframes.IO;
|
||||||
using Flowframes.Main;
|
using Flowframes.Main;
|
||||||
using System;
|
using System;
|
||||||
@@ -44,7 +45,7 @@ namespace Flowframes
|
|||||||
framesFolder = Path.Combine(tempFolder, Paths.framesDir);
|
framesFolder = Path.Combine(tempFolder, Paths.framesDir);
|
||||||
interpFolder = Path.Combine(tempFolder, Paths.interpDir);
|
interpFolder = Path.Combine(tempFolder, Paths.interpDir);
|
||||||
inputIsFrames = IOUtils.IsPathDirectory(inPath);
|
inputIsFrames = IOUtils.IsPathDirectory(inPath);
|
||||||
outFilename = Path.Combine(outPath, Path.GetFileNameWithoutExtension(inPath) + IOUtils.GetAiSuffix(ai, interpFactor) + InterpolateUtils.GetExt(outMode));
|
outFilename = Path.Combine(outPath, Path.GetFileNameWithoutExtension(inPath) + IOUtils.GetAiSuffix(ai, interpFactor) + FFmpegUtils.GetExt(outMode));
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -188,6 +188,7 @@
|
|||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Compile Include="AudioVideo\FFmpegUtils.cs" />
|
||||||
<Compile Include="AudioVideo\GifskiCommands.cs" />
|
<Compile Include="AudioVideo\GifskiCommands.cs" />
|
||||||
<Compile Include="Data\AI.cs" />
|
<Compile Include="Data\AI.cs" />
|
||||||
<Compile Include="Data\InterpSettings.cs" />
|
<Compile Include="Data\InterpSettings.cs" />
|
||||||
|
|||||||
5
Code/Form1.Designer.cs
generated
5
Code/Form1.Designer.cs
generated
@@ -203,7 +203,10 @@
|
|||||||
this.outModeCombox.ForeColor = System.Drawing.Color.White;
|
this.outModeCombox.ForeColor = System.Drawing.Color.White;
|
||||||
this.outModeCombox.FormattingEnabled = true;
|
this.outModeCombox.FormattingEnabled = true;
|
||||||
this.outModeCombox.Items.AddRange(new object[] {
|
this.outModeCombox.Items.AddRange(new object[] {
|
||||||
"MP4 Video",
|
"MP4 Video (h264/h265)",
|
||||||
|
"WEBM Video (VP9)",
|
||||||
|
"MOV Video (Apple ProRes)",
|
||||||
|
"AVI Video (Uncompressed)",
|
||||||
"Animated GIF",
|
"Animated GIF",
|
||||||
"Image Sequence"});
|
"Image Sequence"});
|
||||||
this.outModeCombox.Location = new System.Drawing.Point(281, 158);
|
this.outModeCombox.Location = new System.Drawing.Point(281, 158);
|
||||||
|
|||||||
@@ -173,6 +173,9 @@ namespace Flowframes
|
|||||||
Interpolate.OutMode GetOutMode()
|
Interpolate.OutMode GetOutMode()
|
||||||
{
|
{
|
||||||
Interpolate.OutMode outMode = Interpolate.OutMode.VidMp4;
|
Interpolate.OutMode outMode = Interpolate.OutMode.VidMp4;
|
||||||
|
if (outModeCombox.Text.ToLower().Contains("webm")) outMode = Interpolate.OutMode.VidWebm;
|
||||||
|
if (outModeCombox.Text.ToLower().Contains("prores")) outMode = Interpolate.OutMode.VidProRes;
|
||||||
|
if (outModeCombox.Text.ToLower().Contains("avi")) outMode = Interpolate.OutMode.VidAviRaw;
|
||||||
if (outModeCombox.Text.ToLower().Contains("gif")) outMode = Interpolate.OutMode.VidGif;
|
if (outModeCombox.Text.ToLower().Contains("gif")) outMode = Interpolate.OutMode.VidGif;
|
||||||
if (outModeCombox.Text.ToLower().Contains("image")) outMode = Interpolate.OutMode.ImgPng;
|
if (outModeCombox.Text.ToLower().Contains("image")) outMode = Interpolate.OutMode.ImgPng;
|
||||||
return outMode;
|
return outMode;
|
||||||
@@ -393,15 +396,12 @@ namespace Flowframes
|
|||||||
stepSelector.SelectedIndex = 0;
|
stepSelector.SelectedIndex = 0;
|
||||||
}
|
}
|
||||||
bool stepByStep = Config.GetInt("processingMode") == 1;
|
bool stepByStep = Config.GetInt("processingMode") == 1;
|
||||||
//stepSelector.Visible = stepByStep && !Program.busy;
|
|
||||||
//runStepBtn.Visible = stepByStep && !Program.busy;
|
|
||||||
runBtn.Visible = !stepByStep && !Program.busy;
|
runBtn.Visible = !stepByStep && !Program.busy;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async void runStepBtn_Click(object sender, EventArgs e)
|
private async void runStepBtn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
SetTab("interpolate");
|
SetTab("interpolate");
|
||||||
//Interpolate.SetFps(fpsInTbox.GetFloat());
|
|
||||||
await InterpolateSteps.Run(stepSelector.Text);
|
await InterpolateSteps.Run(stepSelector.Text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
173
Code/Forms/SettingsForm.Designer.cs
generated
173
Code/Forms/SettingsForm.Designer.cs
generated
@@ -79,6 +79,11 @@
|
|||||||
this.enableAudio = new System.Windows.Forms.CheckBox();
|
this.enableAudio = new System.Windows.Forms.CheckBox();
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
this.aiOptsPage = new Cyotek.Windows.Forms.TabListPage();
|
this.aiOptsPage = new Cyotek.Windows.Forms.TabListPage();
|
||||||
|
this.label30 = new System.Windows.Forms.Label();
|
||||||
|
this.panel6 = new System.Windows.Forms.Panel();
|
||||||
|
this.uhdThresh = new System.Windows.Forms.ComboBox();
|
||||||
|
this.label29 = new System.Windows.Forms.Label();
|
||||||
|
this.label28 = new System.Windows.Forms.Label();
|
||||||
this.panel12 = new System.Windows.Forms.Panel();
|
this.panel12 = new System.Windows.Forms.Panel();
|
||||||
this.label44 = new System.Windows.Forms.Label();
|
this.label44 = new System.Windows.Forms.Label();
|
||||||
this.ncnnThreads = new System.Windows.Forms.ComboBox();
|
this.ncnnThreads = new System.Windows.Forms.ComboBox();
|
||||||
@@ -129,7 +134,6 @@
|
|||||||
this.ffprobeCountFrames = new System.Windows.Forms.CheckBox();
|
this.ffprobeCountFrames = new System.Windows.Forms.CheckBox();
|
||||||
this.label40 = new System.Windows.Forms.Label();
|
this.label40 = new System.Windows.Forms.Label();
|
||||||
this.label38 = new System.Windows.Forms.Label();
|
this.label38 = new System.Windows.Forms.Label();
|
||||||
this.panel11 = new System.Windows.Forms.Panel();
|
|
||||||
this.ffEncThreads = new System.Windows.Forms.TextBox();
|
this.ffEncThreads = new System.Windows.Forms.TextBox();
|
||||||
this.label37 = new System.Windows.Forms.Label();
|
this.label37 = new System.Windows.Forms.Label();
|
||||||
this.panel9 = new System.Windows.Forms.Panel();
|
this.panel9 = new System.Windows.Forms.Panel();
|
||||||
@@ -139,11 +143,8 @@
|
|||||||
this.cmdDebugMode = new System.Windows.Forms.ComboBox();
|
this.cmdDebugMode = new System.Windows.Forms.ComboBox();
|
||||||
this.titleLabel = new System.Windows.Forms.Label();
|
this.titleLabel = new System.Windows.Forms.Label();
|
||||||
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
|
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
|
||||||
this.label28 = new System.Windows.Forms.Label();
|
this.label56 = new System.Windows.Forms.Label();
|
||||||
this.label29 = new System.Windows.Forms.Label();
|
this.ffEncArgs = new System.Windows.Forms.TextBox();
|
||||||
this.label30 = new System.Windows.Forms.Label();
|
|
||||||
this.panel6 = new System.Windows.Forms.Panel();
|
|
||||||
this.uhdThresh = new System.Windows.Forms.ComboBox();
|
|
||||||
this.settingsTabList.SuspendLayout();
|
this.settingsTabList.SuspendLayout();
|
||||||
this.generalTab.SuspendLayout();
|
this.generalTab.SuspendLayout();
|
||||||
this.tabListPage2.SuspendLayout();
|
this.tabListPage2.SuspendLayout();
|
||||||
@@ -765,6 +766,66 @@
|
|||||||
this.aiOptsPage.Size = new System.Drawing.Size(762, 419);
|
this.aiOptsPage.Size = new System.Drawing.Size(762, 419);
|
||||||
this.aiOptsPage.Text = "AI Specific Settings";
|
this.aiOptsPage.Text = "AI Specific Settings";
|
||||||
//
|
//
|
||||||
|
// label30
|
||||||
|
//
|
||||||
|
this.label30.AutoSize = true;
|
||||||
|
this.label30.ForeColor = System.Drawing.Color.Silver;
|
||||||
|
this.label30.Location = new System.Drawing.Point(412, 181);
|
||||||
|
this.label30.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
|
||||||
|
this.label30.Name = "label30";
|
||||||
|
this.label30.Size = new System.Drawing.Size(347, 13);
|
||||||
|
this.label30.TabIndex = 67;
|
||||||
|
this.label30.Text = "Minimum height to enable UHD mode which helps high-res interpolations";
|
||||||
|
//
|
||||||
|
// panel6
|
||||||
|
//
|
||||||
|
this.panel6.BackgroundImage = global::Flowframes.Properties.Resources.baseline_create_white_18dp_semiTransparent;
|
||||||
|
this.panel6.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
||||||
|
this.panel6.Location = new System.Drawing.Point(378, 177);
|
||||||
|
this.panel6.Name = "panel6";
|
||||||
|
this.panel6.Size = new System.Drawing.Size(21, 21);
|
||||||
|
this.panel6.TabIndex = 65;
|
||||||
|
this.toolTip1.SetToolTip(this.panel6, "Allows custom input.");
|
||||||
|
//
|
||||||
|
// uhdThresh
|
||||||
|
//
|
||||||
|
this.uhdThresh.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||||
|
this.uhdThresh.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
||||||
|
this.uhdThresh.ForeColor = System.Drawing.Color.White;
|
||||||
|
this.uhdThresh.FormattingEnabled = true;
|
||||||
|
this.uhdThresh.Items.AddRange(new object[] {
|
||||||
|
"4320",
|
||||||
|
"2160",
|
||||||
|
"1440",
|
||||||
|
"1080",
|
||||||
|
"720"});
|
||||||
|
this.uhdThresh.Location = new System.Drawing.Point(280, 177);
|
||||||
|
this.uhdThresh.Margin = new System.Windows.Forms.Padding(3, 3, 8, 3);
|
||||||
|
this.uhdThresh.Name = "uhdThresh";
|
||||||
|
this.uhdThresh.Size = new System.Drawing.Size(87, 21);
|
||||||
|
this.uhdThresh.TabIndex = 66;
|
||||||
|
//
|
||||||
|
// label29
|
||||||
|
//
|
||||||
|
this.label29.AutoSize = true;
|
||||||
|
this.label29.Location = new System.Drawing.Point(10, 180);
|
||||||
|
this.label29.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
|
||||||
|
this.label29.Name = "label29";
|
||||||
|
this.label29.Size = new System.Drawing.Size(151, 13);
|
||||||
|
this.label29.TabIndex = 62;
|
||||||
|
this.label29.Text = "UHD Mode Threshold (Height)";
|
||||||
|
//
|
||||||
|
// label28
|
||||||
|
//
|
||||||
|
this.label28.AutoSize = true;
|
||||||
|
this.label28.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold);
|
||||||
|
this.label28.Location = new System.Drawing.Point(10, 150);
|
||||||
|
this.label28.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
|
||||||
|
this.label28.Name = "label28";
|
||||||
|
this.label28.Size = new System.Drawing.Size(158, 16);
|
||||||
|
this.label28.TabIndex = 61;
|
||||||
|
this.label28.Text = "RIFE (CUDA) Settings";
|
||||||
|
//
|
||||||
// panel12
|
// panel12
|
||||||
//
|
//
|
||||||
this.panel12.BackgroundImage = global::Flowframes.Properties.Resources.baseline_create_white_18dp_semiTransparent;
|
this.panel12.BackgroundImage = global::Flowframes.Properties.Resources.baseline_create_white_18dp_semiTransparent;
|
||||||
@@ -1256,6 +1317,8 @@
|
|||||||
// debugTab
|
// debugTab
|
||||||
//
|
//
|
||||||
this.debugTab.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
|
this.debugTab.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(48)))), ((int)(((byte)(48)))), ((int)(((byte)(48)))));
|
||||||
|
this.debugTab.Controls.Add(this.ffEncArgs);
|
||||||
|
this.debugTab.Controls.Add(this.label56);
|
||||||
this.debugTab.Controls.Add(this.label48);
|
this.debugTab.Controls.Add(this.label48);
|
||||||
this.debugTab.Controls.Add(this.label54);
|
this.debugTab.Controls.Add(this.label54);
|
||||||
this.debugTab.Controls.Add(this.ffEncPreset);
|
this.debugTab.Controls.Add(this.ffEncPreset);
|
||||||
@@ -1266,7 +1329,6 @@
|
|||||||
this.debugTab.Controls.Add(this.ffprobeCountFrames);
|
this.debugTab.Controls.Add(this.ffprobeCountFrames);
|
||||||
this.debugTab.Controls.Add(this.label40);
|
this.debugTab.Controls.Add(this.label40);
|
||||||
this.debugTab.Controls.Add(this.label38);
|
this.debugTab.Controls.Add(this.label38);
|
||||||
this.debugTab.Controls.Add(this.panel11);
|
|
||||||
this.debugTab.Controls.Add(this.ffEncThreads);
|
this.debugTab.Controls.Add(this.ffEncThreads);
|
||||||
this.debugTab.Controls.Add(this.label37);
|
this.debugTab.Controls.Add(this.label37);
|
||||||
this.debugTab.Controls.Add(this.panel9);
|
this.debugTab.Controls.Add(this.panel9);
|
||||||
@@ -1326,9 +1388,9 @@
|
|||||||
this.label47.Location = new System.Drawing.Point(10, 183);
|
this.label47.Location = new System.Drawing.Point(10, 183);
|
||||||
this.label47.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
|
this.label47.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
|
||||||
this.label47.Name = "label47";
|
this.label47.Name = "label47";
|
||||||
this.label47.Size = new System.Drawing.Size(85, 13);
|
this.label47.Size = new System.Drawing.Size(145, 13);
|
||||||
this.label47.TabIndex = 77;
|
this.label47.TabIndex = 77;
|
||||||
this.label47.Text = "Encoding Preset";
|
this.label47.Text = "H264/H265 Encoding Preset";
|
||||||
//
|
//
|
||||||
// label46
|
// label46
|
||||||
//
|
//
|
||||||
@@ -1356,7 +1418,7 @@
|
|||||||
//
|
//
|
||||||
this.label41.AutoSize = true;
|
this.label41.AutoSize = true;
|
||||||
this.label41.ForeColor = System.Drawing.Color.Silver;
|
this.label41.ForeColor = System.Drawing.Color.Silver;
|
||||||
this.label41.Location = new System.Drawing.Point(308, 213);
|
this.label41.Location = new System.Drawing.Point(308, 243);
|
||||||
this.label41.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
|
this.label41.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
|
||||||
this.label41.Name = "label41";
|
this.label41.Name = "label41";
|
||||||
this.label41.Size = new System.Drawing.Size(395, 13);
|
this.label41.Size = new System.Drawing.Size(395, 13);
|
||||||
@@ -1367,7 +1429,7 @@
|
|||||||
// ffprobeCountFrames
|
// ffprobeCountFrames
|
||||||
//
|
//
|
||||||
this.ffprobeCountFrames.AutoSize = true;
|
this.ffprobeCountFrames.AutoSize = true;
|
||||||
this.ffprobeCountFrames.Location = new System.Drawing.Point(280, 213);
|
this.ffprobeCountFrames.Location = new System.Drawing.Point(280, 243);
|
||||||
this.ffprobeCountFrames.Name = "ffprobeCountFrames";
|
this.ffprobeCountFrames.Name = "ffprobeCountFrames";
|
||||||
this.ffprobeCountFrames.Size = new System.Drawing.Size(15, 14);
|
this.ffprobeCountFrames.Size = new System.Drawing.Size(15, 14);
|
||||||
this.ffprobeCountFrames.TabIndex = 73;
|
this.ffprobeCountFrames.TabIndex = 73;
|
||||||
@@ -1376,7 +1438,7 @@
|
|||||||
// label40
|
// label40
|
||||||
//
|
//
|
||||||
this.label40.AutoSize = true;
|
this.label40.AutoSize = true;
|
||||||
this.label40.Location = new System.Drawing.Point(10, 213);
|
this.label40.Location = new System.Drawing.Point(10, 243);
|
||||||
this.label40.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
|
this.label40.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
|
||||||
this.label40.Name = "label40";
|
this.label40.Name = "label40";
|
||||||
this.label40.Size = new System.Drawing.Size(162, 13);
|
this.label40.Size = new System.Drawing.Size(162, 13);
|
||||||
@@ -1387,23 +1449,13 @@
|
|||||||
//
|
//
|
||||||
this.label38.AutoSize = true;
|
this.label38.AutoSize = true;
|
||||||
this.label38.ForeColor = System.Drawing.Color.Silver;
|
this.label38.ForeColor = System.Drawing.Color.Silver;
|
||||||
this.label38.Location = new System.Drawing.Point(570, 157);
|
this.label38.Location = new System.Drawing.Point(543, 156);
|
||||||
this.label38.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
|
this.label38.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
|
||||||
this.label38.Name = "label38";
|
this.label38.Name = "label38";
|
||||||
this.label38.Size = new System.Drawing.Size(131, 13);
|
this.label38.Size = new System.Drawing.Size(131, 13);
|
||||||
this.label38.TabIndex = 71;
|
this.label38.TabIndex = 71;
|
||||||
this.label38.Text = "Use 0 for automatic mode.";
|
this.label38.Text = "Use 0 for automatic mode.";
|
||||||
//
|
//
|
||||||
// panel11
|
|
||||||
//
|
|
||||||
this.panel11.BackgroundImage = global::Flowframes.Properties.Resources.baseline_create_white_18dp_semiTransparent;
|
|
||||||
this.panel11.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
|
||||||
this.panel11.Location = new System.Drawing.Point(536, 153);
|
|
||||||
this.panel11.Name = "panel11";
|
|
||||||
this.panel11.Size = new System.Drawing.Size(21, 21);
|
|
||||||
this.panel11.TabIndex = 61;
|
|
||||||
this.toolTip1.SetToolTip(this.panel11, "Allows custom input.");
|
|
||||||
//
|
|
||||||
// ffEncThreads
|
// ffEncThreads
|
||||||
//
|
//
|
||||||
this.ffEncThreads.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
this.ffEncThreads.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||||
@@ -1501,65 +1553,25 @@
|
|||||||
this.titleLabel.TabIndex = 1;
|
this.titleLabel.TabIndex = 1;
|
||||||
this.titleLabel.Text = "Settings";
|
this.titleLabel.Text = "Settings";
|
||||||
//
|
//
|
||||||
// label28
|
// label56
|
||||||
//
|
//
|
||||||
this.label28.AutoSize = true;
|
this.label56.AutoSize = true;
|
||||||
this.label28.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold);
|
this.label56.Location = new System.Drawing.Point(10, 213);
|
||||||
this.label28.Location = new System.Drawing.Point(10, 150);
|
this.label56.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
|
||||||
this.label28.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
|
this.label56.Name = "label56";
|
||||||
this.label28.Name = "label28";
|
this.label56.Size = new System.Drawing.Size(154, 13);
|
||||||
this.label28.Size = new System.Drawing.Size(158, 16);
|
this.label56.TabIndex = 84;
|
||||||
this.label28.TabIndex = 61;
|
this.label56.Text = "Additional Encoding Arguments";
|
||||||
this.label28.Text = "RIFE (CUDA) Settings";
|
|
||||||
//
|
//
|
||||||
// label29
|
// ffEncArgs
|
||||||
//
|
//
|
||||||
this.label29.AutoSize = true;
|
this.ffEncArgs.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
||||||
this.label29.Location = new System.Drawing.Point(10, 180);
|
this.ffEncArgs.ForeColor = System.Drawing.Color.White;
|
||||||
this.label29.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
|
this.ffEncArgs.Location = new System.Drawing.Point(280, 210);
|
||||||
this.label29.Name = "label29";
|
this.ffEncArgs.MinimumSize = new System.Drawing.Size(4, 21);
|
||||||
this.label29.Size = new System.Drawing.Size(151, 13);
|
this.ffEncArgs.Name = "ffEncArgs";
|
||||||
this.label29.TabIndex = 62;
|
this.ffEncArgs.Size = new System.Drawing.Size(250, 21);
|
||||||
this.label29.Text = "UHD Mode Threshold (Height)";
|
this.ffEncArgs.TabIndex = 85;
|
||||||
//
|
|
||||||
// label30
|
|
||||||
//
|
|
||||||
this.label30.AutoSize = true;
|
|
||||||
this.label30.ForeColor = System.Drawing.Color.Silver;
|
|
||||||
this.label30.Location = new System.Drawing.Point(412, 181);
|
|
||||||
this.label30.Margin = new System.Windows.Forms.Padding(10, 10, 10, 7);
|
|
||||||
this.label30.Name = "label30";
|
|
||||||
this.label30.Size = new System.Drawing.Size(347, 13);
|
|
||||||
this.label30.TabIndex = 67;
|
|
||||||
this.label30.Text = "Minimum height to enable UHD mode which helps high-res interpolations";
|
|
||||||
//
|
|
||||||
// panel6
|
|
||||||
//
|
|
||||||
this.panel6.BackgroundImage = global::Flowframes.Properties.Resources.baseline_create_white_18dp_semiTransparent;
|
|
||||||
this.panel6.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
|
|
||||||
this.panel6.Location = new System.Drawing.Point(378, 177);
|
|
||||||
this.panel6.Name = "panel6";
|
|
||||||
this.panel6.Size = new System.Drawing.Size(21, 21);
|
|
||||||
this.panel6.TabIndex = 65;
|
|
||||||
this.toolTip1.SetToolTip(this.panel6, "Allows custom input.");
|
|
||||||
//
|
|
||||||
// uhdThresh
|
|
||||||
//
|
|
||||||
this.uhdThresh.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
|
|
||||||
this.uhdThresh.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
|
|
||||||
this.uhdThresh.ForeColor = System.Drawing.Color.White;
|
|
||||||
this.uhdThresh.FormattingEnabled = true;
|
|
||||||
this.uhdThresh.Items.AddRange(new object[] {
|
|
||||||
"4320",
|
|
||||||
"2160",
|
|
||||||
"1440",
|
|
||||||
"1080",
|
|
||||||
"720"});
|
|
||||||
this.uhdThresh.Location = new System.Drawing.Point(280, 177);
|
|
||||||
this.uhdThresh.Margin = new System.Windows.Forms.Padding(3, 3, 8, 3);
|
|
||||||
this.uhdThresh.Name = "uhdThresh";
|
|
||||||
this.uhdThresh.Size = new System.Drawing.Size(87, 21);
|
|
||||||
this.uhdThresh.TabIndex = 66;
|
|
||||||
//
|
//
|
||||||
// SettingsForm
|
// SettingsForm
|
||||||
//
|
//
|
||||||
@@ -1674,7 +1686,6 @@
|
|||||||
private HTAlt.WinForms.HTButton tempDirBrowseBtn;
|
private HTAlt.WinForms.HTButton tempDirBrowseBtn;
|
||||||
private System.Windows.Forms.Label label37;
|
private System.Windows.Forms.Label label37;
|
||||||
private System.Windows.Forms.Label label38;
|
private System.Windows.Forms.Label label38;
|
||||||
private System.Windows.Forms.Panel panel11;
|
|
||||||
private System.Windows.Forms.TextBox ffEncThreads;
|
private System.Windows.Forms.TextBox ffEncThreads;
|
||||||
private System.Windows.Forms.ComboBox processingMode;
|
private System.Windows.Forms.ComboBox processingMode;
|
||||||
private System.Windows.Forms.Label label39;
|
private System.Windows.Forms.Label label39;
|
||||||
@@ -1713,5 +1724,7 @@
|
|||||||
private System.Windows.Forms.ComboBox uhdThresh;
|
private System.Windows.Forms.ComboBox uhdThresh;
|
||||||
private System.Windows.Forms.Label label29;
|
private System.Windows.Forms.Label label29;
|
||||||
private System.Windows.Forms.Label label28;
|
private System.Windows.Forms.Label label28;
|
||||||
|
private System.Windows.Forms.TextBox ffEncArgs;
|
||||||
|
private System.Windows.Forms.Label label56;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -82,6 +82,7 @@ namespace Flowframes.Forms
|
|||||||
ConfigParser.SaveGuiElement(autoDedupFrames);
|
ConfigParser.SaveGuiElement(autoDedupFrames);
|
||||||
ConfigParser.SaveGuiElement(ffEncThreads);
|
ConfigParser.SaveGuiElement(ffEncThreads);
|
||||||
ConfigParser.SaveGuiElement(ffEncPreset);
|
ConfigParser.SaveGuiElement(ffEncPreset);
|
||||||
|
ConfigParser.SaveGuiElement(ffEncArgs);
|
||||||
ConfigParser.SaveGuiElement(ffprobeCountFrames);
|
ConfigParser.SaveGuiElement(ffprobeCountFrames);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -124,6 +125,7 @@ namespace Flowframes.Forms
|
|||||||
ConfigParser.LoadGuiElement(autoDedupFrames);
|
ConfigParser.LoadGuiElement(autoDedupFrames);
|
||||||
ConfigParser.LoadGuiElement(ffEncThreads);
|
ConfigParser.LoadGuiElement(ffEncThreads);
|
||||||
ConfigParser.LoadGuiElement(ffEncPreset);
|
ConfigParser.LoadGuiElement(ffEncPreset);
|
||||||
|
ConfigParser.LoadGuiElement(ffEncArgs);
|
||||||
ConfigParser.LoadGuiElement(ffprobeCountFrames);
|
ConfigParser.LoadGuiElement(ffprobeCountFrames);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -102,6 +102,8 @@ namespace Flowframes.IO
|
|||||||
// Video Export
|
// Video Export
|
||||||
if (key == "h264Crf") return WriteDefault(key, "20");
|
if (key == "h264Crf") return WriteDefault(key, "20");
|
||||||
if (key == "h265Crf") return WriteDefault(key, "22");
|
if (key == "h265Crf") return WriteDefault(key, "22");
|
||||||
|
if (key == "vp9Crf") return WriteDefault(key, "24");
|
||||||
|
if (key == "proResProfile") return WriteDefault(key, "2");
|
||||||
if (key == "gifColors") return WriteDefault(key, "128 (High)");
|
if (key == "gifColors") return WriteDefault(key, "128 (High)");
|
||||||
if (key == "minVidLength") return WriteDefault(key, "2");
|
if (key == "minVidLength") return WriteDefault(key, "2");
|
||||||
// AI
|
// AI
|
||||||
@@ -109,6 +111,7 @@ namespace Flowframes.IO
|
|||||||
if (key == "ncnnThreads") return WriteDefault(key, "1");
|
if (key == "ncnnThreads") return WriteDefault(key, "1");
|
||||||
// Debug / Other / Experimental
|
// Debug / Other / Experimental
|
||||||
if (key == "ffEncPreset") return WriteDefault(key, "medium");
|
if (key == "ffEncPreset") return WriteDefault(key, "medium");
|
||||||
|
if (key == "ffEncArgs") return WriteDefault(key, "");
|
||||||
// Tile Sizes
|
// Tile Sizes
|
||||||
if (key == "tilesize_RIFE_NCNN") return WriteDefault(key, "2048");
|
if (key == "tilesize_RIFE_NCNN") return WriteDefault(key, "2048");
|
||||||
if (key == "tilesize_DAIN_NCNN") return WriteDefault(key, "512");
|
if (key == "tilesize_DAIN_NCNN") return WriteDefault(key, "512");
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ namespace Flowframes.Main
|
|||||||
|
|
||||||
string outpath = Path.Combine(videoChunksFolder, $"{videoIndex.ToString().PadLeft(4, '0')}{InterpolateUtils.GetExt(Interpolate.current.outMode)}");
|
string outpath = Path.Combine(videoChunksFolder, $"{videoIndex.ToString().PadLeft(4, '0')}{InterpolateUtils.GetExt(Interpolate.current.outMode)}");
|
||||||
int firstFrameNum = Path.GetFileNameWithoutExtension(framesToEncode[0]).GetInt();
|
int firstFrameNum = Path.GetFileNameWithoutExtension(framesToEncode[0]).GetInt();
|
||||||
await CreateVideo.EncodeChunk(outpath, firstFrameNum - 1, framesToEncode.Count);
|
await CreateVideo.EncodeChunk(outpath, Interpolate.current.outMode, firstFrameNum - 1, framesToEncode.Count);
|
||||||
|
|
||||||
if(Interpolate.canceled) return;
|
if(Interpolate.canceled) return;
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ namespace Flowframes.Main
|
|||||||
int maxFps = Config.GetInt("maxFps");
|
int maxFps = Config.GetInt("maxFps");
|
||||||
if (maxFps == 0) maxFps = 500;
|
if (maxFps == 0) maxFps = 500;
|
||||||
|
|
||||||
if (mode == i.OutMode.VidMp4 && i.current.outFps > maxFps)
|
if (i.current.outFps > maxFps)
|
||||||
await Encode(mode, path, outPath, i.current.outFps, maxFps, (Config.GetInt("maxFpsMode") == 1));
|
await Encode(mode, path, outPath, i.current.outFps, maxFps, (Config.GetInt("maxFpsMode") == 1));
|
||||||
else
|
else
|
||||||
await Encode(mode, path, outPath, i.current.outFps);
|
await Encode(mode, path, outPath, i.current.outFps);
|
||||||
@@ -102,15 +102,16 @@ namespace Flowframes.Main
|
|||||||
string vfrFile = Path.Combine(framesPath.GetParentDir(), $"vfr-{i.current.interpFactor}x.ini");
|
string vfrFile = Path.Combine(framesPath.GetParentDir(), $"vfr-{i.current.interpFactor}x.ini");
|
||||||
|
|
||||||
if (mode == i.OutMode.VidGif)
|
if (mode == i.OutMode.VidGif)
|
||||||
|
{
|
||||||
await FFmpegCommands.FramesToGifVfr(vfrFile, outPath, true, Config.GetInt("gifColors"));
|
await FFmpegCommands.FramesToGifVfr(vfrFile, outPath, true, Config.GetInt("gifColors"));
|
||||||
|
}
|
||||||
if (mode == i.OutMode.VidMp4)
|
else
|
||||||
{
|
{
|
||||||
int looptimes = GetLoopTimes();
|
int looptimes = GetLoopTimes();
|
||||||
bool h265 = Config.GetInt("mp4Enc") == 1;
|
bool h265 = Config.GetInt("mp4Enc") == 1;
|
||||||
int crf = h265 ? Config.GetInt("h265Crf") : Config.GetInt("h264Crf");
|
int crf = h265 ? Config.GetInt("h265Crf") : Config.GetInt("h264Crf");
|
||||||
|
|
||||||
await FFmpegCommands.FramesToMp4Vfr(vfrFile, outPath, h265, crf, fps);
|
await FFmpegCommands.FramesToVideoVfr(vfrFile, outPath, mode, fps);
|
||||||
await MergeAudio(i.current.inPath, outPath);
|
await MergeAudio(i.current.inPath, outPath);
|
||||||
|
|
||||||
if (changeFps > 0)
|
if (changeFps > 0)
|
||||||
@@ -177,7 +178,7 @@ namespace Flowframes.Main
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task EncodeChunk(string outPath, int firstFrameNum, int framesAmount)
|
public static async Task EncodeChunk(string outPath, i.OutMode mode, int firstFrameNum, int framesAmount)
|
||||||
{
|
{
|
||||||
bool h265 = Config.GetInt("mp4Enc") == 1;
|
bool h265 = Config.GetInt("mp4Enc") == 1;
|
||||||
int crf = h265 ? Config.GetInt("h265Crf") : Config.GetInt("h264Crf");
|
int crf = h265 ? Config.GetInt("h265Crf") : Config.GetInt("h264Crf");
|
||||||
@@ -186,7 +187,7 @@ namespace Flowframes.Main
|
|||||||
string vfrFile = Path.Combine(i.current.tempFolder, $"vfr-chunk-{firstFrameNum}-{firstFrameNum + framesAmount}.ini");
|
string vfrFile = Path.Combine(i.current.tempFolder, $"vfr-chunk-{firstFrameNum}-{firstFrameNum + framesAmount}.ini");
|
||||||
File.WriteAllLines(vfrFile, IOUtils.ReadLines(vfrFileOriginal).Skip(firstFrameNum * 2).Take(framesAmount * 2));
|
File.WriteAllLines(vfrFile, IOUtils.ReadLines(vfrFileOriginal).Skip(firstFrameNum * 2).Take(framesAmount * 2));
|
||||||
|
|
||||||
await FFmpegCommands.FramesToMp4Vfr(vfrFile, outPath, h265, crf, i.current.outFps, AvProcess.LogMode.Hidden);
|
await FFmpegCommands.FramesToVideoVfr(vfrFile, outPath, mode, i.current.outFps, AvProcess.LogMode.Hidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
static async Task Loop(string outPath, int looptimes)
|
static async Task Loop(string outPath, int looptimes)
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ namespace Flowframes
|
|||||||
{
|
{
|
||||||
public class Interpolate
|
public class Interpolate
|
||||||
{
|
{
|
||||||
public enum OutMode { VidMp4, VidGif, ImgPng }
|
public enum OutMode { VidMp4, VidWebm, VidProRes, VidAviRaw, VidGif, ImgPng }
|
||||||
|
|
||||||
public static int currentInputFrameCount;
|
public static int currentInputFrameCount;
|
||||||
public static bool currentlyUsingAutoEnc;
|
public static bool currentlyUsingAutoEnc;
|
||||||
|
|||||||
@@ -332,6 +332,8 @@ namespace Flowframes.Main
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
int sourceIndexForScnFrame = sourceFrames.IndexOf(scnFrame); // Get source index of scene frame
|
int sourceIndexForScnFrame = sourceFrames.IndexOf(scnFrame); // Get source index of scene frame
|
||||||
|
if ((sourceIndexForScnFrame + 1) == sourceFrames.Count)
|
||||||
|
continue;
|
||||||
string followingFrame = sourceFrames[sourceIndexForScnFrame + 1]; // Get filename/timestamp of the next source frame
|
string followingFrame = sourceFrames[sourceIndexForScnFrame + 1]; // Get filename/timestamp of the next source frame
|
||||||
|
|
||||||
if (sceneFrames.Contains(followingFrame)) // If next source frame is in scene folder, add to deletion list
|
if (sceneFrames.Contains(followingFrame)) // If next source frame is in scene folder, add to deletion list
|
||||||
|
|||||||
Reference in New Issue
Block a user