GIF optimization & color palette option

This commit is contained in:
N00MKRAD
2020-12-08 15:22:46 +01:00
parent 4e2f4b40f9
commit fb453216f1
6 changed files with 64 additions and 92 deletions

View File

@@ -176,11 +176,11 @@ namespace Flowframes
DeleteSource(inputDir);
}
public static async Task FramesToGifVfr(string framesFile, string outPath, bool palette)
public static async Task FramesToGifVfr(string framesFile, string outPath, bool palette, int colors = 64)
{
Logger.Log($"Encoding GIF...");
string vfrFilename = Path.GetFileName(framesFile);
string filter = palette ? "-vf \"split[s0][s1];[s0]palettegen[p];[s1][p]paletteuse\"" : "";
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()}";
await AvProcess.RunFfmpeg(args, framesFile.GetParentDir(), AvProcess.LogMode.OnlyLastLine);
}