Fixed GIF encoding, updated RIFE-NCNN to latest version + 1.7 model

This commit is contained in:
N00MKRAD 2021-01-05 14:10:57 +01:00
parent e6f129e4e5
commit 98f8448a75
13 changed files with 5 additions and 16 deletions

View File

@ -127,22 +127,13 @@ namespace Flowframes
DeleteSource(inputPath);
}
public static async void FramesToGif(string inputDir, bool palette, int fps, string prefix, bool delSrc = false)
{
int nums = IOUtils.GetFilenameCounterLength(IOUtils.GetFilesSorted(inputDir, false, "*.png")[0], prefix);
string filter = palette ? "-vf \"split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse\"" : "";
string args = "-framerate " + fps + " -i \"" + inputDir + "\\" + prefix + "%0" + nums + "d.png\" -f gif " + filter + " \"" + inputDir + ".gif\"";
await AvProcess.RunFfmpeg(args, AvProcess.LogMode.OnlyLastLine);
if (delSrc)
DeleteSource(inputDir);
}
public static async Task FramesToGifVfr(string framesFile, string outPath, bool palette, int colors = 64)
public static async Task FramesToGifConcat(string framesFile, string outPath, float fps, bool palette, int colors = 64)
{
Logger.Log($"Encoding GIF...");
string vfrFilename = Path.GetFileName(framesFile);
string filter = palette ? $"-vf \"split[s0][s1];[s0]palettegen={colors}[p];[s1][p]paletteuse=dither=floyd_steinberg:diff_mode=rectangle\"" : "";
string args = $"-f concat -i {vfrFilename.Wrap()} -f gif {filter} {outPath.Wrap()}";
string rate = fps.ToString().Replace(",", ".");
string args = $"-loglevel error -f concat -r {rate} -i {vfrFilename.Wrap()} -f gif {filter} {outPath.Wrap()}";
await AvProcess.RunFfmpeg(args, framesFile.GetParentDir(), AvProcess.LogMode.OnlyLastLine);
}

View File

@ -102,7 +102,7 @@ namespace Flowframes.Main
if (mode == i.OutMode.VidGif)
{
await FFmpegCommands.FramesToGifVfr(vfrFile, outPath, true, Config.GetInt("gifColors"));
await FFmpegCommands.FramesToGifConcat(vfrFile, outPath, fps, true, Config.GetInt("gifColors"));
}
else
{

View File

@ -234,7 +234,7 @@ namespace Flowframes
Process rifeNcnn = OSUtils.NewProcess(!OSUtils.ShowHiddenCmd());
AiStarted(rifeNcnn, 1500, 2, inPath);
rifeNcnn.StartInfo.Arguments = $"{OSUtils.GetCmdArg()} cd /D {PkgUtils.GetPkgFolder(Packages.rifeNcnn).Wrap()} & rife-ncnn-vulkan.exe " +
$" -v -i {inPath.Wrap()} -o {outPath.Wrap()} -g {Config.Get("ncnnGpus")} -f {InterpolateUtils.GetOutExt()} -j {GetNcnnThreads()}";
$" -v -i {inPath.Wrap()} -o {outPath.Wrap()} -m rife1.7 -g {Config.Get("ncnnGpus")} -f {InterpolateUtils.GetOutExt()} -j {GetNcnnThreads()}";
Logger.Log("cmd.exe " + rifeNcnn.StartInfo.Arguments, true);
if (!OSUtils.ShowHiddenCmd())
{

Binary file not shown.

Binary file not shown.

View File

@ -1,2 +0,0 @@
2 # hd model, no tiling
1 # initial

Binary file not shown.

BIN
pkgs/rife-ncnn/vcomp140.dll Normal file

Binary file not shown.