mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-23 03:39:26 +01:00
split FFmpegCommands into multiple classes for extraction/encoding
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user