From 3fd9bbd72ba18430fe9d4d0035c73bbc1a5e5e24 Mon Sep 17 00:00:00 2001 From: n00mkrad Date: Mon, 30 Aug 2021 22:15:55 +0200 Subject: [PATCH] Fix WEBP conversion --- Code/Main/CreateVideo.cs | 4 +--- Code/Media/FfmpegEncode.cs | 1 + 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Code/Main/CreateVideo.cs b/Code/Main/CreateVideo.cs index 9e0c00e..4919a45 100644 --- a/Code/Main/CreateVideo.cs +++ b/Code/Main/CreateVideo.cs @@ -10,7 +10,6 @@ using I = Flowframes.Interpolate; using System.Diagnostics; using Flowframes.Data; using Flowframes.Media; -using Microsoft.VisualBasic.Logging; using Flowframes.MiscUtils; using Flowframes.Os; @@ -43,7 +42,7 @@ namespace Flowframes.Main return; } - if (IoUtils.GetAmountOfFiles(path, false, "*" + I.current.interpExt) <= 1) + if (IoUtils.GetAmountOfFiles(path, false, "*.*" + I.current.interpExt) <= 1) { I.Cancel("Output folder does not contain frames - An error must have occured during interpolation!", AiProcess.hasShownError); return; @@ -82,7 +81,6 @@ namespace Flowframes.Main bool fpsLimit = maxFps.GetFloat() > 0f && I.current.outFps.GetFloat() > maxFps.GetFloat(); bool dontEncodeFullFpsVid = fpsLimit && Config.GetInt(Config.Key.maxFpsMode) == 0; string framesFile = Path.Combine(framesPath.GetParentDir(), Paths.GetFrameOrderFilename(I.current.interpFactor)); - if (!dontEncodeFullFpsVid) { diff --git a/Code/Media/FfmpegEncode.cs b/Code/Media/FfmpegEncode.cs index 5fd1efc..39c9df2 100644 --- a/Code/Media/FfmpegEncode.cs +++ b/Code/Media/FfmpegEncode.cs @@ -80,6 +80,7 @@ namespace Flowframes.Media string rate = fps.ToString().Replace(",", "."); string vf = (resampleFps.GetFloat() < 0.1f) ? "" : $"-vf fps=fps={resampleFps}"; string compression = format == "png" ? pngCompr : "-q:v 1"; + string codec = format.ToLower() == "webp" ? "-c:v libwebp" : ""; // Specify libwebp to avoid putting all frames into single AWEBP string args = $"-vsync 0 -r {rate} {inArg} {compression} {vf} \"{outDir}/%{Padding.interpFrames}d.{format}\""; await RunFfmpeg(args, framesFile.GetParentDir(), logMode, "error", TaskType.Encode, true); IoUtils.TryDeleteIfExists(linksDir);