mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-24 04:09:29 +01:00
Fixed functions needed for img sequences not running, fixed loop frame count with sequences
This commit is contained in:
@@ -7,13 +7,12 @@ namespace Flowframes.Data
|
||||
public static AI rifeCuda = new AI(AI.AiBackend.Pytorch, "RIFE_CUDA", "RIFE",
|
||||
"CUDA/Pytorch Implementation of RIFE (Nvidia Only!)", "rife-cuda", AI.InterpFactorSupport.AnyInteger, new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10 });
|
||||
|
||||
public static AI rifeNcnnVs = new AI(AI.AiBackend.Ncnn, "RIFE_NCNN_VS", "RIFE (NCNN/VS)",
|
||||
"Vulkan/NCNN/VapourSynth Implementation of RIFE", "rife-ncnn-vs", AI.InterpFactorSupport.AnyFloat, new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10 }) { Piped = true };
|
||||
|
||||
public static AI rifeNcnn = new AI(AI.AiBackend.Ncnn, "RIFE_NCNN", "RIFE (NCNN)",
|
||||
"Vulkan/NCNN Implementation of RIFE", "rife-ncnn", AI.InterpFactorSupport.AnyFloat, new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10 });
|
||||
|
||||
public static AI rifeNcnnVs = new AI(AI.AiBackend.Ncnn, "RIFE_NCNN_VS", "RIFE (NCNN/VS)",
|
||||
"Vulkan/NCNN Implementation of RIFE in VS", "rife-ncnn-vs", AI.InterpFactorSupport.AnyFloat, new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10 })
|
||||
{ Piped = true };
|
||||
|
||||
public static AI flavrCuda = new AI(AI.AiBackend.Pytorch, "FLAVR_CUDA", "FLAVR",
|
||||
"Experimental Pytorch Implementation of FLAVR (Nvidia Only!)", "flavr-cuda", AI.InterpFactorSupport.Fixed, new int[] { 2, 4, 8 });
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ namespace Flowframes
|
||||
await Export.ExportFrames(current.interpFolder, current.outPath, current.outMode, false);
|
||||
}
|
||||
|
||||
if (!AutoEncodeResume.resumeNextRun && Config.GetBool(Config.Key.keepTempFolder))
|
||||
if (!AutoEncodeResume.resumeNextRun && Config.GetBool(Config.Key.keepTempFolder) && IoUtils.GetAmountOfFiles(current.framesFolder, false) > 0)
|
||||
await Task.Run(async () => { await FrameRename.Unrename(); });
|
||||
|
||||
await Done();
|
||||
@@ -179,8 +179,11 @@ namespace Flowframes
|
||||
{
|
||||
if (canceled) return;
|
||||
|
||||
await Task.Run(async () => { await Dedupe.CreateDupesFile(current.framesFolder, currentInputFrameCount, current.framesExt); });
|
||||
await Task.Run(async () => { await FrameRename.Rename(); });
|
||||
if (!ai.Piped || ai.Piped && current.inputIsFrames)
|
||||
{
|
||||
await Task.Run(async () => { await Dedupe.CreateDupesFile(current.framesFolder, currentInputFrameCount, current.framesExt); });
|
||||
await Task.Run(async () => { await FrameRename.Rename(); });
|
||||
}
|
||||
|
||||
if (!ai.Piped)
|
||||
await Task.Run(async () => { await FrameOrder.CreateFrameOrderFile(current.framesFolder, Config.GetBool(Config.Key.enableLoop), current.interpFactor); });
|
||||
|
||||
@@ -33,6 +33,8 @@ namespace Flowframes.Os
|
||||
bool sc = s.SceneDetectSensitivity >= 0.01f;
|
||||
|
||||
int endDupeCount = s.Factor.RoundToInt() - 1;
|
||||
int targetFrameCountMatchDuration = (Interpolate.currentInputFrameCount * s.Factor).RoundToInt(); // Target frame count to match original duration (and for loops)
|
||||
int targetFrameCountTrue = targetFrameCountMatchDuration - endDupeCount; // Target frame count without dupes at the end (only in-between frames added)
|
||||
|
||||
List<string> l = new List<string> { "import sys", "import vapoursynth as vs", "core = vs.core" }; // Imports
|
||||
|
||||
@@ -47,10 +49,7 @@ namespace Flowframes.Os
|
||||
l.Add($"clip = core.lsmas.LWLibavSource(r'{inputPath}', cachefile=r'{Path.Combine(s.InterpSettings.tempFolder, "lsmash.cache.lwi")}')"); // Load video with lsmash
|
||||
}
|
||||
|
||||
l.Add($"targetFrameCountMatchDuration = round((clip.num_frames*{s.Factor.ToStringDot()}), 1)"); // Target frame count to match original duration (and for loops)
|
||||
l.Add($"targetFrameCountTrue = targetFrameCountMatchDuration-{endDupeCount}"); // Target frame count without dupes at the end (only in-between frames added)
|
||||
|
||||
if (s.Loop)
|
||||
if (s.Loop && !s.InterpSettings.inputIsFrames)
|
||||
{
|
||||
l.Add($"firstFrame = clip[0]"); // Grab first frame
|
||||
l.Add($"clip = clip + firstFrame"); // Add to end (for seamless loop interpolation)
|
||||
@@ -66,12 +65,12 @@ namespace Flowframes.Os
|
||||
|
||||
if (s.Loop)
|
||||
{
|
||||
l.Add($"clip = clip.std.Trim(0, targetFrameCountMatchDuration-1)");
|
||||
l.Add($"clip = clip.std.Trim(0, {targetFrameCountMatchDuration}-1)");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!s.MatchDuration)
|
||||
l.Add($"clip = clip.std.Trim(0, targetFrameCountTrue-1)");
|
||||
l.Add($"clip = clip.std.Trim(0, {targetFrameCountTrue}-1)");
|
||||
}
|
||||
|
||||
l.Add($"clip.set_output()"); // Set output
|
||||
|
||||
Reference in New Issue
Block a user