Fix limited range JPEG extraction

This commit is contained in:
N00MKRAD
2024-06-24 17:44:23 +02:00
parent d7dd4d6ec8
commit 4fd6cbf7be

View File

@@ -50,7 +50,6 @@ namespace Flowframes.Media
if (Interpolate.currentMediaFile != null && Interpolate.currentMediaFile.VideoStreams.Any())
{
pixFmt = Interpolate.currentMediaFile.VideoStreams.First().PixelFormat;
pixFmt = SimplifyPixFmt(pixFmt);
}
bool inputHighBitDepth = pixFmt.Contains("p10") || pixFmt.Contains("p16");
@@ -66,12 +65,12 @@ namespace Flowframes.Media
else if (extension == "jpg")
{
// Fallback to YUV420P if not in list of supported formats
if (!new[] { "yuv420p", "yuv422p", "yuv444p" }.Contains(pixFmt))
if (!new[] { "yuv420p", "yuv422p", "yuv444p" }.Contains(pixFmt.Replace("yuvj", "yuv")))
{
pixFmt = "yuv420p";
}
args = $"-q:v 1";
args = $"-q:v 1 -qmin 1 -color_range pc";
}
else if (extension == "tiff")
{
@@ -98,14 +97,6 @@ namespace Flowframes.Media
return args;
}
private static string SimplifyPixFmt (string pixFmt)
{
pixFmt = pixFmt.Lower();
pixFmt = pixFmt.Replace("yuvj", "yuv");
pixFmt = pixFmt.Replace("bgra", "rgba");
return pixFmt;
}
public static async Task VideoToFrames(string inputFile, string framesDir, bool alpha, Fraction rate, bool deDupe, bool delSrc, Size size, string format)
{
Logger.Log("Extracting video frames from input video...");