From 5e6538eadef96db0fbd0ece5e7a02cb564d186bd Mon Sep 17 00:00:00 2001 From: Revan654 <38091898+Revan654@users.noreply.github.com> Date: Sun, 30 Dec 2018 22:17:30 -0500 Subject: [PATCH] 2.0 --- Encoding/VideoEncoder.vb | 70 +++++++++++++++++++--------------------- Encoding/ffmpegEnc.vb | 2 +- Encoding/x265Enc.vb | 40 ++++++++++++----------- 3 files changed, 57 insertions(+), 55 deletions(-) diff --git a/Encoding/VideoEncoder.vb b/Encoding/VideoEncoder.vb index ab53c360..bd8e2fb9 100644 --- a/Encoding/VideoEncoder.vb +++ b/Encoding/VideoEncoder.vb @@ -309,48 +309,46 @@ Public MustInherit Class VideoEncoder Shared Function GetDefaults() As List(Of VideoEncoder) Dim ret As New List(Of VideoEncoder) - 'StaxRip Configure for Hardware Encoding - - Dim IntelCheck = ProcessHelp.GetStdOut(Package.QSVEnc.Path, "--check-hw") - Dim Intelmatch = Regex.Match(IntelCheck, "Error") - If Intelmatch.Success Then - Else - ret.Add(New QSVEnc()) - Dim intel265 As New QSVEnc() - intel265.Params.Codec.Value = 1 - ret.Add(intel265) - End If - - Dim NvidiaCheck = ProcessHelp.GetStdOut(Package.NVEnc.Path, "--check-features") - Dim Nvidiamatch = Regex.Match(NvidiaCheck, "Error") - If Nvidiamatch.Success Then - Else - Dim nvidia264 As New NVEnc() - ret.Add(nvidia264) - - Dim nvidia265 As New NVEnc() - nvidia265.Params.Codec.Value = 1 - ret.Add(nvidia265) - End If - - Dim AmdCheck = ProcessHelp.GetStdOut(Package.VCEEnc.Path, "--check-features") - Dim Amdmatch = Regex.Match(AmdCheck, "failed to initialize AMF") - If Amdmatch.Success Then - Else - ret.Add(New VCEEnc()) - Dim amd265 As New VCEEnc() - amd265.Params.Codec.Value = 1 - ret.Add(amd265) - End If - ret.Add(New x264Enc) ret.Add(New x265Enc) ret.Add(New Rav1e) + + 'StaxRip Based on Users Hardware, In Progress + 'Dim IntelCheck = ProcessHelp.GetStdOut(Package.QSVEnc.Path, "--check-hw") + 'Dim Intelmatch = Regex.Match(IntelCheck, "Error") + 'If Intelmatch.Success Then + 'Else + ret.Add(New QSVEnc()) + Dim intel265 As New QSVEnc() + intel265.Params.Codec.Value = 1 + ret.Add(intel265) + 'End If + + 'Dim NvidiaCheck = ProcessHelp.GetStdOut(Package.NVEnc.Path, "--check-features") + 'Dim Nvidiamatch = Regex.Match(NvidiaCheck, "Error") + 'If Nvidiamatch.Success Then + 'Else + Dim nvidia264 As New NVEnc() + ret.Add(nvidia264) + + Dim nvidia265 As New NVEnc() + nvidia265.Params.Codec.Value = 1 + ret.Add(nvidia265) + 'End If + + 'Dim AmdCheck = ProcessHelp.GetStdOut(Package.VCEEnc.Path, "--check-features") + 'Dim Amdmatch = Regex.Match(AmdCheck, "failed to initialize AMF") + 'If Amdmatch.Success Then + 'Else + ret.Add(New VCEEnc()) + Dim amd265 As New VCEEnc() + amd265.Params.Codec.Value = 1 + ret.Add(amd265) + ' End If + Dim ffmpeg = New ffmpegEnc() - - For x = 0 To ffmpeg.Params.Codec.Options.Length - 1 Dim ffmpeg2 = New ffmpegEnc() ffmpeg2.Params.Codec.Value = x diff --git a/Encoding/ffmpegEnc.vb b/Encoding/ffmpegEnc.vb index a3650081..78fe7639 100644 --- a/Encoding/ffmpegEnc.vb +++ b/Encoding/ffmpegEnc.vb @@ -153,7 +153,7 @@ Public Class ffmpegEnc Property Decoder As New OptionParam With { .Text = "Decoder", - .Options = {"AviSynth/VapourSynth", "Intel", "DXVA2", "CUDA"}, + .Options = {"AviSynth/VapourSynth", "Intel", "DXVA2", "Nvidia"}, .Values = {"avs", "qsv", "dxva2", "cuvid"}} Property Custom As New StringParam With { diff --git a/Encoding/x265Enc.vb b/Encoding/x265Enc.vb index 1e980a75..fe1b6dc8 100644 --- a/Encoding/x265Enc.vb +++ b/Encoding/x265Enc.vb @@ -187,8 +187,8 @@ Public Class x265Params Property Decoder As New OptionParam With { .Text = "Decoder", - .Options = {"AviSynth/VapourSynth", "Cuvid", "QSVEnc (Intel)", "ffmpeg (Intel)", "ffmpeg (DXVA2)"}, - .Values = {"avs", "nv", "qs", "ffqsv", "ffdxva"}} + .Options = {"AviSynth/VapourSynth", "QSVEnc (Intel)", "ffmpeg (Intel)", "ffmpeg (DXVA2)"}, + .Values = {"avs", "qs", "ffqsv", "ffdxva"}} Property Quant As New NumParam With { .Switches = {"--crf", "--qp"}, @@ -271,6 +271,11 @@ Public Class x265Params .Text = "Ref Frames", .Config = {1, 16}} + Property slowpass As New BoolParam With { + .Switch = "--slow-firstpass", + .NoSwitch = "--no-slow-firstpass", + .Init = True, .Text = "Slow Firstpass"} + Property [Me] As New OptionParam With { .Switch = "--me", .Text = "Motion Search Method", @@ -473,7 +478,8 @@ Public Class x265Params Property qpadaptationrange As New NumParam With { .Switch = " --qp-adaptation-range", .Text = "QP Adaptation Range", - .Config = {1, 6, 0.05, 1}} + .Init = 1.0, + .Config = {1, 6, 0.05, 2}} Property CRFmax As New NumParam With { .Switch = "--crf-max", @@ -841,7 +847,8 @@ Public Class x265Params New NumParam With {.Switch = "--dynamic-rd", .Text = "Dynamic RD", .Config = {0, 4}}, New NumParam With {.Switch = "--refine-intra", .Text = "Refine Intra", .Config = {0, 4}}, New NumParam With {.Switch = "--refine-inter", .Text = "Refine Inter", .Config = {0, 3}}, - qpadaptationrange) + qpadaptationrange, + New BoolParam With {.Switch = "--hevc-aq", .Text = "Mode for HEVC Adaptive Quantization", .Init = False}) Add("Analysis 3", Rect, AMP, New BoolParam With {.Switch = "--tskip", .Text = "Enable evaluation of transform skip coding for 4x4 TU coded blocks"}, New BoolParam With {.Switch = "--refine-mv", .Text = "Enable refinement of motion vector for scaled video"}, @@ -853,8 +860,6 @@ Public Class x265Params RecursionSkip, New BoolParam With {.Switch = "--ssim-rd", .Text = "SSIM RDO"}, New BoolParam With {.Switch = "--splitrd-skip", .Text = "Enable skipping split RD analysis"}) - Add("Analysis 4", - New BoolParam With {.Switch = "--hevc-aq", .Text = "Mode for HEVC Adaptive Quantization", .Init = False}) Add("Rate Control 1", New StringParam With {.Switch = "--zones", .Text = "Zones"}, New StringParam With {.Switch = "--zonefile", .Text = "Zone File", .Quotes = True, .BrowseFile = True}, @@ -867,8 +872,7 @@ Public Class x265Params IPRatio, PBRatio, Cplxblur, QBlur, CUtree, Lossless, StrictCBR, rcGrain, multi_pass_opt_analysis, - multi_pass_opt_distortion) - Add("Rate Control 3", + multi_pass_opt_distortion, New BoolParam() With {.Switch = "--aq-motion", .Text = "AQ Motion"}) Add("Motion Search", SubME, [Me], MErange, MaxMerge, Weightp, Weightb, TemporalMVP, New BoolParam With {.Switch = "--analyze-src-pics", .NoSwitch = "--no-analyze-src-pics", .Text = "Analyze SRC Pics"}) @@ -891,9 +895,9 @@ Public Class x265Params New StringParam With {.Switch = "--pools", .Switches = {"--numa-pools"}, .Text = "Pools", .Quotes = True}, New NumParam With {.Switch = "--slices", .Text = "Slices", .Init = 1}, FrameThreads, WPP, Pmode, PME, - New BoolParam With {.Switch = "--asm", .NoSwitch = "--no-asm", .Text = "ASM", .Init = True}, + New BoolParam With {.Switch = "--asm", .NoSwitch = "--no-asm", .Text = "ASM", .Help = "For AVX512 Vector CPU's, Experiential Feature", .Init = True}, New BoolParam With {.Switch = "--asm avx512", .Text = "AVX 512", .Init = False}, - New BoolParam With {.Switch = "--slow-firstpass", .NoSwitch = "--no-slow-firstpass", .Init = True, .Text = "Slow Firstpass"}, + slowpass, New BoolParam With {.Switch = "--copy-pic", .NoSwitch = "--no-copy-pic", .Init = True, .Text = "Copy Pic"}) Add("Statistic", New OptionParam With {.Switch = "--log-level", .Switches = {"--log"}, .Text = "Log Level", .Options = {"None", "Error", "Warning", "Info", "Debug", "Full"}, .InitValue = 3}, @@ -1038,12 +1042,10 @@ Public Class x265Params Case "ffdxva" Dim crop = If(isCropped, $" -vf ""crop={p.SourceWidth - p.CropLeft - p.CropRight}:{p.SourceHeight - p.CropTop - p.CropBottom}:{p.CropLeft}:{p.CropTop}""", "") sb.Append(Package.ffmpeg.Path.Escape + " -threads 1 -hwaccel dxva2 -i " + p.SourceFile.Escape + " -f yuv4mpegpipe" + crop + " -loglevel fatal -hide_banner - | " + Package.x265.Path.Escape) - Case "nv" - Dim crop = If(isCropped, $" -vf ""crop={p.SourceWidth - p.CropLeft - p.CropRight}:{p.SourceHeight - p.CropTop - p.CropBottom}:{p.CropLeft}:{p.CropTop}""", "") - sb.Append(Package.ffmpeg.Path.Escape + " -threads 1 -hwaccel cuvid -i " + p.SourceFile.Escape + " -f yuv4mpegpipe" + crop + " -loglevel fatal -hide_banner - | " + Package.x265.Path.Escape) End Select End If + If Mode.Value = x265RateMode.TwoPass OrElse Mode.Value = x265RateMode.ThreePass Then sb.Append(" --pass " & pass) @@ -1738,11 +1740,13 @@ Public Class x265Params Scenecut.Value = 0 CUtree.Value = False FrameThreads.Value = 1 - Case 6 '"Animation - PsyRD.DefaultValue = 0.4 - AQStrength.DefaultValue = 0.4 - Deblock.DefaultValue = False - BFrames.DefaultValue = 6 + Case 6 '"Animation" + PsyRD.Value = 0.4 + AQStrength.Value = 0.4 + Deblock.Value = True + DeblockA.Value = 1 + DeblockB.Value = 1 + BFrames.Value = 6 End Select End Sub