mirror of https://github.com/n00mkrad/flowframes
Image sequence input fixes, allow TIFF and EXR inputs, EXR half option
This commit is contained in:
parent
a79aa11100
commit
ee787cac0d
|
@ -26,6 +26,7 @@
|
|||
public enum JpegWebm { ImgMax, ImgHigh, ImgMed, ImgLow, ImgLowest }
|
||||
public enum ProResProfile { Proxy, Lt, Standard, Hq, Quad4, Quad4Xq }
|
||||
public enum GifColors { Max256, High128, Medium64, Low32, VeryLow16 }
|
||||
public enum ExrPrecision { Float, Half }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,8 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Flowframes.Data
|
||||
namespace Flowframes.Data
|
||||
{
|
||||
class Filetypes
|
||||
{
|
||||
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);
|
||||
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);
|
||||
Logger.Log($"ffprobe -v {settings.LogLevel} {settings.Args}", true, false, "ffmpeg");
|
||||
Logger.Log($"ffprobe {args}", true, false, "ffmpeg");
|
||||
|
||||
if (!asyncOutput)
|
||||
return await Task.Run(() => OsUtils.GetProcStdOut(ffprobe));
|
||||
|
|
|
@ -202,37 +202,40 @@ namespace Flowframes.Media
|
|||
int sampleCount = Config.GetInt(Config.Key.imgSeqSampleCount, 10);
|
||||
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 (!allSameSize)
|
||||
if(files.All(f => f != null))
|
||||
{
|
||||
Logger.Log($"Sequence not compatible: Not all images have the same dimensions.", true);
|
||||
return false;
|
||||
}
|
||||
bool allSameSize = randomSamples.All(i => i.Size == randomSamples.First().Size);
|
||||
|
||||
int div = GetModulo();
|
||||
bool allDivBy2 = randomSamples.All(i => (i.Width % div == 0) && (i.Height % div == 0));
|
||||
if (!allSameSize)
|
||||
{
|
||||
Logger.Log($"Sequence not compatible: Not all images have the same dimensions.", true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!allDivBy2)
|
||||
{
|
||||
Logger.Log($"Sequence not compatible: Not all image dimensions are divisible by {div}.", true);
|
||||
return false;
|
||||
}
|
||||
int div = GetModulo();
|
||||
bool allDivBy2 = randomSamples.All(i => (i.Width % div == 0) && (i.Height % div == 0));
|
||||
|
||||
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)
|
||||
{
|
||||
Logger.Log($"Sequence not compatible: Image dimensions above max size.", true);
|
||||
return false;
|
||||
}
|
||||
bool allSmallEnough = randomSamples.All(i => (i.Height <= maxHeight));
|
||||
|
||||
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)
|
||||
{
|
||||
Logger.Log($"Sequence not compatible: Some images are not 24-bit (8bpp).", true);
|
||||
return false;
|
||||
// bool all24Bit = randomSamples.All(i => (i.PixelFormat == System.Drawing.Imaging.PixelFormat.Format24bppRgb));
|
||||
//
|
||||
// if (!all24Bit)
|
||||
// {
|
||||
// Logger.Log($"Sequence not compatible: Some images are not 24-bit (8bpp).", true);
|
||||
// return false;
|
||||
// }
|
||||
}
|
||||
|
||||
Interpolate.currentSettings.framesExt = files.First().Extension;
|
||||
|
|
|
@ -358,6 +358,11 @@ namespace Flowframes.Media
|
|||
args.Add($"-q:v {OutputUtils.WebpQuality[qualityLevel]}");
|
||||
}
|
||||
|
||||
if (enc == Encoder.Exr)
|
||||
{
|
||||
args.Add($"-format {settings.Quality.Lower()}");
|
||||
}
|
||||
|
||||
if (pixFmt != (PixelFormat)(-1))
|
||||
args.Add($"-pix_fmt {pixFmt.ToString().Lower()}");
|
||||
|
||||
|
|
|
@ -87,7 +87,14 @@ namespace Flowframes.MiscUtils
|
|||
{
|
||||
try
|
||||
{
|
||||
if (timestamp.IsEmpty() || timestamp == "N/A")
|
||||
return 0;
|
||||
|
||||
string[] values = timestamp.Split(':');
|
||||
|
||||
if (values.Length < 3)
|
||||
return 0;
|
||||
|
||||
int hours = int.Parse(values[0]);
|
||||
int minutes = int.Parse(values[1]);
|
||||
int seconds = int.Parse(values[2].Split('.')[0]);
|
||||
|
|
|
@ -291,7 +291,9 @@ namespace Flowframes.MiscUtils
|
|||
Codec = Codec.Exr,
|
||||
PixelFormats = new List<PixFmt>() { PixFmt.Gbrpf32Le, PixFmt.Gbrapf32Le },
|
||||
PixelFormatDefault = PixFmt.Gbrpf32Le,
|
||||
Lossless = true,
|
||||
QualityLevels = ParseUtils.GetEnumStrings<Quality.ExrPrecision>(),
|
||||
QualityDefault = (int)Quality.ExrPrecision.Half,
|
||||
Lossless = false,
|
||||
IsImageSequence = true,
|
||||
OverideExtension = "exr",
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue