VP9/ProRes/AVI export, support for custom ffmpeg enc args

This commit is contained in:
N00MKRAD
2020-12-23 16:13:04 +01:00
parent a1b08b71ba
commit 006706ee73
13 changed files with 219 additions and 98 deletions

View File

@@ -69,7 +69,7 @@ namespace Flowframes.Main
string outpath = Path.Combine(videoChunksFolder, $"{videoIndex.ToString().PadLeft(4, '0')}{InterpolateUtils.GetExt(Interpolate.current.outMode)}");
int firstFrameNum = Path.GetFileNameWithoutExtension(framesToEncode[0]).GetInt();
await CreateVideo.EncodeChunk(outpath, firstFrameNum - 1, framesToEncode.Count);
await CreateVideo.EncodeChunk(outpath, Interpolate.current.outMode, firstFrameNum - 1, framesToEncode.Count);
if(Interpolate.canceled) return;

View File

@@ -48,7 +48,7 @@ namespace Flowframes.Main
int maxFps = Config.GetInt("maxFps");
if (maxFps == 0) maxFps = 500;
if (mode == i.OutMode.VidMp4 && i.current.outFps > maxFps)
if (i.current.outFps > maxFps)
await Encode(mode, path, outPath, i.current.outFps, maxFps, (Config.GetInt("maxFpsMode") == 1));
else
await Encode(mode, path, outPath, i.current.outFps);
@@ -102,15 +102,16 @@ namespace Flowframes.Main
string vfrFile = Path.Combine(framesPath.GetParentDir(), $"vfr-{i.current.interpFactor}x.ini");
if (mode == i.OutMode.VidGif)
{
await FFmpegCommands.FramesToGifVfr(vfrFile, outPath, true, Config.GetInt("gifColors"));
if (mode == i.OutMode.VidMp4)
}
else
{
int looptimes = GetLoopTimes();
bool h265 = Config.GetInt("mp4Enc") == 1;
int crf = h265 ? Config.GetInt("h265Crf") : Config.GetInt("h264Crf");
await FFmpegCommands.FramesToMp4Vfr(vfrFile, outPath, h265, crf, fps);
await FFmpegCommands.FramesToVideoVfr(vfrFile, outPath, mode, fps);
await MergeAudio(i.current.inPath, outPath);
if (changeFps > 0)
@@ -177,7 +178,7 @@ namespace Flowframes.Main
}
}
public static async Task EncodeChunk(string outPath, int firstFrameNum, int framesAmount)
public static async Task EncodeChunk(string outPath, i.OutMode mode, int firstFrameNum, int framesAmount)
{
bool h265 = Config.GetInt("mp4Enc") == 1;
int crf = h265 ? Config.GetInt("h265Crf") : Config.GetInt("h264Crf");
@@ -186,7 +187,7 @@ namespace Flowframes.Main
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));
await FFmpegCommands.FramesToMp4Vfr(vfrFile, outPath, h265, crf, i.current.outFps, AvProcess.LogMode.Hidden);
await FFmpegCommands.FramesToVideoVfr(vfrFile, outPath, mode, i.current.outFps, AvProcess.LogMode.Hidden);
}
static async Task Loop(string outPath, int looptimes)

View File

@@ -21,7 +21,7 @@ namespace Flowframes
{
public class Interpolate
{
public enum OutMode { VidMp4, VidGif, ImgPng }
public enum OutMode { VidMp4, VidWebm, VidProRes, VidAviRaw, VidGif, ImgPng }
public static int currentInputFrameCount;
public static bool currentlyUsingAutoEnc;

View File

@@ -332,6 +332,8 @@ namespace Flowframes.Main
continue;
int sourceIndexForScnFrame = sourceFrames.IndexOf(scnFrame); // Get source index of scene frame
if ((sourceIndexForScnFrame + 1) == sourceFrames.Count)
continue;
string followingFrame = sourceFrames[sourceIndexForScnFrame + 1]; // Get filename/timestamp of the next source frame
if (sceneFrames.Contains(followingFrame)) // If next source frame is in scene folder, add to deletion list