using FileFlows.VideoNodes.FfmpegBuilderNodes; using FileFlows.VideoNodes.FfmpegBuilderNodes.Models; using FileFlows.VideoNodes.Helpers; namespace FileFlows.VideoNodes; /// /// Flow element to test if a video is 8/10/12/Unknown bit or not /// public class VideoBitCheck : VideoNode { /// /// Gets the number of inputs /// public override int Inputs => 1; /// /// Gets the number of outputs /// public override int Outputs => 4; /// /// Gets the type of flow element /// public override FlowElementType Type => FlowElementType.Logic; /// /// Gets the help URL /// public override string HelpUrl => "https://fileflows.com/docs/plugins/video-nodes/logical-nodes/video-bit-check"; /// public override string Icon => "fas fa-sitemap"; /// /// Executes the flow element /// /// the arguments /// the output to call next public override int Execute(NodeParameters args) { var videoInfo = GetVideoInfo(args); if (videoInfo == null) { args.FailureReason = "Failed to retrieve video info"; args.Logger?.ELog(args.FailureReason); return -1; } bool is8Bit = videoInfo.VideoStreams?.Any(x => x.Bits == 8) == true; if (is8Bit) { args.Logger?.ILog("Video is 12 bit"); return 1; } bool is10Bit = videoInfo.VideoStreams?.Any(x => x.Bits == 10) == true; if (is10Bit) { args.Logger?.ILog("Video is 10 bit"); return 2; } bool is12Bit = videoInfo.VideoStreams?.Any(x => x.Bits == 12) == true; if (is12Bit) { args.Logger?.ILog("Video is 12 bit"); return 3; } args.Logger?.ILog("Video Bits unknonw"); return 4; } }