split FFmpegCommands into multiple classes for extraction/encoding

This commit is contained in:
N00MKRAD
2021-02-01 16:23:35 +01:00
parent 3ef99c839e
commit 81a158e44f
10 changed files with 211 additions and 171 deletions

View File

@@ -1,4 +1,5 @@
using Flowframes.IO;
using Flowframes.AudioVideo;
using Flowframes.IO;
using Flowframes.Magick;
using Flowframes.Main;
using Flowframes.OS;
@@ -105,7 +106,7 @@ namespace Flowframes.UI
{
if (!IOUtils.IsPathDirectory(path)) // If path is video - Extract first frame
{
await FFmpegCommands.ExtractSingleFrame(path, imgOnDisk, 1);
await FfmpegExtract.ExtractSingleFrame(path, imgOnDisk, 1);
return IOUtils.GetImage(imgOnDisk);
}
else // Path is frame folder - Get first frame

View File

@@ -1,4 +1,5 @@
using Flowframes.IO;
using Flowframes.AudioVideo;
using Flowframes.IO;
using Flowframes.Magick;
using Flowframes.Main;
using System;
@@ -18,7 +19,7 @@ namespace Flowframes.UI
{
string outPath = Path.ChangeExtension(videoPath, null) + "-extracted";
Program.mainForm.SetWorking(true);
await FFmpegCommands.VideoToFrames(videoPath, Path.Combine(outPath, Paths.framesDir), false, Interpolate.current.inFps, false, false, false);
await FfmpegExtract.VideoToFrames(videoPath, Path.Combine(outPath, Paths.framesDir), false, Interpolate.current.inFps, false, false, false);
File.WriteAllText(Path.Combine(outPath, "fps.ini"), Interpolate.current.inFps.ToString());
if (withAudio)
await FFmpegCommands.ExtractAudio(videoPath, Path.Combine(outPath, "audio"));
@@ -56,9 +57,9 @@ namespace Flowframes.UI
int crf = crfBox.GetInt();
Logger.Log("Creating MP4 with CRF " + crf + "...", true);
if(Path.GetExtension(inputFile).ToUpper() != ".MP4")
await FFmpegCommands.Encode(inputFile, "libx264", "aac", crf, 128);
await FfmpegEncode.Encode(inputFile, "libx264", "aac", crf, 128);
else
await FFmpegCommands.Encode(inputFile, "libx264", "copy", crf); // Copy audio if input is MP4
await FfmpegEncode.Encode(inputFile, "libx264", "copy", crf); // Copy audio if input is MP4
Logger.Log("Done", true);
Program.mainForm.SetProgress(0);
}