From 80d7ada39d4ca1aac01bca43f7102abef6db1171 Mon Sep 17 00:00:00 2001 From: moisesmcardona Date: Fri, 24 Jan 2020 20:40:57 -0500 Subject: [PATCH] Added Advanced Options window. Improvements. --- svt-av1_gui/AdvancedOptions.Designer.vb | 162 ++++++++++++++++++++ svt-av1_gui/AdvancedOptions.resx | 120 +++++++++++++++ svt-av1_gui/AdvancedOptions.vb | 36 +++++ svt-av1_gui/App.config | 6 + svt-av1_gui/Form1.Designer.vb | 116 +++++--------- svt-av1_gui/Form1.vb | 85 +++++----- svt-av1_gui/My Project/Settings.Designer.vb | 26 +++- svt-av1_gui/My Project/Settings.settings | 6 + svt-av1_gui/svt-av1_gui.vbproj | 9 ++ 9 files changed, 440 insertions(+), 126 deletions(-) create mode 100644 svt-av1_gui/AdvancedOptions.Designer.vb create mode 100644 svt-av1_gui/AdvancedOptions.resx create mode 100644 svt-av1_gui/AdvancedOptions.vb diff --git a/svt-av1_gui/AdvancedOptions.Designer.vb b/svt-av1_gui/AdvancedOptions.Designer.vb new file mode 100644 index 0000000..c04ba51 --- /dev/null +++ b/svt-av1_gui/AdvancedOptions.Designer.vb @@ -0,0 +1,162 @@ + _ +Partial Class AdvancedOptions + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + _ + Private Sub InitializeComponent() + Me.HME2 = New System.Windows.Forms.CheckBox() + Me.HME1 = New System.Windows.Forms.CheckBox() + Me.HME0 = New System.Windows.Forms.CheckBox() + Me.HME = New System.Windows.Forms.CheckBox() + Me.GroupBox1 = New System.Windows.Forms.GroupBox() + Me.GroupBox2 = New System.Windows.Forms.GroupBox() + Me.OpenGOP = New System.Windows.Forms.RadioButton() + Me.ClosedGOP = New System.Windows.Forms.RadioButton() + Me.CloseBtn = New System.Windows.Forms.Button() + Me.GroupBox1.SuspendLayout() + Me.GroupBox2.SuspendLayout() + Me.SuspendLayout() + ' + 'HME2 + ' + Me.HME2.AutoSize = True + Me.HME2.Location = New System.Drawing.Point(182, 19) + Me.HME2.Name = "HME2" + Me.HME2.Size = New System.Drawing.Size(56, 17) + Me.HME2.TabIndex = 43 + Me.HME2.Text = "HME2" + Me.HME2.UseVisualStyleBackColor = True + ' + 'HME1 + ' + Me.HME1.AutoSize = True + Me.HME1.Location = New System.Drawing.Point(120, 19) + Me.HME1.Name = "HME1" + Me.HME1.Size = New System.Drawing.Size(56, 17) + Me.HME1.TabIndex = 42 + Me.HME1.Text = "HME1" + Me.HME1.UseVisualStyleBackColor = True + ' + 'HME0 + ' + Me.HME0.AutoSize = True + Me.HME0.Location = New System.Drawing.Point(62, 19) + Me.HME0.Name = "HME0" + Me.HME0.Size = New System.Drawing.Size(56, 17) + Me.HME0.TabIndex = 41 + Me.HME0.Text = "HME0" + Me.HME0.UseVisualStyleBackColor = True + ' + 'HME + ' + Me.HME.AutoSize = True + Me.HME.Location = New System.Drawing.Point(6, 19) + Me.HME.Name = "HME" + Me.HME.Size = New System.Drawing.Size(50, 17) + Me.HME.TabIndex = 40 + Me.HME.Text = "HME" + Me.HME.UseVisualStyleBackColor = True + ' + 'GroupBox1 + ' + Me.GroupBox1.Controls.Add(Me.HME) + Me.GroupBox1.Controls.Add(Me.HME2) + Me.GroupBox1.Controls.Add(Me.HME0) + Me.GroupBox1.Controls.Add(Me.HME1) + Me.GroupBox1.Location = New System.Drawing.Point(12, 12) + Me.GroupBox1.Name = "GroupBox1" + Me.GroupBox1.Size = New System.Drawing.Size(247, 53) + Me.GroupBox1.TabIndex = 44 + Me.GroupBox1.TabStop = False + Me.GroupBox1.Text = "HME" + ' + 'GroupBox2 + ' + Me.GroupBox2.Controls.Add(Me.ClosedGOP) + Me.GroupBox2.Controls.Add(Me.OpenGOP) + Me.GroupBox2.Location = New System.Drawing.Point(12, 71) + Me.GroupBox2.Name = "GroupBox2" + Me.GroupBox2.Size = New System.Drawing.Size(247, 46) + Me.GroupBox2.TabIndex = 45 + Me.GroupBox2.TabStop = False + Me.GroupBox2.Text = "GOP Type:" + ' + 'OpenGOP + ' + Me.OpenGOP.AutoSize = True + Me.OpenGOP.Location = New System.Drawing.Point(6, 19) + Me.OpenGOP.Name = "OpenGOP" + Me.OpenGOP.Size = New System.Drawing.Size(51, 17) + Me.OpenGOP.TabIndex = 0 + Me.OpenGOP.TabStop = True + Me.OpenGOP.Text = "Open" + Me.OpenGOP.UseVisualStyleBackColor = True + ' + 'ClosedGOP + ' + Me.ClosedGOP.AutoSize = True + Me.ClosedGOP.Location = New System.Drawing.Point(63, 19) + Me.ClosedGOP.Name = "ClosedGOP" + Me.ClosedGOP.Size = New System.Drawing.Size(57, 17) + Me.ClosedGOP.TabIndex = 1 + Me.ClosedGOP.TabStop = True + Me.ClosedGOP.Text = "Closed" + Me.ClosedGOP.UseVisualStyleBackColor = True + ' + 'CloseBtn + ' + Me.CloseBtn.Location = New System.Drawing.Point(12, 134) + Me.CloseBtn.Name = "CloseBtn" + Me.CloseBtn.Size = New System.Drawing.Size(247, 23) + Me.CloseBtn.TabIndex = 46 + Me.CloseBtn.Text = "Close" + Me.CloseBtn.UseVisualStyleBackColor = True + ' + 'AdvancedOptions + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(278, 169) + Me.Controls.Add(Me.CloseBtn) + Me.Controls.Add(Me.GroupBox2) + Me.Controls.Add(Me.GroupBox1) + Me.MaximizeBox = False + Me.MinimizeBox = False + Me.Name = "AdvancedOptions" + Me.Text = "Advanced Options" + Me.GroupBox1.ResumeLayout(False) + Me.GroupBox1.PerformLayout() + Me.GroupBox2.ResumeLayout(False) + Me.GroupBox2.PerformLayout() + Me.ResumeLayout(False) + + End Sub + + Friend WithEvents HME2 As CheckBox + Friend WithEvents HME1 As CheckBox + Friend WithEvents HME0 As CheckBox + Friend WithEvents HME As CheckBox + Friend WithEvents GroupBox1 As GroupBox + Friend WithEvents GroupBox2 As GroupBox + Friend WithEvents ClosedGOP As RadioButton + Friend WithEvents OpenGOP As RadioButton + Friend WithEvents CloseBtn As Button +End Class diff --git a/svt-av1_gui/AdvancedOptions.resx b/svt-av1_gui/AdvancedOptions.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/svt-av1_gui/AdvancedOptions.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/svt-av1_gui/AdvancedOptions.vb b/svt-av1_gui/AdvancedOptions.vb new file mode 100644 index 0000000..14f14e5 --- /dev/null +++ b/svt-av1_gui/AdvancedOptions.vb @@ -0,0 +1,36 @@ +Public Class AdvancedOptions + Private Sub HME_CheckedChanged(sender As Object, e As EventArgs) Handles HME.CheckedChanged + My.Settings.HME = HME.Checked + My.Settings.Save() + End Sub + + Private Sub HME0_CheckedChanged(sender As Object, e As EventArgs) Handles HME0.CheckedChanged + My.Settings.HME0 = HME0.Checked + My.Settings.Save() + End Sub + + Private Sub HME1_CheckedChanged(sender As Object, e As EventArgs) Handles HME1.CheckedChanged + My.Settings.HME1 = HME1.Checked + My.Settings.Save() + End Sub + + Private Sub HME2_CheckedChanged(sender As Object, e As EventArgs) Handles HME2.CheckedChanged + My.Settings.HME2 = HME2.Checked + My.Settings.Save() + End Sub + + Private Sub OpenGOP_CheckedChanged(sender As Object, e As EventArgs) Handles OpenGOP.CheckedChanged + My.Settings.OpenGOP = OpenGOP.Checked + My.Settings.Save() + End Sub + + Private Sub ClosedGOP_CheckedChanged(sender As Object, e As EventArgs) Handles ClosedGOP.CheckedChanged + My.Settings.ClosedGOP = ClosedGOP.Checked + My.Settings.Save() + + End Sub + + Private Sub CloseBtn_Click(sender As Object, e As EventArgs) Handles CloseBtn.Click + Me.Close() + End Sub +End Class \ No newline at end of file diff --git a/svt-av1_gui/App.config b/svt-av1_gui/App.config index b53582d..a684c32 100644 --- a/svt-av1_gui/App.config +++ b/svt-av1_gui/App.config @@ -55,6 +55,12 @@ False + + False + + + True + diff --git a/svt-av1_gui/Form1.Designer.vb b/svt-av1_gui/Form1.Designer.vb index 2f64713..cecbe24 100644 --- a/svt-av1_gui/Form1.Designer.vb +++ b/svt-av1_gui/Form1.Designer.vb @@ -39,10 +39,6 @@ Partial Class Form1 Me.Label11 = New System.Windows.Forms.Label() Me.rows = New System.Windows.Forms.NumericUpDown() Me.Label10 = New System.Windows.Forms.Label() - Me.HME2 = New System.Windows.Forms.CheckBox() - Me.HME1 = New System.Windows.Forms.CheckBox() - Me.HME0 = New System.Windows.Forms.CheckBox() - Me.HME = New System.Windows.Forms.CheckBox() Me.Label3 = New System.Windows.Forms.Label() Me.quantizer = New System.Windows.Forms.NumericUpDown() Me.audioBitrate = New System.Windows.Forms.NumericUpDown() @@ -56,13 +52,14 @@ Partial Class Form1 Me.Label14 = New System.Windows.Forms.Label() Me.ProgressLog = New System.Windows.Forms.RichTextBox() Me.SplitContainer1 = New System.Windows.Forms.SplitContainer() + Me.OutputFolderBrowseBtn = New System.Windows.Forms.Button() + Me.InputFolderBrowseBtn = New System.Windows.Forms.Button() Me.NoPipes = New System.Windows.Forms.CheckBox() Me.ffmpegVersionLabel = New System.Windows.Forms.Label() Me.PauseResumeButton = New System.Windows.Forms.Button() Me.ClearLogBtn = New System.Windows.Forms.Button() Me.SaveLogBtn = New System.Windows.Forms.Button() - Me.InputFolderBrowseBtn = New System.Windows.Forms.Button() - Me.OutputFolderBrowseBtn = New System.Windows.Forms.Button() + Me.AdvancedOptionsButton = New System.Windows.Forms.Button() Me.GroupBox1.SuspendLayout() CType(Me.columns, System.ComponentModel.ISupportInitialize).BeginInit() CType(Me.rows, System.ComponentModel.ISupportInitialize).BeginInit() @@ -167,6 +164,7 @@ Partial Class Form1 Me.GroupBox1.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _ Or System.Windows.Forms.AnchorStyles.Left) _ Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.GroupBox1.Controls.Add(Me.AdvancedOptionsButton) Me.GroupBox1.Controls.Add(Me.TwoPassEncoding) Me.GroupBox1.Controls.Add(Me.AdditionalArguments) Me.GroupBox1.Controls.Add(Me.Label4) @@ -174,10 +172,6 @@ Partial Class Form1 Me.GroupBox1.Controls.Add(Me.Label11) Me.GroupBox1.Controls.Add(Me.rows) Me.GroupBox1.Controls.Add(Me.Label10) - Me.GroupBox1.Controls.Add(Me.HME2) - Me.GroupBox1.Controls.Add(Me.HME1) - Me.GroupBox1.Controls.Add(Me.HME0) - Me.GroupBox1.Controls.Add(Me.HME) Me.GroupBox1.Controls.Add(Me.Label3) Me.GroupBox1.Controls.Add(Me.quantizer) Me.GroupBox1.Controls.Add(Me.audioBitrate) @@ -194,7 +188,7 @@ Partial Class Form1 'TwoPassEncoding ' Me.TwoPassEncoding.AutoSize = True - Me.TwoPassEncoding.Location = New System.Drawing.Point(247, 58) + Me.TwoPassEncoding.Location = New System.Drawing.Point(304, 35) Me.TwoPassEncoding.Name = "TwoPassEncoding" Me.TwoPassEncoding.Size = New System.Drawing.Size(58, 17) Me.TwoPassEncoding.TabIndex = 46 @@ -205,7 +199,7 @@ Partial Class Form1 ' Me.AdditionalArguments.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left) _ Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.AdditionalArguments.Location = New System.Drawing.Point(9, 98) + Me.AdditionalArguments.Location = New System.Drawing.Point(9, 82) Me.AdditionalArguments.Name = "AdditionalArguments" Me.AdditionalArguments.Size = New System.Drawing.Size(415, 20) Me.AdditionalArguments.TabIndex = 45 @@ -213,7 +207,7 @@ Partial Class Form1 'Label4 ' Me.Label4.AutoSize = True - Me.Label4.Location = New System.Drawing.Point(6, 82) + Me.Label4.Location = New System.Drawing.Point(6, 66) Me.Label4.Name = "Label4" Me.Label4.Size = New System.Drawing.Size(108, 13) Me.Label4.TabIndex = 44 @@ -253,50 +247,6 @@ Partial Class Form1 Me.Label10.TabIndex = 40 Me.Label10.Text = "Rows:" ' - 'HME2 - ' - Me.HME2.AutoSize = True - Me.HME2.Location = New System.Drawing.Point(185, 58) - Me.HME2.Name = "HME2" - Me.HME2.Size = New System.Drawing.Size(56, 17) - Me.HME2.TabIndex = 39 - Me.HME2.Text = "HME2" - Me.HME2.UseVisualStyleBackColor = True - ' - 'HME1 - ' - Me.HME1.AutoSize = True - Me.HME1.Location = New System.Drawing.Point(123, 58) - Me.HME1.Name = "HME1" - Me.HME1.Size = New System.Drawing.Size(56, 17) - Me.HME1.TabIndex = 38 - Me.HME1.Text = "HME1" - Me.HME1.UseVisualStyleBackColor = True - ' - 'HME0 - ' - Me.HME0.AutoSize = True - Me.HME0.Checked = True - Me.HME0.CheckState = System.Windows.Forms.CheckState.Checked - Me.HME0.Location = New System.Drawing.Point(65, 58) - Me.HME0.Name = "HME0" - Me.HME0.Size = New System.Drawing.Size(56, 17) - Me.HME0.TabIndex = 37 - Me.HME0.Text = "HME0" - Me.HME0.UseVisualStyleBackColor = True - ' - 'HME - ' - Me.HME.AutoSize = True - Me.HME.Checked = True - Me.HME.CheckState = System.Windows.Forms.CheckState.Checked - Me.HME.Location = New System.Drawing.Point(9, 58) - Me.HME.Name = "HME" - Me.HME.Size = New System.Drawing.Size(50, 17) - Me.HME.TabIndex = 36 - Me.HME.Text = "HME" - Me.HME.UseVisualStyleBackColor = True - ' 'Label3 ' Me.Label3.AutoSize = True @@ -342,7 +292,6 @@ Partial Class Form1 Me.speed.Name = "speed" Me.speed.Size = New System.Drawing.Size(50, 20) Me.speed.TabIndex = 6 - Me.speed.Value = New Decimal(New Integer() {8, 0, 0, 0}) ' 'Label7 ' @@ -454,6 +403,26 @@ Partial Class Form1 Me.SplitContainer1.SplitterDistance = 448 Me.SplitContainer1.TabIndex = 19 ' + 'OutputFolderBrowseBtn + ' + Me.OutputFolderBrowseBtn.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.OutputFolderBrowseBtn.Location = New System.Drawing.Point(345, 65) + Me.OutputFolderBrowseBtn.Name = "OutputFolderBrowseBtn" + Me.OutputFolderBrowseBtn.Size = New System.Drawing.Size(91, 23) + Me.OutputFolderBrowseBtn.TabIndex = 49 + Me.OutputFolderBrowseBtn.Text = "Browse Folder" + Me.OutputFolderBrowseBtn.UseVisualStyleBackColor = True + ' + 'InputFolderBrowseBtn + ' + Me.InputFolderBrowseBtn.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.InputFolderBrowseBtn.Location = New System.Drawing.Point(345, 23) + Me.InputFolderBrowseBtn.Name = "InputFolderBrowseBtn" + Me.InputFolderBrowseBtn.Size = New System.Drawing.Size(91, 23) + Me.InputFolderBrowseBtn.TabIndex = 48 + Me.InputFolderBrowseBtn.Text = "Browse Folder" + Me.InputFolderBrowseBtn.UseVisualStyleBackColor = True + ' 'NoPipes ' Me.NoPipes.AutoSize = True @@ -505,25 +474,15 @@ Partial Class Form1 Me.SaveLogBtn.Text = "Save Log" Me.SaveLogBtn.UseVisualStyleBackColor = True ' - 'InputFolderBrowseBtn + 'AdvancedOptionsButton ' - Me.InputFolderBrowseBtn.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.InputFolderBrowseBtn.Location = New System.Drawing.Point(345, 23) - Me.InputFolderBrowseBtn.Name = "InputFolderBrowseBtn" - Me.InputFolderBrowseBtn.Size = New System.Drawing.Size(91, 23) - Me.InputFolderBrowseBtn.TabIndex = 48 - Me.InputFolderBrowseBtn.Text = "Browse Folder" - Me.InputFolderBrowseBtn.UseVisualStyleBackColor = True - ' - 'OutputFolderBrowseBtn - ' - Me.OutputFolderBrowseBtn.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) - Me.OutputFolderBrowseBtn.Location = New System.Drawing.Point(345, 65) - Me.OutputFolderBrowseBtn.Name = "OutputFolderBrowseBtn" - Me.OutputFolderBrowseBtn.Size = New System.Drawing.Size(91, 23) - Me.OutputFolderBrowseBtn.TabIndex = 49 - Me.OutputFolderBrowseBtn.Text = "Browse Folder" - Me.OutputFolderBrowseBtn.UseVisualStyleBackColor = True + Me.AdvancedOptionsButton.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.AdvancedOptionsButton.Location = New System.Drawing.Point(304, 116) + Me.AdvancedOptionsButton.Name = "AdvancedOptionsButton" + Me.AdvancedOptionsButton.Size = New System.Drawing.Size(120, 23) + Me.AdvancedOptionsButton.TabIndex = 47 + Me.AdvancedOptionsButton.Text = "Advanced Options" + Me.AdvancedOptionsButton.UseVisualStyleBackColor = True ' 'Form1 ' @@ -578,10 +537,6 @@ Partial Class Form1 Friend WithEvents quantizer As NumericUpDown Friend WithEvents ffmpegVersionLabel As Label Friend WithEvents Label3 As Label - Friend WithEvents HME2 As CheckBox - Friend WithEvents HME1 As CheckBox - Friend WithEvents HME0 As CheckBox - Friend WithEvents HME As CheckBox Friend WithEvents columns As NumericUpDown Friend WithEvents Label11 As Label Friend WithEvents rows As NumericUpDown @@ -592,4 +547,5 @@ Partial Class Form1 Friend WithEvents NoPipes As CheckBox Friend WithEvents OutputFolderBrowseBtn As Button Friend WithEvents InputFolderBrowseBtn As Button + Friend WithEvents AdvancedOptionsButton As Button End Class diff --git a/svt-av1_gui/Form1.vb b/svt-av1_gui/Form1.vb index 4fdcd6b..9a91e6d 100644 --- a/svt-av1_gui/Form1.vb +++ b/svt-av1_gui/Form1.vb @@ -63,10 +63,7 @@ Public Class Form1 quantizer.Enabled = False rows.Enabled = False columns.Enabled = False - HME.Enabled = False - HME0.Enabled = False - HME1.Enabled = False - HME2.Enabled = False + AdvancedOptionsButton.Enabled = False AdditionalArguments.Enabled = False speed.Enabled = False tempLocationPath.Enabled = False @@ -165,10 +162,7 @@ Public Class Form1 quantizer.Enabled = True rows.Enabled = True columns.Enabled = True - HME.Enabled = True - HME0.Enabled = True - HME1.Enabled = True - HME2.Enabled = True + AdvancedOptionsButton.Enabled = True AdditionalArguments.Enabled = True tempLocationPath.Enabled = True BrowseTempLocation.Enabled = True @@ -184,6 +178,10 @@ Public Class Form1 MsgBox("Finished") End Function Private Function Run_svtav1(Input_File As String, Output_File As String, SecondPassEnabled As Boolean, Optional SecondPass As Boolean = False) + If IO.File.Exists(My.Settings.tempFolder + "/FirstPassComplete") And SecondPass = False Then + Run_svtav1(Input_File, Output_File, SecondPassEnabled, True) + Return True + End If UpdateLog("Getting Video Info") Dim InputPipe As New IO.Pipes.NamedPipeServerStream("in.y4m", IO.Pipes.PipeDirection.Out, -1, IO.Pipes.PipeTransmissionMode.Byte, IO.Pipes.PipeOptions.Asynchronous, PipeBuffer, 0) Dim SourceFrameCount As String = String.Empty @@ -237,6 +235,10 @@ Public Class Form1 Exit While End If End While + If SourceFrameCount = String.Empty Then + UpdateLog("This video cannot be encoded using pipes.") + Return True + End If If SourceFrameNum = String.Empty And SourceFrameDen = String.Empty And Not Convert.ToDouble(SourceFrameRate) Mod 1 = 0 Then SourceFrameNum = Convert.ToString(Convert.ToDouble(SourceFrameRate) * 1000) SourceFrameDen = "1000" @@ -252,6 +254,7 @@ Public Class Form1 If My.Settings.HME0 Then SVTAV1CommandLineString += " -hme-l0 1 " Else SVTAV1CommandLineString += " -hme-l0 0 " If My.Settings.HME1 Then SVTAV1CommandLineString += " -hme-l1 1 " Else SVTAV1CommandLineString += " -hme-l1 0 " If My.Settings.HME2 Then SVTAV1CommandLineString += " -hme-l2 1 " Else SVTAV1CommandLineString += " -hme-l2 0 " + If My.Settings.ClosedGOP Then SVTAV1CommandLineString += " -irefresh-type 2" If SourceFrameNum = String.Empty And SourceFrameDen = String.Empty Then SVTAV1CommandLineString += " -fps " + SourceFrameRate Else @@ -263,12 +266,12 @@ Public Class Form1 SVTAV1CommandLineString += " -enc-mode-2p " + My.Settings.speed.ToString() + " " + My.Settings.AdditionalArguments + " -n " + SourceFrameCount + " -w " + SourceWidth + " -h " + SourceHeight + " -i ""\\.\pipe\in.y4m"" -output-stat-file """ + My.Settings.tempFolder + "/OutputStatFile""" Else UpdateLog("Performing Second Pass Encoding") - SVTAV1CommandLineString += " -enc-mode-2p " + My.Settings.speed.ToString() + "" + My.Settings.AdditionalArguments + " -n " + SourceFrameCount + " -w " + SourceWidth + " -h " + SourceHeight + " -i ""\\.\pipe\in.y4m"" -input-stat-file """ + My.Settings.tempFolder + "/OutputStatFile"" -b """ + Output_File + """" + SVTAV1CommandLineString += " -enc-mode-2p " + My.Settings.speed.ToString() + " " + My.Settings.AdditionalArguments + " -n " + SourceFrameCount + " -w " + SourceWidth + " -h " + SourceHeight + " -i ""\\.\pipe\in.y4m"" -input-stat-file """ + My.Settings.tempFolder + "/OutputStatFile"" -b """ + Output_File + """" End If Else SVTAV1CommandLineString += " " + My.Settings.AdditionalArguments + " -n " + SourceFrameCount + " -w " + SourceWidth + " -h " + SourceHeight + " -i ""\\.\pipe\in.y4m"" -b """ + Output_File + """" End If - UpdateLog(SVTAV1CommandLineString) + UpdateLog("Using the following SVT-AV1 parameters: " + SVTAV1CommandLineString) svtav1Process.StartInfo.Arguments = SVTAV1CommandLineString svtav1Process.StartInfo.CreateNoWindow = True svtav1Process.StartInfo.RedirectStandardOutput = True @@ -291,6 +294,8 @@ Public Class Form1 WriteByteAsync(InputPipe, Input_File) svtav1Process.WaitForExit() If SecondPassEnabled And Not SecondPass Then + UpdateLog("First Pass encoding complete!") + IO.File.WriteAllText(My.Settings.tempFolder + "/FirstPassComplete", "") Run_svtav1(Input_File, Output_File, SecondPassEnabled, True) Else UpdateLog("Video encoding complete.") @@ -326,7 +331,10 @@ Public Class Form1 InputPipe.Dispose() End Sub Private Function Run_svtav1_no_pipe(Temp_Location As String, Output_File As String, SecondPassEnabled As Boolean, Optional SecondPass As Boolean = False) - UpdateLog("Getting Video Info") + If IO.File.Exists(My.Settings.tempFolder + "/FirstPassComplete") And SecondPass = False Then + Run_svtav1_no_pipe(Temp_Location, Output_File, SecondPassEnabled, True) + Return True + End If UpdateLog("Encoding Video") Using svtav1Process As New Process() svtav1Process.StartInfo.FileName = "SvtAv1EncApp.exe" @@ -335,6 +343,7 @@ Public Class Form1 If My.Settings.HME0 Then SVTAV1CommandLineString += " -hme-l0 1 " Else SVTAV1CommandLineString += " -hme-l0 0 " If My.Settings.HME1 Then SVTAV1CommandLineString += " -hme-l1 1 " Else SVTAV1CommandLineString += " -hme-l1 0 " If My.Settings.HME2 Then SVTAV1CommandLineString += " -hme-l2 1 " Else SVTAV1CommandLineString += " -hme-l2 0 " + If My.Settings.ClosedGOP Then SVTAV1CommandLineString += " -irefresh-type 2" If SecondPassEnabled Then If Not SecondPass Then UpdateLog("Performing First Pass Encoding") @@ -346,7 +355,7 @@ Public Class Form1 Else SVTAV1CommandLineString += " " + My.Settings.AdditionalArguments + " -i """ + Temp_Location + "/y4m-video.y4m"" -b """ + Output_File + """" End If - UpdateLog(SVTAV1CommandLineString) + UpdateLog("Using the following SVT-AV1 parameters: " + SVTAV1CommandLineString) svtav1Process.StartInfo.Arguments = SVTAV1CommandLineString svtav1Process.StartInfo.CreateNoWindow = True svtav1Process.StartInfo.RedirectStandardOutput = True @@ -368,6 +377,8 @@ Public Class Form1 svtav1Process.BeginErrorReadLine() svtav1Process.WaitForExit() If SecondPassEnabled And Not SecondPass Then + UpdateLog("First Pass encoding complete!") + IO.File.WriteAllText(My.Settings.tempFolder + "/FirstPassComplete", "") Run_svtav1_no_pipe(Temp_Location, Output_File, SecondPassEnabled, True) Else UpdateLog("Video encoding complete.") @@ -392,7 +403,13 @@ Public Class Form1 End Function Private Function clean_temp_folder(tempFolder As String) As Boolean For Each File As String In IO.Directory.GetFiles(tempFolder) - If IO.Path.GetExtension(File) = ".ivf" Or IO.Path.GetFileName(File) = "y4m-video.y4m" Or IO.Path.GetFileName(File) = "opus-audio.opus" Or IO.Path.GetFileName(File) = "lock" Or IO.Path.GetFileName(File) = "InputVideo" Or IO.Path.GetFileName(File) = "OutputStatFile" Then + If IO.Path.GetExtension(File) = ".ivf" Or + IO.Path.GetFileName(File) = "y4m-video.y4m" Or + IO.Path.GetFileName(File) = "opus-audio.opus" Or + IO.Path.GetFileName(File) = "lock" Or + IO.Path.GetFileName(File) = "InputVideo" Or + IO.Path.GetFileName(File) = "OutputStatFile" Or + IO.Path.GetFileName(File) = "FirstPassComplete" Then IO.File.Delete(File) End If Next @@ -445,10 +462,12 @@ Public Class Form1 speed.Value = My.Settings.speed rows.Value = My.Settings.TilingRows columns.Value = My.Settings.TilingColumns - HME.Checked = My.Settings.HME - HME0.Checked = My.Settings.HME0 - HME1.Checked = My.Settings.HME1 - HME2.Checked = My.Settings.HME2 + AdvancedOptions.HME.Checked = My.Settings.HME + AdvancedOptions.HME0.Checked = My.Settings.HME0 + AdvancedOptions.HME1.Checked = My.Settings.HME1 + AdvancedOptions.HME2.Checked = My.Settings.HME2 + AdvancedOptions.OpenGOP.Checked = My.Settings.OpenGOP + AdvancedOptions.ClosedGOP.Checked = My.Settings.ClosedGOP AdditionalArguments.Text = My.Settings.AdditionalArguments audioBitrate.Value = My.Settings.AudioBitrate tempLocationPath.Text = My.Settings.tempFolder @@ -664,34 +683,6 @@ Public Class Form1 End If End Sub - Private Sub HME_CheckedChanged(sender As Object, e As EventArgs) Handles HME.CheckedChanged - If GUILoaded Then - My.Settings.HME = HME.Checked - My.Settings.Save() - End If - End Sub - - Private Sub HME0_CheckedChanged(sender As Object, e As EventArgs) Handles HME0.CheckedChanged - If GUILoaded Then - My.Settings.HME0 = HME0.Checked - My.Settings.Save() - End If - End Sub - - Private Sub HME1_CheckedChanged(sender As Object, e As EventArgs) Handles HME1.CheckedChanged - If GUILoaded Then - My.Settings.HME1 = HME1.Checked - My.Settings.Save() - End If - End Sub - - Private Sub HME2_CheckedChanged(sender As Object, e As EventArgs) Handles HME2.CheckedChanged - If GUILoaded Then - My.Settings.HME2 = HME2.Checked - My.Settings.Save() - End If - End Sub - Private Sub AdditionalArguments_TextChanged(sender As Object, e As EventArgs) Handles AdditionalArguments.TextChanged If GUILoaded Then My.Settings.AdditionalArguments = AdditionalArguments.Text @@ -742,4 +733,8 @@ Public Class Form1 OutputTxt.Text = OutputBrowser.SelectedPath End If End Sub + + Private Sub AdvancedOptionsButton_Click(sender As Object, e As EventArgs) Handles AdvancedOptionsButton.Click + AdvancedOptions.ShowDialog() + End Sub End Class diff --git a/svt-av1_gui/My Project/Settings.Designer.vb b/svt-av1_gui/My Project/Settings.Designer.vb index 5eff73d..a5c5943 100644 --- a/svt-av1_gui/My Project/Settings.Designer.vb +++ b/svt-av1_gui/My Project/Settings.Designer.vb @@ -15,7 +15,7 @@ Option Explicit On Namespace My _ Partial Friend NotInheritable Class MySettings Inherits Global.System.Configuration.ApplicationSettingsBase @@ -221,6 +221,30 @@ Namespace My Me("NoPipes") = value End Set End Property + + _ + Public Property OpenGOP() As Boolean + Get + Return CType(Me("OpenGOP"),Boolean) + End Get + Set + Me("OpenGOP") = value + End Set + End Property + + _ + Public Property ClosedGOP() As Boolean + Get + Return CType(Me("ClosedGOP"),Boolean) + End Get + Set + Me("ClosedGOP") = value + End Set + End Property End Class End Namespace diff --git a/svt-av1_gui/My Project/Settings.settings b/svt-av1_gui/My Project/Settings.settings index 52ce7ed..a4ea9d4 100644 --- a/svt-av1_gui/My Project/Settings.settings +++ b/svt-av1_gui/My Project/Settings.settings @@ -44,5 +44,11 @@ False + + False + + + True + \ No newline at end of file diff --git a/svt-av1_gui/svt-av1_gui.vbproj b/svt-av1_gui/svt-av1_gui.vbproj index 4781017..becedfb 100644 --- a/svt-av1_gui/svt-av1_gui.vbproj +++ b/svt-av1_gui/svt-av1_gui.vbproj @@ -86,6 +86,12 @@ + + AdvancedOptions.vb + + + Form + Form @@ -111,6 +117,9 @@ + + AdvancedOptions.vb + Form1.vb