mirror of
https://github.com/revenz/FileFlowsPlugins.git
synced 2026-02-17 22:58:27 -06:00
FF-1237 - passing encoding args to hw test
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -212,8 +212,16 @@ public class FfmpegBuilderExecutor: FfmpegBuilderNode
|
||||
pxtFormat = string.Empty; // clear it, if we use a 8bit pixel format this will break the colours
|
||||
}
|
||||
|
||||
List<string> encodingParameters = new ();
|
||||
if (video?.EncodingParameters?.Any() == true)
|
||||
{
|
||||
encodingParameters.Add("-c:v:" + video.Stream.TypeIndex);
|
||||
encodingParameters.AddRange(video.EncodingParameters.Select(x =>
|
||||
x.Replace("{index}", video.Stream.Index.ToString())));
|
||||
}
|
||||
|
||||
var decodingParameters =
|
||||
GetHardwareDecodingArgs(args, localFile, FFMPEG, video?.Stream?.Codec, pxtFormat);
|
||||
GetHardwareDecodingArgs(args, localFile, FFMPEG, video?.Stream?.Codec, pxtFormat, encodingParameters: encodingParameters);
|
||||
if (decodingParameters.Any() == true)
|
||||
{
|
||||
args.StatisticRecorder("DecoderParameters", string.Join(" ", decodingParameters));
|
||||
@@ -283,7 +291,7 @@ public class FfmpegBuilderExecutor: FfmpegBuilderNode
|
||||
return 1;
|
||||
}
|
||||
|
||||
internal static string[] GetHardwareDecodingArgs(NodeParameters args, string localFile, string ffmpeg, string codec, string pixelFormat)
|
||||
internal static string[] GetHardwareDecodingArgs(NodeParameters args, string localFile, string ffmpeg, string codec, string pixelFormat, List<string> encodingParameters = null)
|
||||
{
|
||||
string testFile = FileHelper.Combine(args.TempPath, Guid.NewGuid() + ".hwtest.mkv");
|
||||
if (string.IsNullOrWhiteSpace(codec))
|
||||
@@ -330,9 +338,14 @@ public class FfmpegBuilderExecutor: FfmpegBuilderNode
|
||||
"-frames:v", "1",
|
||||
//"-ss", "10",
|
||||
// instead of file output to null
|
||||
"-f", "null", "-",
|
||||
//"-f", "null", "-",
|
||||
//testFile
|
||||
});
|
||||
if (encodingParameters?.Any() == true)
|
||||
arguments.AddRange(encodingParameters);
|
||||
|
||||
arguments.AddRange(new[] { "-f", "null", "-" });
|
||||
|
||||
string line = string.Join("", arguments);
|
||||
if (tested.Contains(line))
|
||||
continue; // avoids testing twice if the #FORMAT# already tested one
|
||||
|
||||
@@ -37,19 +37,19 @@
|
||||
_EncodingParameters = value ?? new List<string>();
|
||||
}
|
||||
}
|
||||
private List<string> _OptionalEncodingParameters = new List<string>();
|
||||
/// <summary>
|
||||
/// Gets or sets encoding paramaters that will process but only if processing is needed, these won't trigger a has changed
|
||||
/// value of the video file by themselves
|
||||
/// </summary>
|
||||
public List<string> OptionalEncodingParameters
|
||||
{
|
||||
get => _OptionalEncodingParameters;
|
||||
set
|
||||
{
|
||||
_OptionalEncodingParameters = value ?? new List<string>();
|
||||
}
|
||||
}
|
||||
// private List<string> _OptionalEncodingParameters = new List<string>();
|
||||
// /// <summary>
|
||||
// /// Gets or sets encoding paramaters that will process but only if processing is needed, these won't trigger a has changed
|
||||
// /// value of the video file by themselves
|
||||
// /// </summary>
|
||||
// public List<string> OptionalEncodingParameters
|
||||
// {
|
||||
// get => _OptionalEncodingParameters;
|
||||
// set
|
||||
// {
|
||||
// _OptionalEncodingParameters = value ?? new List<string>();
|
||||
// }
|
||||
// }
|
||||
private List<string> _AdditionalParameters = new List<string>();
|
||||
public List<string> AdditionalParameters
|
||||
{
|
||||
@@ -80,8 +80,8 @@
|
||||
{
|
||||
results.Add("-c:v:" + Stream.TypeIndex);
|
||||
results.AddRange(EncodingParameters.Select(x => x.Replace("{index}", args.OutputTypeIndex.ToString())));
|
||||
if(OptionalEncodingParameters.Any())
|
||||
results.AddRange(OptionalEncodingParameters.Select(x => x.Replace("{index}", args.OutputTypeIndex.ToString())));
|
||||
// if(OptionalEncodingParameters.Any())
|
||||
// results.AddRange(OptionalEncodingParameters.Select(x => x.Replace("{index}", args.OutputTypeIndex.ToString())));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -34,20 +34,20 @@ public class FfmpegBuilderVideo10Bit : FfmpegBuilderNode
|
||||
args?.Logger?.WLog("This flow element has been marked obsolete and should no longer be used.");
|
||||
return 1; // do nothing
|
||||
|
||||
var videoInfo = GetVideoInfo(args);
|
||||
if (videoInfo == null || videoInfo.VideoStreams?.Any() != true)
|
||||
return -1;
|
||||
|
||||
var stream = Model?.VideoStreams?.Where(x => x.Deleted == false)?.FirstOrDefault();
|
||||
if (stream != null)
|
||||
{
|
||||
args.Logger?.ILog(
|
||||
"Adding optional encoding parameters: -pix_fmt:v:{index} p010le -profile:v:{index} main10");
|
||||
|
||||
stream.OptionalEncodingParameters.AddRange(new[]
|
||||
{ "-pix_fmt:v:{index}", "p010le", "-profile:v:{index}", "main10" });
|
||||
}
|
||||
|
||||
return 1;
|
||||
// var videoInfo = GetVideoInfo(args);
|
||||
// if (videoInfo == null || videoInfo.VideoStreams?.Any() != true)
|
||||
// return -1;
|
||||
//
|
||||
// var stream = Model?.VideoStreams?.Where(x => x.Deleted == false)?.FirstOrDefault();
|
||||
// if (stream != null)
|
||||
// {
|
||||
// args.Logger?.ILog(
|
||||
// "Adding optional encoding parameters: -pix_fmt:v:{index} p010le -profile:v:{index} main10");
|
||||
//
|
||||
// stream.OptionalEncodingParameters.AddRange(new[]
|
||||
// { "-pix_fmt:v:{index}", "p010le", "-profile:v:{index}", "main10" });
|
||||
// }
|
||||
//
|
||||
// return 1;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user