mirror of
https://github.com/revenz/FileFlowsPlugins.git
synced 2026-02-13 11:29:22 -06:00
FF-1768: Added probe size and analyze duration to Video File
This commit is contained in:
@@ -81,13 +81,6 @@ public class FfmpegBuilderExecutor: FfmpegBuilderNode
|
||||
return _StrictOptions;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the probe size in bytes
|
||||
/// </summary>
|
||||
[FormInput(FormInputType.FileSize, 3)]
|
||||
[DefaultValue(5_000_000)]
|
||||
public long ProbeSize { get; set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public override int Execute(NodeParameters args)
|
||||
@@ -199,13 +192,11 @@ public class FfmpegBuilderExecutor: FfmpegBuilderNode
|
||||
// this is used by the qsv filter for hw decoding
|
||||
List<string> afterStartArguments = new();
|
||||
|
||||
if (ProbeSize >= 32)
|
||||
startArgs.AddRange(new[]
|
||||
{
|
||||
startArgs.AddRange(new[]
|
||||
{
|
||||
"-probesize", ProbeSize.ToString()
|
||||
});
|
||||
}
|
||||
"-probesize", VideoInfoHelper.ProbeSize + "M",
|
||||
"-analyzeduration", VideoInfoHelper.AnalyzeDuration.ToString()
|
||||
});
|
||||
|
||||
bool isEncodingVideo =
|
||||
model.VideoStreams.Any(x => x.Deleted == false && x.EncodingParameters?.Any() == true || x.Filter?.Any() == true);
|
||||
|
||||
@@ -11,11 +11,22 @@ public class VideoFile : VideoNode
|
||||
|
||||
public override bool NoEditorOnAdd => true;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the probe size
|
||||
/// </summary>
|
||||
[DefaultValue(25)]
|
||||
[NumberInt(1)]
|
||||
[Range(5, 1000)]
|
||||
[Range(5, 5000)]
|
||||
public int ProbeSize { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets how many microseconds are analyzed to probe the input
|
||||
/// </summary>
|
||||
[DefaultValue(5)]
|
||||
[NumberInt(1)]
|
||||
[Range(1, 600)]
|
||||
public int AnalyzeDuration { get; set; }
|
||||
|
||||
private Dictionary<string, object> _Variables;
|
||||
public override Dictionary<string, object> Variables => _Variables;
|
||||
public VideoFile()
|
||||
@@ -46,13 +57,16 @@ public class VideoFile : VideoNode
|
||||
},
|
||||
{ "vi.Width", 1920 },
|
||||
{ "vi.Height", 1080 },
|
||||
{ nameof(ProbeSize), 5_000_000 },
|
||||
{ nameof(AnalyzeDuration), 25}
|
||||
};
|
||||
}
|
||||
|
||||
public override int Execute(NodeParameters args)
|
||||
{
|
||||
PrintFFmpegVersion(args);
|
||||
VideoInfoHelper.ProbeSize = this.ProbeSize;
|
||||
VideoInfoHelper.ProbeSize = this.ProbeSize * 1_000_000;
|
||||
VideoInfoHelper.AnalyzeDuration = this.AnalyzeDuration;
|
||||
|
||||
try
|
||||
{
|
||||
|
||||
@@ -18,6 +18,10 @@ public class VideoInfoHelper
|
||||
static Regex rgxMimeType = new Regex(@"(?<=((^[\s]+mimetype[\s]+:[\s])))(.*?)$", RegexOptions.Multiline);
|
||||
|
||||
static int _ProbeSize = 25;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or set the probe size
|
||||
/// </summary>
|
||||
internal static int ProbeSize
|
||||
{
|
||||
get => _ProbeSize;
|
||||
@@ -25,13 +29,22 @@ public class VideoInfoHelper
|
||||
{
|
||||
if (value < 5)
|
||||
_ProbeSize = 5;
|
||||
else if (value > 1000)
|
||||
_ProbeSize = 1000;
|
||||
else
|
||||
_ProbeSize = value;
|
||||
}
|
||||
}
|
||||
|
||||
private static int _AnalyzeDuration = 5_000_000;
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the analyze duration
|
||||
/// </summary>
|
||||
public static int AnalyzeDuration
|
||||
{
|
||||
get => _AnalyzeDuration;
|
||||
set => _AnalyzeDuration = Math.Max(32, value);
|
||||
}
|
||||
|
||||
public VideoInfoHelper(string ffMpegExe, ILogger logger)
|
||||
{
|
||||
this.ffMpegExe = ffMpegExe;
|
||||
@@ -68,6 +81,7 @@ public class VideoInfoHelper
|
||||
{
|
||||
"-hide_banner",
|
||||
"-probesize", ProbeSize + "M",
|
||||
"-analyzeduration", AnalyzeDuration.ToString(),
|
||||
"-i",
|
||||
filename,
|
||||
})
|
||||
|
||||
@@ -84,7 +84,10 @@
|
||||
"Fields": {
|
||||
"ProbeSize": "Probe Size",
|
||||
"ProbeSize-Suffix": "MB",
|
||||
"ProbeSize-Help": "The probe size to use in FFMPEG when executing."
|
||||
"ProbeSize-Help": "The probe size to use in FFMPEG when executing.",
|
||||
"AnalyzeDuration": "Analyze Duration",
|
||||
"AnalyzeDuration-Help": "Specify how many microseconds are analyzed to probe the input",
|
||||
"AnalyzeDuration-Suffix": "seconds"
|
||||
}
|
||||
},
|
||||
"VideoDuration": {
|
||||
|
||||
Reference in New Issue
Block a user