From 0160ca224004b7165638a2ab01ac4cff05da4361 Mon Sep 17 00:00:00 2001 From: N00MKRAD Date: Sun, 3 Jan 2021 21:00:32 +0100 Subject: [PATCH] Fixed AutoEncode with new vfr file layout --- Code/AudioVideo/FFmpegCommands.cs | 5 +++-- Code/Main/CreateVideo.cs | 4 +--- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Code/AudioVideo/FFmpegCommands.cs b/Code/AudioVideo/FFmpegCommands.cs index e72a18b..a8178f2 100644 --- a/Code/AudioVideo/FFmpegCommands.cs +++ b/Code/AudioVideo/FFmpegCommands.cs @@ -38,16 +38,17 @@ namespace Flowframes await VideoToFrames(inputFile, frameFolderPath, deDupe, delSrc, new Size(), timecodes); } + //public enum TimecodeMode { None, Consecutive, Realtime } public static async Task VideoToFrames(string inputFile, string frameFolderPath, bool deDupe, bool delSrc, Size size, bool timecodes = true, bool sceneDetect = false) { if (!sceneDetect) Logger.Log("Extracting video frames from input video..."); string sizeStr = (size.Width > 1 && size.Height > 1) ? $"-s {size.Width}x{size.Height}" : ""; IOUtils.CreateDir(frameFolderPath); - string timecodeStr = timecodes ? $"-copyts -r {FrameTiming.timebase} -frame_pts true" : ""; + string timecodeStr = timecodes ? $"-copyts -r {FrameTiming.timebase} -frame_pts true" : "-copyts -frame_pts true"; string scnDetect = sceneDetect ? $"\"select='gt(scene,{Config.GetFloatString("scnDetectValue")})'\"" : ""; string mpStr = deDupe ? ((Config.GetInt("mpdecimateMode") == 0) ? mpDecDef : mpDecAggr) : ""; string fpsFilter = $"\"fps=fps={Interpolate.current.inFps.ToString().Replace(",", ".")}\""; - string filters = FormatUtils.ConcatStrings(new string[] { scnDetect, mpStr, fpsFilter } ); + string filters = FormatUtils.ConcatStrings(new string[] { scnDetect, mpStr/*, fpsFilter*/ } ); string vf = filters.Length > 2 ? $"-vf {filters}" : ""; string pad = Padding.inputFrames.ToString(); string args = $"-i {inputFile.Wrap()} {pngComprArg} -vsync 0 -pix_fmt rgb24 {timecodeStr} {vf} {sizeStr} \"{frameFolderPath}/%{pad}d.png\""; diff --git a/Code/Main/CreateVideo.cs b/Code/Main/CreateVideo.cs index 80befad..6ef68e8 100644 --- a/Code/Main/CreateVideo.cs +++ b/Code/Main/CreateVideo.cs @@ -73,8 +73,6 @@ namespace Flowframes.Main string vfrFile = Path.Combine(framesPath.GetParentDir(), $"vfr-{i.current.interpFactor}x.ini"); string[] vfrLines = IOUtils.ReadLines(vfrFile); - string currentInterpExt = $".{InterpolateUtils.GetOutExt()}"; - vfrLines = vfrLines.Where(x => x.Contains(currentInterpExt)).ToArray(); // Remove duration lines, leaving only filename lines for (int idx = 1; idx <= vfrLines.Length; idx++) { @@ -183,7 +181,7 @@ namespace Flowframes.Main { string vfrFileOriginal = Path.Combine(i.current.tempFolder, $"vfr-{i.current.interpFactor}x.ini"); string vfrFile = Path.Combine(i.current.tempFolder, $"vfr-chunk-{firstFrameNum}-{firstFrameNum + framesAmount}.ini"); - File.WriteAllLines(vfrFile, IOUtils.ReadLines(vfrFileOriginal).Skip(firstFrameNum * 2).Take(framesAmount * 2)); + File.WriteAllLines(vfrFile, IOUtils.ReadLines(vfrFileOriginal).Skip(firstFrameNum).Take(framesAmount)); await FFmpegCommands.FramesToVideoConcat(vfrFile, outPath, mode, i.current.outFps, AvProcess.LogMode.Hidden, true); }