mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-16 16:37:48 +01:00
Slowmo now works with RIFE-NCNN-VS
This commit is contained in:
@@ -82,12 +82,13 @@ namespace Flowframes.Main
|
||||
bool fpsLimit = maxFps.GetFloat() > 0f && I.currentSettings.outFps.GetFloat() > maxFps.GetFloat();
|
||||
|
||||
VidExtraData extraData = await FfmpegCommands.GetVidExtraInfo(I.currentSettings.inPath);
|
||||
string extraArgs = FfmpegEncode.GetFfmpegExportArgs(fpsLimit ? maxFps : new Fraction(), extraData);
|
||||
string extraArgsIn = FfmpegEncode.GetFfmpegExportArgsIn(I.currentSettings.outFps, I.currentSettings.outItsScale);
|
||||
string extraArgsOut = FfmpegEncode.GetFfmpegExportArgsOut(fpsLimit ? maxFps : new Fraction(), extraData);
|
||||
|
||||
I.currentSettings.FullOutPath = Path.Combine(I.currentSettings.outPath, await IoUtils.GetCurrentExportFilename(fpsLimit, true));
|
||||
IoUtils.RenameExistingFile(I.currentSettings.FullOutPath);
|
||||
|
||||
return $"{encArgs} {extraArgs} {I.currentSettings.FullOutPath.Wrap()}";
|
||||
return $"{extraArgsIn} -i pipe: {encArgs} {extraArgsOut} {I.currentSettings.FullOutPath.Wrap()}";
|
||||
}
|
||||
|
||||
static async Task ExportImageSequence (string framesPath, bool stepByStep)
|
||||
|
||||
@@ -31,8 +31,6 @@ namespace Flowframes.Media
|
||||
inArg = $"-i \"{linksDir}/%{Padding.interpFrames}d{GetConcatFileExt(framesFile)}\"";
|
||||
}
|
||||
|
||||
fps = fps / new Fraction(itsScale);
|
||||
|
||||
string args = "";
|
||||
|
||||
for(int i = 0; i < encArgs.Length; i++)
|
||||
@@ -40,14 +38,20 @@ namespace Flowframes.Media
|
||||
string pre = i == 0 ? "" : $" && ffmpeg {AvProcess.GetFfmpegDefaultArgs()}";
|
||||
string post = (i == 0 && encArgs.Length > 1) ? $"-f null -" : outPath.Wrap();
|
||||
string fs = (!isChunk && outMode == Interpolate.OutMode.VidMp4) ? $"-movflags +faststart" : "";
|
||||
args += $"{pre} -fps_mode 0 -r {fps} {inArg} {encArgs[i]} {GetFfmpegExportArgs(resampleFps, extraData)} -threads {Config.GetInt(Config.Key.ffEncThreads)} {fs} {post} ";
|
||||
args += $"{pre} -fps_mode 0 {GetFfmpegExportArgsIn(fps, itsScale)} {inArg} {encArgs[i]} {GetFfmpegExportArgsOut(resampleFps, extraData)} -threads {Config.GetInt(Config.Key.ffEncThreads)} {fs} {post} ";
|
||||
}
|
||||
|
||||
await RunFfmpeg(args, framesFile.GetParentDir(), logMode, !isChunk);
|
||||
IoUtils.TryDeleteIfExists(linksDir);
|
||||
}
|
||||
|
||||
public static string GetFfmpegExportArgs (Fraction resampleFps, VidExtraData extraData)
|
||||
public static string GetFfmpegExportArgsIn(Fraction fps, float itsScale)
|
||||
{
|
||||
fps = fps / new Fraction(itsScale);
|
||||
return $"-r {fps}";
|
||||
}
|
||||
|
||||
public static string GetFfmpegExportArgsOut (Fraction resampleFps, VidExtraData extraData)
|
||||
{
|
||||
List<string> filters = new List<string>();
|
||||
string extraArgs = "";
|
||||
|
||||
@@ -368,7 +368,7 @@ namespace Flowframes.Os
|
||||
string avDir = Path.Combine(Paths.GetPkgPath(), Paths.audioVideoDir);
|
||||
string rtArgs = $"-window_title \"Flowframes Realtime Interpolation ({Interpolate.currentSettings.inFps.GetString()} FPS x{factor} = {Interpolate.currentSettings.outFps.GetString()} FPS - {mdl})\" -autoexit -seek_interval {VapourSynthUtils.GetSeekSeconds(Program.mainForm.currInDuration)} ";
|
||||
|
||||
string pipedTargetArgs = rt ? $"{Path.Combine(avDir, "ffplay").Wrap()} {rtArgs} - " : $"{Path.Combine(avDir, "ffmpeg").Wrap()} -y -i pipe: {await Export.GetPipedFfmpegCmd()}";
|
||||
string pipedTargetArgs = rt ? $"{Path.Combine(avDir, "ffplay").Wrap()} {rtArgs} - " : $"{Path.Combine(avDir, "ffmpeg").Wrap()} -y {await Export.GetPipedFfmpegCmd()}";
|
||||
|
||||
string pkgDir = Path.Combine(Paths.GetPkgPath(), Implementations.rifeNcnnVs.PkgDir);
|
||||
int gpuId = Config.Get(Config.Key.ncnnGpus).Split(',')[0].GetInt();
|
||||
|
||||
Reference in New Issue
Block a user