finished with legacy nodes

This commit is contained in:
John Andrews
2022-06-15 14:25:53 +12:00
parent 9b37ea2a81
commit 51540441ad
33 changed files with 53 additions and 232 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -8,6 +8,9 @@ namespace FileFlows.VideoNodes
public class VideoCodec : VideoNode
{
public override string ObsoleteMessage => "This node has been combined into 'Video Has Track'";
public override int Inputs => 1;
public override int Outputs => 2;
public override FlowElementType Type => FlowElementType.Logic;

Binary file not shown.

View File

@@ -1,6 +1,7 @@
namespace FileFlows.VideoNodes
{
using FileFlows.Plugin;
using System.Text.Json;
public abstract class VideoNode : Node
{
@@ -129,13 +130,31 @@ namespace FileFlows.VideoNodes
args.Logger.WLog("No codec information loaded, use a 'VideoFile' node first");
return null;
}
var result = args.Parameters[VIDEO_INFO] as VideoInfo;
if (result == null)
if(args.Parameters[VIDEO_INFO] == null)
{
args.Logger.WLog("VideoInfo not found for file");
return null;
}
return result;
var result = args.Parameters[VIDEO_INFO] as VideoInfo;
if (result != null)
return result;
// may be from non Legacy VideoNodes
try
{
string json = JsonSerializer.Serialize(args.Parameters[VIDEO_INFO]);
var vi = JsonSerializer.Deserialize<VideoInfo>(json);
if (vi == null)
throw new Exception("Failed to deserailize object");
return vi;
}
catch(Exception ex)
{
args.Logger.WLog("VideoInfo could not be deserialized: " + ex.Message);
return null;
}
}

Binary file not shown.

Binary file not shown.

View File

@@ -7,106 +7,6 @@
"7": { "1": "7.1" },
"Flow": {
"Parts": {
"AudioAddTrack": {
"Outputs": {
"1": "Audio track added and saved to temporary file"
},
"Description": "Adds a new audio track to the video file, all other audio tracks will remain. This will use the first audio track of the file as the source audio track to convert.",
"Fields": {
"Index": "Index",
"Index-Help": "The index where to insert the new audio track. 0 based, so to insert the new audio track as the first track set this to 0.",
"Channels": "Channels",
"Channels-Help": "The number of channels to convert this audio track to.",
"Bitrate": "Bitrate",
"Bitrate-Help": "Bitrate of the new audio track"
}
},
"AudioAdjustVolume": {
"Outputs": {
"1": "Audio tracks volume was adjusted and saved to temporary file",
"2": "Audio tracks were not adjusted"
},
"Description": "Adjusts audio tracks volume in a video file using FFMPEG",
"Fields": {
"VolumePercent": "Volume Percent",
"VolumePercent-Help": "The percent of the adjusted volume.\n100 means no adjustment\n50 means half volume\n0 means muted"
}
},
"AudioNormalization": {
"Outputs": {
"1": "Audio tracks were normalized and saved to temporary file",
"2": "No audio tracks were found to be normalized"
},
"Description": "Normalizes all audio tracks in a video file using FFMPEGs loudnorm filter",
"Fields": {
"AllAudio": "All Audio Tracks",
"AllAudio-Help": "If all audio tracks should be normalized or if just the first track should be",
"TwoPass": "Two Pass",
"TwoPass-Help": "If the audio tracks should use two pass normalization. This improves the normalization but increases the processing time.",
"Pattern": "Pattern",
"Pattern-Help": "An optional regular expression to filter out audio tracks to normalize. Will match against the title, codec and language",
"NotMatching": "Not Matching",
"NotMatching-Help": "If the pattern should be used to exclude audio tracks from normalization, otherwise if the audio track matches they will be normalized."
}
},
"AudioTrackRemover": {
"Outputs": {
"1": "Audio tracks were removed",
"2": "Audio tracks were NOT removed"
},
"Description": "Allows you to remove audio tracks based on either their title or their language codes.\n\nAny title (or language code if set to \"Use Language Code\") that is blank will NOT be removed regardless of the pattern.",
"Fields": {
"Pattern": "Pattern",
"Pattern-Help": "A regular expression to match against, eg \"commentary\" to remove commentary tracks",
"NotMatching": "Not Matching",
"NotMatching-Help": "If audio tracks NOT matching the pattern should be removed",
"UseLanguageCode": "Use Language Code",
"UseLanguageCode-Help": "If the language code of the audio track should be used instead of the title"
}
},
"AudioTrackReorder": {
"Outputs": {
"1": "Audio tracks re-ordered in new temporary file",
"2": "Audio tracks NOT re-ordered"
},
"Description": "Allows you to reorder audio tracks in the preferred order.\n\nEnter the languages/audio codecs/channels in the order you want. Any not listed will be ordered after the ones entered in their original order.\nIf there are multiple tracks with same language/codec/channels, they will be ordered first by the order you entered, then in their original order.\n\nOutput 1: Tracks were reordered\nOutput 2: Tracks did not need reordering",
"Fields": {
"OrderedTracks": "Ordered Audio Codecs",
"OrderedTracks-Help": "The order of audio codecs to the audio tracks by. This is done after the languages (if any)",
"Languages": "Languages",
"Languages-Help": "The order of languages to sort the audio tracks by. This sorting is done before the codec.",
"Channels": "Channels",
"Channels-Help": "The order of audio channels to sort the audio tracks by. This sorting is done before languages.\nFor example \"5.1\",\"7.1\",\"6.2\",\"2\""
}
},
"AudioTrackSetLanguage": {
"Label": "Audio Set Language",
"Outputs": {
"1": "Audio tracks updated to new temporary file",
"2": "Audio tracks NOT updated"
},
"Description": "Allows you to set the language for any audio tracks that have no language set. If the audio track does have a language set, it will be skipped.\n\nOutput 1: Audio Tracks were updated\nOutput 2: No audio tracks were needing to be updated",
"Fields": {
"Language": "Language",
"Language-Help": "The ISO 639-2 language code to use. \nhttps://en.wikipedia.org/wiki/List_of_ISO_639-2_codes"
}
},
"AutoChapters": {
"Description": "Automatically detect scene changes in the video to generate chapters.",
"Outputs": {
"1": "Chapters generated and saved to temporary file",
"2": "No chapters detected or video already had chapters"
},
"Fields": {
"MinimumLength": "Minimum Length",
"MinimumLength-Suffix": "seconds",
"MinimumLength-Help": "The minimum length of a chapter in seconds",
"Percent": "Percent",
"Percent-Suffix": "%",
"Percent-Help": "The threshold percentage value to use for scene detection changes. A good value is 45%"
}
},
"CanUseHardwareEncoding": {
"Description": "Checks if the specified hardware encoder is currently available to the Flow.",
"Fields": {
@@ -114,13 +14,6 @@
"Encoder-Help": "The hardware decoder to check"
}
},
"ComskipChapters": {
"Description": "Uses a comskip EDL file and will create chapters given that EDL comskip file.",
"Outputs": {
"1": "Commercials chapters created, saved to temporary file",
"2": "No commercials detected"
}
},
"ComskipRemoveAds": {
"Description": "Uses a comskip EDL file and will remove commercials using that file.",
"Outputs": {
@@ -139,29 +32,6 @@
"ProbeSize-Help": "The probe size to use in FFMPEG when executing."
}
},
"DetectBlackBars": {
"Description": "Processes a video file and scans for black bars in the video.\n\nIf found a parameter \"VideoCrop\" will be added.\n\nOutput 1: Black bars detected\nOutput 2: Not detected",
"Outputs": {
"1": "Black bars detected",
"2": "No black bars detected"
},
"Fields": {
"CroppingThreshold": "Threshold",
"CroppingThreshold-Help": "The amount of pixels that must be greater than to crop. E.g. if there's only 5 pixels detected as black space, you may consider this too small to crop."
}
},
"FFMPEG": {
"Description": "The node lets you run any FFMPEG command you like. Giving you full control over what it can do.\n\nFor more information refer to the FFMPEG documentation",
"Outputs": {
"1": "Video processed"
},
"Fields": {
"Extension": "Extension",
"Extension-Help": "The file extension to use on the newly created file",
"CommandLine": "Command Line",
"CommandLine-Help": "The command line to run with FFMPEG.\n'{WorkingFile}': the working file of the flow\n'{Output}': The output file that will be passed as the last parameter to FFMPEG including the extension defined above."
}
},
"FfmpegBuilderStart": {
"Label": "FFMPEG Builder: Start",
"Outputs": {
@@ -498,17 +368,6 @@
"Tag-Help": "The tag to add to the video file"
}
},
"RemuxToMKV": {
"Descritption": "Remuxes a video file into a MKV container. All streams will be copied to the new container",
"Outputs": {
"1": "File remuxed to temporary file",
"2": "File was already in a MKV container"
},
"Fields": {
"Force": "Force",
"Force-Help": "If the file should be always remuxed into a MKV container even when it already is in a MKV container.\ni.e. a new temporary file will always be created."
}
},
"ReadVideoInfo": {
"Descritption": "Reads the video information from the current working file and updates the vi variables.",
"Outputs": {
@@ -516,29 +375,6 @@
"2": "File was not a video file or failed to be read"
}
},
"RemuxToMP4": {
"Descritption": "Remuxes a video file into a MP4 container. All streams will be copied to the new container",
"Outputs": {
"1": "File remuxed to temporary file",
"2": "File was already in a MP4 container"
},
"Fields": {
"Force": "Force",
"Force-Help": "If the file should be always remuxed into a MP4 container even when it already is in a MP4 container.\ni.e. a new temporary file will always be created."
}
},
"SubtitleRemover": {
"Description": "Removes subtitles from a video file if found.\n\nOutput 1: Subtitles were removed\nOutput 2: No subtitles found that needed to be removed",
"Outputs": {
"1": "Subtitles removed in new temporary file",
"2": "No subtitles to remove"
},
"Fields": {
"SubtitlesToRemove": "Subtitles To Remove",
"RemoveAll": "Remove All",
"RemoveAll-Help": "When checked, all subtitles will be removed from the file, otherwise only those selected below will be"
}
},
"SubtitleExtractor": {
"Description": "Extract a single subtitle tracks and saves it to the destination. Can extract srt, ass, and ssa format.\nThis will NOT update the working file, and will keep the working file the same as the input file.\n\nOutput 1: Subtitles were extracted\nOutput 2: No subtitles found to extract",
"Outputs": {
@@ -554,52 +390,12 @@
"SetWorkingFile-Help": "When this is checked, if a subtitle is extracted, the working file will be changed to this extracted subtitle. The original working file will NOT be deleted."
}
},
"SubtitleLanguageRemover": {
"Outputs": {
"1": "Subtitles were removed",
"2": "Subtitles were NOT removed"
},
"Description": "Allows you to remove subtitles based on either their title or their language codes.\n\nAny language (or title if set to \"Use Title\") that is blank will NOT be removed regardless of the pattern.",
"Fields": {
"Pattern": "Pattern",
"Pattern-Help": "A regular expression to match against, eg \"eng\" to remove English tracks",
"NotMatching": "Not Matching",
"NotMatching-Help": "If subtitles NOT matching the pattern should be removed",
"UseTitle": "Use Title",
"UseTitle-Help": "If the title of the subtitle should be used for matching instead of the language"
}
},
"VideoCodec": {
"Description": "This node will check the codecs in the input file, and trigger when matched.\n\nOutput 1: Matches\nOutput 2: Does not match",
"Fields": {
"Codecs": "Codecs",
"Codecs-Help": "Enter a list of case insensitive video or audio codecs.\nEg hevc, h265, mpeg4, ac3"
}
},
"VideoEncode": {
"Description": "A generic video encoding node, this lets you customize how to encode a video file using ffmpeg.\n\nOutput 1: Video was processed\nOutput 2: No processing required",
"Outputs": {
"1": "Video re-encoded to temporary file",
"2": "Video not re-encoded"
},
"Fields": {
"Extension": "Extension",
"Extension-Help": "The file extension to use on the newly created file.",
"VideoCodec": "Video Codec",
"VideoCodec-Help": "The video codec the video should be in, for example hevc, h264.\nIf left empty all original video tracks will be copied.",
"VideoCodecParameters": "Video Codec Parameters",
"VideoCodecParameters-Help": "The parameters to use to encode the video, eg. \"hevc_nvenc -preset hq -crf 23\" to encode into hevc using the HQ preset a constant rate factor of 23 and using NVIDIA hardware acceleration.",
"AudioCodec": "Audio Codec",
"AudioCodec-Help": "The audio codec to encode the video with.\nIf left empty all original audio tracks will be copied.",
"Language": "Language",
"Language-Help": "Optional ISO 639-2 language code to use. Will attempt to find an audio track with this language code if not the best audio track will be used.\nhttps://en.wikipedia.org/wiki/List_of_ISO_639-2_codes"
}
},
"VideoHasStream": {
"Description": "Tests if a video file contains a stream",
"Title": "Video Has Track",
"Description": "Tests if a video file contains a track",
"Outputs": {
"1": "Contains the matching stream",
"2": "Does not contain the matching stream"
"1": "Contains the matching track",
"2": "Does not contain the matching track"
},
"Fields": {
"Stream": "Type",
@@ -613,24 +409,6 @@
"Channels": "Channels",
"Channels-Help": "The number of channels to test for. Set to 0 to ignore this check"
}
},
"VideoScaler": {
"Description": "This allows you to scale a video to the specified dimensions. It will retain the aspect ratio of the video so if the video was 1920x1000 it would scale to 1280x668 if you select 720P.",
"Outputs": {
"1": "Video rescaled to temporary file",
"2": "Video was already in/near the scaled resolution"
},
"Fields": {
"VideoCodec": "Video Codec",
"Language-Help": "The video codec to encode the scaled video in",
"Extension": "Extension",
"Extension-Help": "The file extension to use on the newly created file",
"Force": "Force",
"Force-Help": "When checked the video will be force scaled even if the working file is already in this resolution (or near this resolution).",
"Resolution": "Resolution",
"VideoCodecParameters": "Video Codec Parameters",
"VideoCodecParameters-Help": "The parameters to use to encode the video, eg. \"hevc_nvenc -preset hq -crf 23\" to encode into hevc using the HQ preset a constant rate factor of 23 and using NVIDIA hardware acceleration."
}
}
}
}

View File

@@ -7,6 +7,8 @@ namespace FileFlows.VideoNodes
public override string Icon => "fas fa-video";
public override int Outputs => 2;
public override FlowElementType Type => FlowElementType.Logic;
private Dictionary<string, object> _Variables;
public override Dictionary<string, object> Variables => _Variables;
public ReadVideoInfo()

View File

@@ -1,6 +1,7 @@
namespace FileFlows.VideoNodes
{
using FileFlows.Plugin;
using System.Text.Json;
public abstract class VideoNode : Node
{
@@ -121,13 +122,31 @@ namespace FileFlows.VideoNodes
args.Logger.WLog("No codec information loaded, use a 'VideoFile' node first");
return null;
}
var result = args.Parameters[VIDEO_INFO] as VideoInfo;
if (result == null)
if (args.Parameters[VIDEO_INFO] == null)
{
args.Logger.WLog("VideoInfo not found for file");
return null;
}
return result;
var result = args.Parameters[VIDEO_INFO] as VideoInfo;
if (result != null)
return result;
// may be from non Legacy VideoNodes
try
{
string json = JsonSerializer.Serialize(args.Parameters[VIDEO_INFO]);
var vi = JsonSerializer.Deserialize<VideoInfo>(json);
if (vi == null)
throw new Exception("Failed to deserailize object");
return vi;
}
catch (Exception ex)
{
args.Logger.WLog("VideoInfo could not be deserialized: " + ex.Message);
return null;
}
}