mirror of
https://github.com/n00mkrad/flowframes.git
synced 2025-12-16 08:27:44 +01:00
Add EXR output support (BRG/BRGA 32-bit float)
This commit is contained in:
@@ -5,18 +5,19 @@
|
||||
public class Output
|
||||
{
|
||||
public enum Format { Mp4, Mkv, Webm, Mov, Avi, Gif, Images, Realtime };
|
||||
public enum ImageFormat { Png, Jpeg, Webp, Tiff };
|
||||
public enum ImageFormat { Png, Jpeg, Webp, Tiff, Exr };
|
||||
public enum Dithering { None, Bayer, FloydSteinberg };
|
||||
}
|
||||
|
||||
public class Encoding
|
||||
{
|
||||
public enum Codec { H264, H265, AV1, VP9, ProRes, Gif, Png, Jpeg, Webp, Tiff, Ffv1, Huffyuv, Magicyuv, Rawvideo }
|
||||
public enum Encoder { X264, X265, SvtAv1, VpxVp9, Nvenc264, Nvenc265, NvencAv1, Amf264, Amf265, Qsv264, Qsv265, ProResKs, Gif, Png, Jpeg, Webp, Tiff, Ffv1, Huffyuv, Magicyuv, Rawvideo }
|
||||
public enum Codec { H264, H265, AV1, VP9, ProRes, Gif, Png, Jpeg, Webp, Tiff, Exr, Ffv1, Huffyuv, Magicyuv, Rawvideo }
|
||||
public enum Encoder { X264, X265, SvtAv1, VpxVp9, Nvenc264, Nvenc265, NvencAv1, Amf264, Amf265, Qsv264, Qsv265, ProResKs, Gif, Png, Jpeg, Webp, Tiff, Exr, Ffv1, Huffyuv, Magicyuv, Rawvideo }
|
||||
public enum PixelFormat
|
||||
{
|
||||
Yuv420P, Yuva420P, Yuv420P10Le, Yuv422P, Yuv422P10Le, Yuv444P, Yuv444P10Le, Yuva444P10Le, Yuv444P12Le, Yuv444P16Le, P010Le, P016Le, // YUV & similar
|
||||
Rgb24, Rgba, Rgb48Le, Rgb48Be, Rgba64Le, Rgba64Be, Pal8 // RGB & other
|
||||
Rgb24, Rgba, Rgb48Le, Rgb48Be, Rgba64Le, Rgba64Be, Pal8, // RGB & other
|
||||
Gbrpf32Le, Gbrapf32Le, // Float
|
||||
};
|
||||
|
||||
public class Quality
|
||||
|
||||
@@ -35,6 +35,7 @@ namespace Flowframes.Data
|
||||
{ Enums.Encoding.Encoder.Jpeg.ToString(), "JPEG" },
|
||||
{ Enums.Encoding.Encoder.Webp.ToString(), "WEBP" },
|
||||
{ Enums.Encoding.Encoder.Tiff.ToString(), "TIFF" },
|
||||
{ Enums.Encoding.Encoder.Exr.ToString(), "EXR" },
|
||||
{ Enums.Encoding.Encoder.Ffv1.ToString(), "FFV1" },
|
||||
{ Enums.Encoding.Encoder.Huffyuv.ToString(), "HuffYUV" },
|
||||
{ Enums.Encoding.Encoder.Magicyuv.ToString(), "MagicYUV" },
|
||||
@@ -60,6 +61,8 @@ namespace Flowframes.Data
|
||||
{ Enums.Encoding.PixelFormat.Rgba64Le.ToString(), "RGBA 16-bit LE" },
|
||||
{ Enums.Encoding.PixelFormat.Rgba64Be.ToString(), "RGBA 16-bit BE" },
|
||||
{ Enums.Encoding.PixelFormat.Pal8.ToString(), "256-color Palette" },
|
||||
{ Enums.Encoding.PixelFormat.Gbrpf32Le.ToString(), "RGB 32-bit Float" },
|
||||
{ Enums.Encoding.PixelFormat.Gbrapf32Le.ToString(), "RGBA 32-bit Float" },
|
||||
};
|
||||
|
||||
public static Dictionary<string, string> VideoQuality = new Dictionary<string, string>
|
||||
|
||||
@@ -506,6 +506,11 @@ namespace Flowframes.IO
|
||||
TryDeleteIfExists(path);
|
||||
return true;
|
||||
}
|
||||
else if (Directory.Exists(path) && GetDirSize(path, true) < thresholdKb)
|
||||
{
|
||||
TryDeleteIfExists(path);
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -89,6 +89,12 @@ namespace Flowframes.Main
|
||||
string extraArgsIn = await FfmpegEncode.GetFfmpegExportArgsIn(s.outFps, s.outItsScale);
|
||||
string extraArgsOut = await FfmpegEncode.GetFfmpegExportArgsOut(fpsLimit ? maxFps : new Fraction(), extraData, s.outSettings);
|
||||
|
||||
if(s.outSettings.Encoder == Enums.Encoding.Encoder.Exr)
|
||||
{
|
||||
extraArgsIn += " -color_trc bt709 -color_primaries bt709 -colorspace bt709";
|
||||
}
|
||||
|
||||
|
||||
if (ffplay)
|
||||
{
|
||||
bool useNutPipe = true; // TODO: Make this bool a config flag
|
||||
|
||||
@@ -89,6 +89,10 @@ namespace Flowframes.Media
|
||||
filters.Add(paletteFilter);
|
||||
}
|
||||
}
|
||||
else if (settings.Encoder == Enums.Encoding.Encoder.Exr)
|
||||
{
|
||||
filters.Add($"zscale=transfer=linear,format={settings.PixelFormat.ToString().Lower()}".Wrap());
|
||||
}
|
||||
|
||||
filters.Add(GetPadFilter());
|
||||
filters = filters.Where(f => f.IsNotEmpty()).ToList();
|
||||
|
||||
@@ -284,6 +284,19 @@ namespace Flowframes.MiscUtils
|
||||
};
|
||||
}
|
||||
|
||||
if (encoder == Encoder.Exr)
|
||||
{
|
||||
return new EncoderInfoVideo
|
||||
{
|
||||
Codec = Codec.Exr,
|
||||
PixelFormats = new List<PixFmt>() { PixFmt.Gbrpf32Le, PixFmt.Gbrapf32Le },
|
||||
PixelFormatDefault = PixFmt.Gbrpf32Le,
|
||||
Lossless = true,
|
||||
IsImageSequence = true,
|
||||
OverideExtension = "exr",
|
||||
};
|
||||
}
|
||||
|
||||
return new EncoderInfoVideo();
|
||||
}
|
||||
|
||||
@@ -297,7 +310,7 @@ namespace Flowframes.MiscUtils
|
||||
case Enums.Output.Format.Mov: return new List<Codec> { Codec.ProRes, Codec.H264 };
|
||||
case Enums.Output.Format.Avi: return new List<Codec> { Codec.Ffv1, Codec.Huffyuv, Codec.Magicyuv, Codec.Rawvideo };
|
||||
case Enums.Output.Format.Gif: return new List<Codec> { Codec.Gif };
|
||||
case Enums.Output.Format.Images: return new List<Codec> { Codec.Png, Codec.Jpeg, Codec.Webp, Codec.Tiff };
|
||||
case Enums.Output.Format.Images: return new List<Codec> { Codec.Png, Codec.Jpeg, Codec.Webp, Codec.Tiff, Codec.Exr };
|
||||
case Enums.Output.Format.Realtime: return new List<Codec> { };
|
||||
default: return new List<Codec> { };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user