FF-312 - removed h264 10bit option

This commit is contained in:
John Andrews
2022-09-06 19:32:29 +12:00
parent 07728db65a
commit c5a5c153be
22 changed files with 62 additions and 47 deletions
@@ -88,6 +88,13 @@ public class FfmpegBuilderAudioAddTrack : FfmpegBuilderNode
[TextVariable(4)]
public string Language { get; set; }
[Boolean(5)]
public bool RemoveTitle { get; set; }
[TextVariable(6)]
[ConditionEquals(nameof(RemoveTitle), false)]
public string NewTitle { get; set; }
public override int Execute(NodeParameters args)
{
if (string.IsNullOrEmpty(Codec) || Codec == "ORIGINAL")
@@ -123,6 +130,12 @@ public class FfmpegBuilderAudioAddTrack : FfmpegBuilderNode
{
audio.EncodingParameters.AddRange(GetNewAudioTrackParameters("0:a:" + (bestAudio.TypeIndex), Codec, Channels, Bitrate));
}
if (RemoveTitle)
audio.Title = FfmpegStream.REMOVED;
else if(string.IsNullOrWhiteSpace(NewTitle) == false)
audio.Title = args.ReplaceVariables(NewTitle, stripMissing: true);
if (Index > Model.AudioStreams.Count - 1)
Model.AudioStreams.Add(audio);
else
@@ -14,7 +14,6 @@ public class FfmpegBuilderVideoEncode:FfmpegBuilderNode
public override int Outputs => 1;
internal const string CODEC_H264 = "h264";
internal const string CODEC_H264_10BIT = "h264 10BIT";
internal const string CODEC_H265 = "h265";
internal const string CODEC_H265_10BIT = "h265 10BIT";
@@ -26,9 +25,8 @@ public class FfmpegBuilderVideoEncode:FfmpegBuilderNode
/// <summary>
/// Gets or sets the codec used to encode
/// </summary>
[DefaultValue(CODEC_H264_10BIT)]
[DefaultValue(CODEC_H264)]
[ChangeValue(nameof(Quality), 23, CODEC_H264)]
[ChangeValue(nameof(Quality), 23, CODEC_H265_10BIT)]
[ChangeValue(nameof(Quality), 28, CODEC_H265)]
[ChangeValue(nameof(Quality), 28, CODEC_H265_10BIT)]
[Select(nameof(CodecOptions), 1)]
@@ -47,7 +45,7 @@ public class FfmpegBuilderVideoEncode:FfmpegBuilderNode
_CodecOptions = new List<ListOption>
{
new () { Label = "H.264", Value = CODEC_H264 },
new () { Label = "H.264 (10-Bit)", Value = CODEC_H264_10BIT },
// new () { Label = "H.264 (10-Bit)", Value = CODEC_H264_10BIT },
new () { Label = "H.265", Value = CODEC_H265 },
new () { Label = "H.265 (10-Bit)", Value = CODEC_H265_10BIT },
};
@@ -89,8 +87,8 @@ public class FfmpegBuilderVideoEncode:FfmpegBuilderNode
stream.EncodingParameters.Clear();
if (Codec == CODEC_H264 || Codec == CODEC_H264_10BIT)
stream.EncodingParameters.AddRange(H264(args, Codec == CODEC_H264_10BIT, Quality, HardwareEncoding));
if (Codec == CODEC_H264)
stream.EncodingParameters.AddRange(H264(args, false, Quality, HardwareEncoding));
else if (Codec == CODEC_H265 || Codec == CODEC_H265_10BIT)
stream.EncodingParameters.AddRange(H265(args, Codec == CODEC_H265_10BIT, Quality, HardwareEncoding));
else
@@ -105,8 +103,8 @@ public class FfmpegBuilderVideoEncode:FfmpegBuilderNode
internal static IEnumerable<string> GetEncodingParameters(NodeParameters args, string codec, int quality, bool useHardwareEncoder)
{
if (codec == CODEC_H264 || codec == CODEC_H264_10BIT)
return H264(args, codec == CODEC_H264_10BIT, quality, useHardwareEncoder).Select(x => x.Replace("{index}", "0"));
if (codec == CODEC_H264)
return H264(args, false, quality, useHardwareEncoder).Select(x => x.Replace("{index}", "0"));
else if (codec == CODEC_H265 || codec == CODEC_H265_10BIT)
return H265(args, codec == CODEC_H265_10BIT, quality, useHardwareEncoder).Select(x => x.Replace("{index}", "0"));
throw new Exception("Unsupported codec: " + codec);
@@ -60,6 +60,7 @@ public class FfmpegBuilder_AddAudioTests
FfmpegBuilderStart ffStart = new();
ffStart.PreExecute(args);
Assert.AreEqual(1, ffStart.Execute(args));
}
@@ -47,7 +47,7 @@ public class FfmpegBuilder_BasicTests : TestBase
[TestMethod]
public void FfmpegBuilder_AddAc3Aac()
{
const string file = @"D:\videos\unprocessed\basic.mkv";
const string file = @"D:\videos\unprocessed\multi_audio.mkv";
var logger = new TestLogger();
const string ffmpeg = @"C:\utils\ffmpeg\ffmpeg.exe";
var vi = new VideoInfoHelper(ffmpeg, logger);
@@ -70,13 +70,17 @@ public class FfmpegBuilder_BasicTests : TestBase
FfmpegBuilderAudioAddTrack ffAddAudio = new ();
ffAddAudio.Codec = "ac3";
ffAddAudio.NewTitle = "new ac3";
ffAddAudio.Channels = 2;
ffAddAudio.Index = 0;
ffAddAudio.PreExecute(args);
ffAddAudio.Execute(args);
FfmpegBuilderAudioAddTrack ffAddAudio2 = new();
ffAddAudio2.Codec = "aac";
ffAddAudio2.RemoveTitle = true;
ffAddAudio2.Index = 1;
ffAddAudio.Channels = 2;
ffAddAudio2.PreExecute(args);
ffAddAudio2.Execute(args);
@@ -51,7 +51,6 @@ public class FfmpegBuilder_VideoEncode_VideoEncodeTests: TestBase
{
string codec = h265 && bit10 ? FfmpegBuilderVideoEncode.CODEC_H265_10BIT :
h265 ? FfmpegBuilderVideoEncode.CODEC_H265 :
bit10 ? FfmpegBuilderVideoEncode.CODEC_H264_10BIT :
FfmpegBuilderVideoEncode.CODEC_H264;
var result = Encode(codec, quality, hardware, TestFile_120_mbps_4k_uhd_hevc_10bit,
@@ -70,14 +69,10 @@ public class FfmpegBuilder_VideoEncode_VideoEncodeTests: TestBase
public void FfmpegBuilder_VideoEncode_H265_10bit() => TestEncode(true, false, true);
[TestMethod]
public void FfmpegBuilder_VideoEncode_H264_10bit_Hardware() => TestEncode(false, true, true);
[TestMethod]
public void FfmpegBuilder_VideoEncode_H264_Hardware() => TestEncode(false, false, true);
[TestMethod]
public void FfmpegBuilder_VideoEncode_H264() => TestEncode(false, false, false);
[TestMethod]
public void FfmpegBuilder_VideoEncode_H264_10bit() => TestEncode(false, false, true);
[TestMethod]
+2 -2
View File
@@ -6,8 +6,8 @@
<Nullable>enable</Nullable>
<IncludeAllContentForSelfExtract>true</IncludeAllContentForSelfExtract>
<PublishSingleFile>true</PublishSingleFile>
<FileVersion>1.0.1.179</FileVersion>
<ProductVersion>1.0.1.179</ProductVersion>
<FileVersion>1.0.2.180</FileVersion>
<ProductVersion>1.0.2.180</ProductVersion>
<PublishTrimmed>true</PublishTrimmed>
<Company>FileFlows</Company>
<Authors>John Andrews</Authors>
+5 -1
View File
@@ -94,7 +94,11 @@
"Codec": "Codec",
"Codec-Help": "The codec to use to encode the audio",
"Language": "Language",
"Language-Help": "Optional [ISO 639-2](https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes) language code to use. Will attempt to find an audio track with this language code if not the best audio track will be used."
"Language-Help": "Optional [ISO 639-2](https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes) language code to use. Will attempt to find an audio track with this language code if not the best audio track will be used.",
"NewTitle": "New Title",
"NewTitle-Help": "Optional title for the newly created audio track. If left blank the source title will be used",
"RemoveTitle": "Remove Title",
"RemoveTitle-Help": "If the source title should be removed and the track should have no title"
}
},
"FfmpegBuilderAudioAdjustVolume": {