mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-16 08:27:44 +01:00
Image sequence input fixes, allow TIFF and EXR inputs, EXR half option
This commit is contained in:
@@ -26,6 +26,7 @@
|
|||||||
public enum JpegWebm { ImgMax, ImgHigh, ImgMed, ImgLow, ImgLowest }
|
public enum JpegWebm { ImgMax, ImgHigh, ImgMed, ImgLow, ImgLowest }
|
||||||
public enum ProResProfile { Proxy, Lt, Standard, Hq, Quad4, Quad4Xq }
|
public enum ProResProfile { Proxy, Lt, Standard, Hq, Quad4, Quad4Xq }
|
||||||
public enum GifColors { Max256, High128, Medium64, Low32, VeryLow16 }
|
public enum GifColors { Max256, High128, Medium64, Low32, VeryLow16 }
|
||||||
|
public enum ExrPrecision { Float, Half }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,14 +1,8 @@
|
|||||||
using System;
|
namespace Flowframes.Data
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace Flowframes.Data
|
|
||||||
{
|
{
|
||||||
class Filetypes
|
class Filetypes
|
||||||
{
|
{
|
||||||
public static readonly string[] imagesOpenCv = new string[] { ".png", ".jpg", ".jpeg", ".webp", ".bmp", ".tif", ".tiff" };
|
public static readonly string[] imagesOpenCv = new string[] { ".png", ".jpg", ".jpeg", ".webp", ".bmp", ".tif", ".tiff" };
|
||||||
public static readonly string[] imagesInterpCompat = new string[] { ".png", ".jpg", ".jpeg", ".webp", ".bmp" };
|
public static readonly string[] imagesInterpCompat = new string[] { ".png", ".jpg", ".jpeg", ".webp", ".bmp", ".tif", ".tiff", ".exr" };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -150,10 +150,12 @@ namespace Flowframes
|
|||||||
Process ffprobe = OsUtils.NewProcess(!show);
|
Process ffprobe = OsUtils.NewProcess(!show);
|
||||||
NmkdStopwatch timeSinceLastOutput = new NmkdStopwatch();
|
NmkdStopwatch timeSinceLastOutput = new NmkdStopwatch();
|
||||||
|
|
||||||
ffprobe.StartInfo.Arguments = $"{GetCmdArg()} cd /D {GetAvDir().Wrap()} & ffprobe -v {settings.LogLevel} {settings.Args}";
|
bool concat = settings.Args.Split(" \"").Last().Remove("\"").Trim().EndsWith(".concat");
|
||||||
|
string args = $"-v {settings.LogLevel} {(concat ? "-f concat -safe 0 " : "")}{settings.Args}";
|
||||||
|
ffprobe.StartInfo.Arguments = $"{GetCmdArg()} cd /D {GetAvDir().Wrap()} & ffprobe {args}";
|
||||||
|
|
||||||
if (settings.LoggingMode != LogMode.Hidden) Logger.Log("Running FFprobe...", false);
|
if (settings.LoggingMode != LogMode.Hidden) Logger.Log("Running FFprobe...", false);
|
||||||
Logger.Log($"ffprobe -v {settings.LogLevel} {settings.Args}", true, false, "ffmpeg");
|
Logger.Log($"ffprobe {args}", true, false, "ffmpeg");
|
||||||
|
|
||||||
if (!asyncOutput)
|
if (!asyncOutput)
|
||||||
return await Task.Run(() => OsUtils.GetProcStdOut(ffprobe));
|
return await Task.Run(() => OsUtils.GetProcStdOut(ffprobe));
|
||||||
|
|||||||
@@ -202,37 +202,40 @@ namespace Flowframes.Media
|
|||||||
int sampleCount = Config.GetInt(Config.Key.imgSeqSampleCount, 10);
|
int sampleCount = Config.GetInt(Config.Key.imgSeqSampleCount, 10);
|
||||||
Image[] randomSamples = files.OrderBy(arg => Guid.NewGuid()).Take(sampleCount).Select(x => IoUtils.GetImage(x.FullName)).ToArray();
|
Image[] randomSamples = files.OrderBy(arg => Guid.NewGuid()).Take(sampleCount).Select(x => IoUtils.GetImage(x.FullName)).ToArray();
|
||||||
|
|
||||||
bool allSameSize = randomSamples.All(i => i.Size == randomSamples.First().Size);
|
if(files.All(f => f != null))
|
||||||
|
|
||||||
if (!allSameSize)
|
|
||||||
{
|
{
|
||||||
Logger.Log($"Sequence not compatible: Not all images have the same dimensions.", true);
|
bool allSameSize = randomSamples.All(i => i.Size == randomSamples.First().Size);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
int div = GetModulo();
|
if (!allSameSize)
|
||||||
bool allDivBy2 = randomSamples.All(i => (i.Width % div == 0) && (i.Height % div == 0));
|
{
|
||||||
|
Logger.Log($"Sequence not compatible: Not all images have the same dimensions.", true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!allDivBy2)
|
int div = GetModulo();
|
||||||
{
|
bool allDivBy2 = randomSamples.All(i => (i.Width % div == 0) && (i.Height % div == 0));
|
||||||
Logger.Log($"Sequence not compatible: Not all image dimensions are divisible by {div}.", true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool allSmallEnough = randomSamples.All(i => (i.Height <= maxHeight));
|
if (!allDivBy2)
|
||||||
|
{
|
||||||
|
Logger.Log($"Sequence not compatible: Not all image dimensions are divisible by {div}.", true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!allSmallEnough)
|
bool allSmallEnough = randomSamples.All(i => (i.Height <= maxHeight));
|
||||||
{
|
|
||||||
Logger.Log($"Sequence not compatible: Image dimensions above max size.", true);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool all24Bit = randomSamples.All(i => (i.PixelFormat == System.Drawing.Imaging.PixelFormat.Format24bppRgb));
|
if (!allSmallEnough)
|
||||||
|
{
|
||||||
|
Logger.Log($"Sequence not compatible: Image dimensions above max size.", true);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (!all24Bit)
|
// bool all24Bit = randomSamples.All(i => (i.PixelFormat == System.Drawing.Imaging.PixelFormat.Format24bppRgb));
|
||||||
{
|
//
|
||||||
Logger.Log($"Sequence not compatible: Some images are not 24-bit (8bpp).", true);
|
// if (!all24Bit)
|
||||||
return false;
|
// {
|
||||||
|
// Logger.Log($"Sequence not compatible: Some images are not 24-bit (8bpp).", true);
|
||||||
|
// return false;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
Interpolate.currentSettings.framesExt = files.First().Extension;
|
Interpolate.currentSettings.framesExt = files.First().Extension;
|
||||||
|
|||||||
@@ -358,6 +358,11 @@ namespace Flowframes.Media
|
|||||||
args.Add($"-q:v {OutputUtils.WebpQuality[qualityLevel]}");
|
args.Add($"-q:v {OutputUtils.WebpQuality[qualityLevel]}");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (enc == Encoder.Exr)
|
||||||
|
{
|
||||||
|
args.Add($"-format {settings.Quality.Lower()}");
|
||||||
|
}
|
||||||
|
|
||||||
if (pixFmt != (PixelFormat)(-1))
|
if (pixFmt != (PixelFormat)(-1))
|
||||||
args.Add($"-pix_fmt {pixFmt.ToString().Lower()}");
|
args.Add($"-pix_fmt {pixFmt.ToString().Lower()}");
|
||||||
|
|
||||||
|
|||||||
@@ -87,7 +87,14 @@ namespace Flowframes.MiscUtils
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (timestamp.IsEmpty() || timestamp == "N/A")
|
||||||
|
return 0;
|
||||||
|
|
||||||
string[] values = timestamp.Split(':');
|
string[] values = timestamp.Split(':');
|
||||||
|
|
||||||
|
if (values.Length < 3)
|
||||||
|
return 0;
|
||||||
|
|
||||||
int hours = int.Parse(values[0]);
|
int hours = int.Parse(values[0]);
|
||||||
int minutes = int.Parse(values[1]);
|
int minutes = int.Parse(values[1]);
|
||||||
int seconds = int.Parse(values[2].Split('.')[0]);
|
int seconds = int.Parse(values[2].Split('.')[0]);
|
||||||
|
|||||||
@@ -291,7 +291,9 @@ namespace Flowframes.MiscUtils
|
|||||||
Codec = Codec.Exr,
|
Codec = Codec.Exr,
|
||||||
PixelFormats = new List<PixFmt>() { PixFmt.Gbrpf32Le, PixFmt.Gbrapf32Le },
|
PixelFormats = new List<PixFmt>() { PixFmt.Gbrpf32Le, PixFmt.Gbrapf32Le },
|
||||||
PixelFormatDefault = PixFmt.Gbrpf32Le,
|
PixelFormatDefault = PixFmt.Gbrpf32Le,
|
||||||
Lossless = true,
|
QualityLevels = ParseUtils.GetEnumStrings<Quality.ExrPrecision>(),
|
||||||
|
QualityDefault = (int)Quality.ExrPrecision.Half,
|
||||||
|
Lossless = false,
|
||||||
IsImageSequence = true,
|
IsImageSequence = true,
|
||||||
OverideExtension = "exr",
|
OverideExtension = "exr",
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user