namespace FileFlows.VideoNodes; /// /// Tests a video resolution /// public class VideoResolution: 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-resolution"; /// /// Gets the icon for this flow element /// public override string Icon => "fas fa-video"; /// /// Executes the flow element /// /// the arguments /// the output to call next public override int Execute(NodeParameters args) { VideoInfo videoInfo = GetVideoInfo(args); if (videoInfo == null) { args.Logger?.ELog($"No video info found, run the Video File flow element first."); return -1; } // get the first video stream, likely the only one var video = videoInfo.VideoStreams.FirstOrDefault(); if (video == null) { args.Logger?.ELog($"No video stream detected"); return -1; // no video streams detected } if (video.Width > 3700) { args.Logger?.ILog($"4k Video Detected: {video.Width}x{video.Height}"); return 1; // 4k } if (video.Width > 1800) { args.Logger?.ILog($"1080p Video Detected: {video.Width}x{video.Height}"); return 2; // 1080p } if (video.Width > 1200) { args.Logger?.ILog($"720p Video Detected: {video.Width}x{video.Height}"); return 3; // 720p } args.Logger?.ILog($"SD Video Detected: {video.Width}x{video.Height}"); return 4; // SD } }