mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-25 20:59:39 +01:00
Merge branch 'main' into main
This commit is contained in:
@@ -224,7 +224,7 @@ namespace Flowframes
|
||||
try
|
||||
{
|
||||
string[] lines = info.SplitIntoLines();
|
||||
string lastLine = lines.Last().ToLower();
|
||||
string lastLine = lines.Last().ToLowerInvariant();
|
||||
return lastLine.Substring(0, lastLine.IndexOf("fps")).GetInt();
|
||||
}
|
||||
catch
|
||||
@@ -245,7 +245,7 @@ namespace Flowframes
|
||||
Logger.Log($"IsEncoderCompatible('{enc}')", true, false, "ffmpeg");
|
||||
string args = $"-loglevel error -f lavfi -i color=black:s=540x540 -vframes 1 -an -c:v {enc} -f null -";
|
||||
string output = await RunFfmpeg(args, LogMode.Hidden);
|
||||
return !output.ToLower().Contains("error");
|
||||
return !output.ToLowerInvariant().Contains("error");
|
||||
}
|
||||
|
||||
public static string GetAudioCodec(string path, int streamIndex = -1)
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace Flowframes.Media
|
||||
Directory.CreateDirectory(outDir);
|
||||
string inArg = $"-f concat -i {Path.GetFileName(framesFile)}";
|
||||
string linksDir = Path.Combine(framesFile + Paths.symlinksSuffix);
|
||||
format = format.ToLower();
|
||||
format = format.ToLowerInvariant();
|
||||
|
||||
if (Config.GetBool(Config.Key.allowSymlinkEncoding, true) && Symlinks.SymlinksAllowed())
|
||||
{
|
||||
|
||||
@@ -44,7 +44,7 @@ namespace Flowframes.Media
|
||||
|
||||
static string GetImgArgs(string extension, bool includePixFmt = true, bool alpha = false)
|
||||
{
|
||||
extension = extension.ToLower().Remove(".").Replace("jpeg", "jpg");
|
||||
extension = extension.ToLowerInvariant().Remove(".").Replace("jpeg", "jpg");
|
||||
string pixFmt = "-pix_fmt rgb24";
|
||||
string args = "";
|
||||
|
||||
@@ -278,7 +278,7 @@ namespace Flowframes.Media
|
||||
public static async Task ImportSingleImage(string inputFile, string outPath, Size size)
|
||||
{
|
||||
string sizeStr = (size.Width > 1 && size.Height > 1) ? $"-s {size.Width}x{size.Height}" : "";
|
||||
bool isPng = (Path.GetExtension(outPath).ToLower() == ".png");
|
||||
bool isPng = (Path.GetExtension(outPath).ToLowerInvariant() == ".png");
|
||||
string comprArg = isPng ? pngCompr : "";
|
||||
string pixFmt = "-pix_fmt " + (isPng ? $"rgb24 {comprArg}" : "yuvj420p");
|
||||
string args = $"-i {inputFile.Wrap()} {comprArg} {sizeStr} {pixFmt} -vf {GetPadFilter()} {outPath.Wrap()}";
|
||||
@@ -287,7 +287,7 @@ namespace Flowframes.Media
|
||||
|
||||
public static async Task ExtractSingleFrame(string inputFile, string outputPath, int frameNum)
|
||||
{
|
||||
bool isPng = (Path.GetExtension(outputPath).ToLower() == ".png");
|
||||
bool isPng = (Path.GetExtension(outputPath).ToLowerInvariant() == ".png");
|
||||
string comprArg = isPng ? pngCompr : "";
|
||||
string pixFmt = "-pix_fmt " + (isPng ? $"rgb24 {comprArg}" : "yuvj420p");
|
||||
string args = $"-i {inputFile.Wrap()} -vf \"select=eq(n\\,{frameNum})\" -vframes 1 {pixFmt} {outputPath.Wrap()}";
|
||||
@@ -302,7 +302,7 @@ namespace Flowframes.Media
|
||||
if (IoUtils.IsPathDirectory(outputPath))
|
||||
outputPath = Path.Combine(outputPath, "last.png");
|
||||
|
||||
bool isPng = (Path.GetExtension(outputPath).ToLower() == ".png");
|
||||
bool isPng = (Path.GetExtension(outputPath).ToLowerInvariant() == ".png");
|
||||
string comprArg = isPng ? pngCompr : "";
|
||||
string pixFmt = "-pix_fmt " + (isPng ? $"rgb24 {comprArg}" : "yuvj420p");
|
||||
string sizeStr = (size.Width > 1 && size.Height > 1) ? $"-s {size.Width}x{size.Height}" : "";
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace Flowframes.Media
|
||||
string title = await GetFfprobeInfoAsync(path, showStreams, "TAG:title", idx);
|
||||
string codec = await GetFfprobeInfoAsync(path, showStreams, "codec_name", idx);
|
||||
string profile = await GetFfprobeInfoAsync(path, showStreams, "profile", idx);
|
||||
if (codec.ToLower() == "dts" && profile != "unknown") codec = profile;
|
||||
if (codec.ToLowerInvariant() == "dts" && profile != "unknown") codec = profile;
|
||||
string codecLong = await GetFfprobeInfoAsync(path, showStreams, "codec_long_name", idx);
|
||||
int kbits = (await GetFfprobeInfoAsync(path, showStreams, "bit_rate", idx)).GetInt() / 1024;
|
||||
int sampleRate = (await GetFfprobeInfoAsync(path, showStreams, "sample_rate", idx)).GetInt();
|
||||
@@ -223,14 +223,14 @@ namespace Flowframes.Media
|
||||
|
||||
if (codec == Codec.H264)
|
||||
{
|
||||
string preset = Config.Get(Config.Key.ffEncPreset).ToLower().Remove(" ");
|
||||
string preset = Config.Get(Config.Key.ffEncPreset).ToLowerInvariant().Remove(" ");
|
||||
string g = GetKeyIntArg(fps, keyint);
|
||||
return new string[] { $"-c:v {GetEnc(codec)} -crf {Config.GetInt(Config.Key.h264Crf)} -preset {preset} {g} -pix_fmt {GetPixFmt()}" };
|
||||
}
|
||||
|
||||
if (codec == Codec.H265)
|
||||
{
|
||||
string preset = Config.Get(Config.Key.ffEncPreset).ToLower().Remove(" ");
|
||||
string preset = Config.Get(Config.Key.ffEncPreset).ToLowerInvariant().Remove(" ");
|
||||
int crf = Config.GetInt(Config.Key.h265Crf);
|
||||
string g = GetKeyIntArg(fps, keyint);
|
||||
return new string[] { $"-c:v {GetEnc(codec)} {(crf > 0 ? $"-crf {crf}" : "-x265-params lossless=1")} -preset {preset} {g} -pix_fmt {GetPixFmt()}" };
|
||||
@@ -318,7 +318,7 @@ namespace Flowframes.Media
|
||||
|
||||
static string GetVp9Speed()
|
||||
{
|
||||
string preset = Config.Get(Config.Key.ffEncPreset).ToLower().Remove(" ");
|
||||
string preset = Config.Get(Config.Key.ffEncPreset).ToLowerInvariant().Remove(" ");
|
||||
string arg = "";
|
||||
|
||||
if (preset == "veryslow") arg = "0";
|
||||
@@ -334,7 +334,7 @@ namespace Flowframes.Media
|
||||
|
||||
static string GetSvtAv1Speed()
|
||||
{
|
||||
string preset = Config.Get(Config.Key.ffEncPreset).ToLower().Remove(" ");
|
||||
string preset = Config.Get(Config.Key.ffEncPreset).ToLowerInvariant().Remove(" ");
|
||||
string arg = "8";
|
||||
|
||||
if (preset == "veryslow") arg = "3";
|
||||
@@ -499,14 +499,12 @@ namespace Flowframes.Media
|
||||
if (validExtensions == null)
|
||||
validExtensions = new List<string>();
|
||||
|
||||
validExtensions = validExtensions.Select(x => x.Remove(".").ToLower()).ToList(); // Ignore "." in extensions
|
||||
validExtensions = validExtensions.Select(x => x.Remove(".").ToLowerInvariant()).ToList(); // Ignore "." in extensions
|
||||
string concatFileContent = "";
|
||||
string[] files = IoUtils.GetFilesSorted(inputFilesDir);
|
||||
int fileCount = 0;
|
||||
|
||||
if (File.Exists(outputPath)) File.Delete(outputPath);
|
||||
StreamWriter concatFile = new StreamWriter(outputPath, append: true);
|
||||
|
||||
foreach (string file in files.Where(x => validExtensions.Contains(Path.GetExtension(x).Replace(".", "").ToLower())))
|
||||
foreach (string file in files.Where(x => validExtensions.Contains(Path.GetExtension(x).Replace(".", "").ToLowerInvariant())))
|
||||
{
|
||||
fileCount++;
|
||||
concatFile.WriteLine($"file '{file.Replace(@"\", "/")}'\n");
|
||||
|
||||
@@ -79,13 +79,13 @@ namespace Flowframes.Media
|
||||
if (stripKeyName)
|
||||
{
|
||||
|
||||
List<string> filtered = output.SplitIntoLines().Where(x => x.ToLower().Contains(lineFilter.ToLower())).ToList(); // Filter
|
||||
List<string> filtered = output.SplitIntoLines().Where(x => x.ToLowerInvariant().Contains(lineFilter.ToLowerInvariant())).ToList(); // Filter
|
||||
filtered = filtered.Select(x => string.Join("", x.Split('=').Skip(1))).ToList(); // Ignore everything before (and including) the first '=' sign
|
||||
output = string.Join("\n", filtered);
|
||||
}
|
||||
else
|
||||
{
|
||||
output = string.Join("\n", output.SplitIntoLines().Where(x => x.ToLower().Contains(lineFilter.ToLower())).ToArray());
|
||||
output = string.Join("\n", output.SplitIntoLines().Where(x => x.ToLowerInvariant().Contains(lineFilter.ToLowerInvariant())).ToArray());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user