Fix problems with automatic GIF 50 fps resampling

This commit is contained in:
N00MKRAD
2021-05-18 20:44:08 +02:00
parent 16b199f296
commit 607bbc6ae2
2 changed files with 7 additions and 4 deletions

View File

@@ -120,9 +120,10 @@ namespace Flowframes.Main
passes = false;
}
Fraction fpsLimit = new Fraction(Config.Get(Config.Key.maxFps));
string fpsLimitValue = Config.Get(Config.Key.maxFps);
float fpsLimit = (fpsLimitValue.Contains("/") ? new Fraction(Config.Get(Config.Key.maxFps)).GetFloat() : fpsLimitValue.GetFloat());
if (outMode == I.OutMode.VidGif && fpsOut.GetFloat() > 50 && !(fpsLimit.GetFloat() > 0 && fpsLimit.GetFloat() <= 50))
if (outMode == I.OutMode.VidGif && fpsOut.GetFloat() > 50 && !(fpsLimit > 0 && fpsLimit <= 50))
Logger.Log($"Warning: GIF will be encoded at 50 FPS instead of {fpsOut.GetFloat()} as the format doesn't support frame rates that high.");
if (!passes)

View File

@@ -86,11 +86,13 @@ namespace Flowframes.Media
public static async Task FramesToGifConcat(string framesFile, string outPath, Fraction rate, bool palette, int colors, Fraction resampleFps, LogMode logMode = LogMode.OnlyLastLine)
{
if (rate.GetFloat() > 50f && resampleFps.GetFloat() < 50f)
Logger.Log($"GIF Rate: {rate} (Float: {rate.GetFloat()}) - Resample Rate: {resampleFps} (Float: {resampleFps.GetFloat()})");
if (rate.GetFloat() > 50f && (resampleFps.GetFloat() > 50f || resampleFps.GetFloat() < 1))
resampleFps = new Fraction(50, 1); // Force limit framerate as encoding above 50 will cause problems
if (logMode != LogMode.Hidden)
Logger.Log((resampleFps.GetFloat() <= 0) ? $"Encoding GIF..." : $"Encoding GIF resampled to {resampleFps.ToString().Replace(",", ".")} FPS...");
Logger.Log((resampleFps.GetFloat() <= 0) ? $"Encoding GIF..." : $"Encoding GIF resampled to {resampleFps.GetFloat().ToString().Replace(",", ".")} FPS...");
string framesFilename = Path.GetFileName(framesFile);
string dither = Config.Get(Config.Key.gifDitherType).Split(' ').First();