added check for HW_OFF to variables

This commit is contained in:
John Andrews
2024-01-17 16:17:37 +13:00
parent 3528a67469
commit a7f95e77a3

View File

@@ -1,4 +1,5 @@
using System.Globalization;
using System.Net;
using System.Runtime.InteropServices;
using FileFlows.VideoNodes.FfmpegBuilderNodes.Models;
@@ -162,7 +163,13 @@ public partial class FfmpegBuilderVideoEncode:FfmpegBuilderNode
stream.EncodingParameters.Clear();
string encoder = Environment.GetEnvironmentVariable("HW_OFF") == "1" ? ENCODER_CPU : this.Encoder;
// remove anything that may have been added before
stream.Filter = stream.Filter.Where(x => x?.StartsWith("scale_qsv") != true).ToList();
string encoder = Environment.GetEnvironmentVariable("HW_OFF") == "1" ||
(
args.Variables?.TryGetValue("HW_OFF", out object oHwOff) == true && (oHwOff as bool? == true || oHwOff?.ToString() == "1")
) ? ENCODER_CPU : this.Encoder;
if (Codec == CODEC_H264)
{