diff --git a/FileFlows.Plugin.dll b/FileFlows.Plugin.dll
index a4428a90..3fdf83b4 100644
Binary files a/FileFlows.Plugin.dll and b/FileFlows.Plugin.dll differ
diff --git a/FileFlows.Plugin.pdb b/FileFlows.Plugin.pdb
index 01e07fb9..d93b5a53 100644
Binary files a/FileFlows.Plugin.pdb and b/FileFlows.Plugin.pdb differ
diff --git a/VideoNodes/FfmpegBuilderNodes/FfmpegBuilderExecutor.cs b/VideoNodes/FfmpegBuilderNodes/FfmpegBuilderExecutor.cs
index 69259dc4..75c39e99 100644
--- a/VideoNodes/FfmpegBuilderNodes/FfmpegBuilderExecutor.cs
+++ b/VideoNodes/FfmpegBuilderNodes/FfmpegBuilderExecutor.cs
@@ -192,7 +192,14 @@ public class FfmpegBuilderExecutor: FfmpegBuilderNode
var video = this.Model.VideoStreams.FirstOrDefault(x => x.Stream.IsImage == false);
args.Logger?.ILog("Pixel Format: " + (video?.Stream?.PixelFormat?.EmptyAsNull() ?? "Unknown"));
- startArgs.AddRange(GetHardwareDecodingArgs(args, localFile, FFMPEG, video?.Stream?.Codec, video?.Stream?.PixelFormat));
+ bool targetIs10Bit = string.Join(" ", ffArgs).Contains("p010le");
+ string pxtFormat = video?.Stream?.PixelFormat;
+ if (targetIs10Bit && video?.Stream?.Is10Bit == true)
+ pxtFormat = "p010le";
+ if (targetIs10Bit == false && video?.Stream?.Is10Bit == false && video?.Stream?.Is12Bit == false)
+ pxtFormat = "yuv420p";
+
+ startArgs.AddRange(GetHardwareDecodingArgs(args, localFile, FFMPEG, video?.Stream?.Codec, pxtFormat));
}
}
diff --git a/VideoNodes/FfmpegBuilderNodes/Video/FfmpegBuilderVideoEncode/FfmpegBuilderVideoEncode.cs b/VideoNodes/FfmpegBuilderNodes/Video/FfmpegBuilderVideoEncode/FfmpegBuilderVideoEncode.cs
index 966c3120..372c76f5 100644
--- a/VideoNodes/FfmpegBuilderNodes/Video/FfmpegBuilderVideoEncode/FfmpegBuilderVideoEncode.cs
+++ b/VideoNodes/FfmpegBuilderNodes/Video/FfmpegBuilderVideoEncode/FfmpegBuilderVideoEncode.cs
@@ -176,15 +176,17 @@ public partial class FfmpegBuilderVideoEncode:FfmpegBuilderNode
stream.EncodingParameters.AddRange(H264(args, false, Quality, encoder, Speed));
stream.Codec = CODEC_H264;
}
- else if (Codec == CODEC_H265 || Codec == CODEC_H265_10BIT)
+ else if (Codec is CODEC_H265 or CODEC_H265_10BIT)
{
- stream.EncodingParameters.AddRange(H265(stream, args, Codec == CODEC_H265_10BIT, Quality, encoder,
+ bool tenBit = Codec == CODEC_H265_10BIT || stream.Stream.Is10Bit;
+ stream.EncodingParameters.AddRange(H265(stream, args, tenBit, Quality, encoder,
stream.Stream.FramesPerSecond, Speed));
stream.Codec = "hevc";
}
- else if (Codec == CODEC_AV1 || Codec == CODEC_AV1_10BIT)
+ else if (Codec is CODEC_AV1 or CODEC_AV1_10BIT)
{
- stream.EncodingParameters.AddRange(AV1(args, Codec == CODEC_AV1_10BIT, Quality, encoder, Speed));
+ bool tenBit = Codec == CODEC_AV1_10BIT || stream.Stream.Is10Bit;
+ stream.EncodingParameters.AddRange(AV1(args, tenBit, Quality, encoder, Speed));
stream.Codec = "av1";
}
else if (Codec == CODEC_VP9)
diff --git a/VideoNodes/Globals.cs b/VideoNodes/Globals.cs
new file mode 100644
index 00000000..367a6e29
--- /dev/null
+++ b/VideoNodes/Globals.cs
@@ -0,0 +1,6 @@
+namespace FileFlows.VideoNodes;
+
+public class Globals
+{
+ internal const string PIX_FORMAT = "#PXT_FORMAT";
+}
\ No newline at end of file
diff --git a/VideoNodes/VideoInfo.cs b/VideoNodes/VideoInfo.cs
index 152a625d..236c5b6a 100644
--- a/VideoNodes/VideoInfo.cs
+++ b/VideoNodes/VideoInfo.cs
@@ -93,6 +93,16 @@ public class VideoFileStream
/// Gets or sets the pixel format that should be used to decode this stream
///
public string PixelFormat { get; set; }
+
+ ///
+ /// Gets or sets if this stream is 10 bit
+ ///
+ public bool Is10Bit { get; set; }
+
+ ///
+ /// Gets or sets if this stream is 12 bit
+ ///
+ public bool Is12Bit { get; set; }
}
///
diff --git a/VideoNodes/VideoInfoHelper.cs b/VideoNodes/VideoInfoHelper.cs
index 776a57be..02dec868 100644
--- a/VideoNodes/VideoInfoHelper.cs
+++ b/VideoNodes/VideoInfoHelper.cs
@@ -257,6 +257,9 @@ public class VideoInfoHelper
vs.Codec = line.Substring(line.IndexOf("Video: ") + "Video: ".Length).Replace(",", "").Trim().Split(' ').First().ToLower();
vs.PixelFormat = GetDecoderPixelFormat(line);
+ vs.Is10Bit = Regex.IsMatch(line, @"p(0)?10l(b)?e", RegexOptions.IgnoreCase);
+ vs.Is12Bit = Regex.IsMatch(line, @"p(0)?12l(b)?e", RegexOptions.IgnoreCase);
+
var dimensions = Regex.Match(line, @"([\d]{3,})x([\d]{3,})");
if (int.TryParse(dimensions.Groups[1].Value, out int width))
vs.Width = width;
@@ -455,7 +458,7 @@ public class VideoInfoHelper
static string GetDecoderPixelFormat(string line)
{
// only p010le confirmed working so far
- if(line.IndexOf("p010le", StringComparison.Ordinal) > 0)
+ if(Regex.IsMatch(line, @"p(0)?10l(b)?e"))
return "p010le";
// if(line.IndexOf("yuv420p", StringComparison.Ordinal) > 0)
// return "yuv420p";