mirror of
https://github.com/n00mkrad/flowframes.git
synced 2026-07-13 14:00:48 +02:00
Remove alpha interp frames after merging into rgb frames
This commit is contained in:
@@ -151,11 +151,13 @@ namespace Flowframes
|
||||
await AvProcess.RunFfmpeg(args, framesFile.GetParentDir(), AvProcess.LogMode.OnlyLastLine, AvProcess.TaskType.Encode);
|
||||
}
|
||||
|
||||
public static async Task MergeAlphaIntoRgb (string rgbDir, int rgbPad, string alphaDir, int aPad)
|
||||
public static async Task MergeAlphaIntoRgb (string rgbDir, int rgbPad, string alphaDir, int aPad, bool deleteAlphaDir)
|
||||
{
|
||||
string filter = "-filter_complex [0:v:0][1:v:0]alphamerge[out] -map [out]";
|
||||
string args = $"-i \"{rgbDir}/%{rgbPad}d.png\" -i \"{alphaDir}/%{aPad}d.png\" {filter} \"{rgbDir}/%{rgbPad}d.png\"";
|
||||
await AvProcess.RunFfmpeg(args, AvProcess.LogMode.Hidden);
|
||||
if (deleteAlphaDir)
|
||||
IOUtils.TryDeleteIfExists(alphaDir);
|
||||
}
|
||||
|
||||
public static async Task LoopVideo(string inputFile, int times, bool delSrc = false)
|
||||
|
||||
@@ -87,7 +87,7 @@ namespace Flowframes
|
||||
if (!Directory.Exists(alphaInterpDir)) return;
|
||||
if (Interpolate.current.outMode == Interpolate.OutMode.VidGif)
|
||||
await Converter.MakeBinary(alphaInterpDir, alphaInterpDir, false); // Apply threshold if output has binary alpha
|
||||
await FFmpegCommands.MergeAlphaIntoRgb(rgbInterpDir, Padding.interpFrames, alphaInterpDir, Padding.interpFrames);
|
||||
await FFmpegCommands.MergeAlphaIntoRgb(rgbInterpDir, Padding.interpFrames, alphaInterpDir, Padding.interpFrames, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user