h265 and debug mode

-ffmpeg command for h265 added
-debug mode added
This commit is contained in:
hama3254 2020-02-12 22:08:02 +01:00
parent 846f7f9369
commit 295b0b8320
13 changed files with 140 additions and 27 deletions

Binary file not shown.

View File

@ -4,6 +4,8 @@ Imports System.IO
Imports Microsoft.Win32
Imports System.ComponentModel
Public Class Main
Dim Debug1 As Boolean = False
Dim Debug2 As Boolean = False
Public LoggingBrowser As Boolean = False
Public Thumbnail As String = Nothing
Public MergeSubstoMP4 As Boolean = False
@ -24,7 +26,7 @@ Public Class Main
Public LoginOnly As String = "False"
Public CreditsOnly As Boolean = False
Public Pfad As String = My.Computer.FileSystem.CurrentDirectory
Dim ffmpeg_command As String = " -c copy -bsf:a aac_adtstoasc"
Public ffmpeg_command As String = " -c copy -bsf:a aac_adtstoasc" '" -c:v hevc_nvenc -preset fast -b:v 6M -bsf:a aac_adtstoasc "
Public Resu As Integer
Dim Resu2 As String
Public ResuSave As String = "6666x6666"
@ -179,12 +181,18 @@ Public Class Main
'Try
' Dim rkg As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\CRDownloader")
' ffmpeg_command = rkg.GetValue("ffmpeg_command").ToString
'Catch ex As Exception
' ffmpeg_command = " -c copy -bsf:a aac_adtstoasc"
'End Try
Try
Dim rkg As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\CRDownloader")
ffmpeg_command = rkg.GetValue("ffmpeg_command").ToString
Catch ex As Exception
ffmpeg_command = " -c copy -bsf:a aac_adtstoasc "
End Try
If ffmpeg_command = " -c:v hevc_nvenc -preset fast -b:v 6M -bsf:a aac_adtstoasc " Then
MaxDL = 4
ElseIf ffmpeg_command = " -c:v libx265 -preset fast -b:v 6M -bsf:a aac_adtstoasc " Then
MaxDL = 1
End If
Try
Dim rkg As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\CRDownloader")
Resu = Integer.Parse(rkg.GetValue("Resu").ToString)
@ -1306,7 +1314,7 @@ Public Class Main
Else
URL_DL = CR_URI_Master
End If
MsgBox(URL_DL)
'MsgBox(URL_DL)
Else
@ -1348,7 +1356,7 @@ Public Class Main
Else
URL_DL = VLC_URI_3(0).Trim()
End If
MsgBox(URL_DL)
'MsgBox(URL_DL)
End If
#Region "thumbnail"
Dim thumbnail As String() = WebbrowserText.Split(New String() {My.Resources.thumbnailString}, System.StringSplitOptions.RemoveEmptyEntries)
@ -1473,10 +1481,16 @@ Public Class Main
'Dim cmd As String = "-i " + Chr(34) + URL_DL + Chr(34) + " -c copy -bsf:a aac_adtstoasc " + Pfad_DL 'start ffmpeg with command strFFCMD string
Dim cmd As String = "-i " + Chr(34) + URL_DL + Chr(34) + " " + ffmpeg_command + " " + DL_Pfad 'start ffmpeg with command strFFCMD string
If MergeSubstoMP4 = True Then
cmd = DL_URL + " " + DL_Pfad
If CBool(InStr(DL_URL, "-i " + Chr(34))) = True Then
cmd = DL_URL + " " + DL_Pfad
End If
End If
'MsgBox(cmd)
If Debug1 = True Then
MsgBox(cmd)
End If
'all parameters required to run the process
startinfo.FileName = exepath
startinfo.Arguments = cmd
@ -1497,9 +1511,9 @@ Public Class Main
End Function
Private Sub Main_DoubleClick(sender As Object, e As EventArgs) Handles Me.DoubleClick
For i As Integer = 0 To ListOfStreams.Count - 1
MsgBox(ListOfStreams(i))
Next
'For i As Integer = 0 To ListOfStreams.Count - 1
'MsgBox(ListOfStreams(i))
'Next
End Sub
Sub TestOutput(ByVal sender As Object, ByVal e As DataReceivedEventArgs)
@ -1510,6 +1524,10 @@ Public Class Main
If MergeSubstoMP4 = False Then
If CBool(InStr(e.Data, "Stream #")) And CBool(InStr(e.Data, "Video")) = True Then
'MsgBox(True.ToString + vbNewLine + e.Data)
'MsgBox(InStr(e.Data, "Stream #").ToString + vbNewLine + InStr(e.Data, "Video").ToString)
'MsgBox("with CBool" + vbNewLine + CBool(InStr(e.Data, "Stream #")).ToString + vbNewLine + CBool(InStr(e.Data, "Video")).ToString)
ListOfStreams.Add(e.Data)
End If
If InStr(e.Data, "Stream #") And InStr(e.Data, " -> ") Then
@ -1563,7 +1581,7 @@ Public Class Main
Dim ZeitGesamt As String() = e.Data.Split(New String() {"Duration: "}, System.StringSplitOptions.RemoveEmptyEntries)
Dim ZeitGesamt2 As String() = ZeitGesamt(1).Split(New [Char]() {System.Convert.ToChar(".")})
Dim ZeitGesamtSplit() As String = ZeitGesamt2(0).Split(New [Char]() {System.Convert.ToChar(":")})
MsgBox(ZeitGesamt2(0))
'MsgBox(ZeitGesamt2(0))
Dim ZeitGesamtInteger As Integer = CInt(ZeitGesamtSplit(0)) * 3600 + CInt(ZeitGesamtSplit(1)) * 60 + CInt(ZeitGesamtSplit(2))
ListView1.Items.Item(i).Text = ZeitGesamtInteger
@ -1947,5 +1965,16 @@ Public Class Main
End Sub
Private Sub pictureBox2_DoubleClick(sender As Object, e As EventArgs) Handles pictureBox2.DoubleClick
If Debug1 = True Then
Debug2 = True
MsgBox("Debug activated")
ElseIf Debug2 = True Then
My.Computer.Clipboard.SetText(WebbrowserText)
MsgBox("webbrowser text copyed to the clipboard")
Else
Debug1 = True
End If
End Sub
End Class

View File

@ -41,6 +41,8 @@ Partial Class einstellungen
Me.GroupBox4 = New System.Windows.Forms.GroupBox()
Me.PictureBox2 = New System.Windows.Forms.PictureBox()
Me.TabPage2 = New System.Windows.Forms.TabPage()
Me.GroupBox2 = New System.Windows.Forms.GroupBox()
Me.FFMPEG_Command = New System.Windows.Forms.ComboBox()
Me.SoftSubs = New System.Windows.Forms.GroupBox()
Me.MergeMP4 = New System.Windows.Forms.CheckBox()
Me.CBesES = New System.Windows.Forms.CheckBox()
@ -71,6 +73,7 @@ Partial Class einstellungen
Me.comboBox4 = New System.Windows.Forms.ComboBox()
Me.ComboBox2 = New System.Windows.Forms.ComboBox()
Me.comboBox3 = New System.Windows.Forms.ComboBox()
Me.CheckBox1 = New System.Windows.Forms.CheckBox()
Me.GB_Sub_Path.SuspendLayout()
Me.DL_Count_simultaneous.SuspendLayout()
CType(Me.NumericUpDown1, System.ComponentModel.ISupportInitialize).BeginInit()
@ -83,6 +86,7 @@ Partial Class einstellungen
Me.GroupBox4.SuspendLayout()
CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).BeginInit()
Me.TabPage2.SuspendLayout()
Me.GroupBox2.SuspendLayout()
Me.SoftSubs.SuspendLayout()
Me.GB_SubLanguage.SuspendLayout()
Me.GB_Resolution.SuspendLayout()
@ -289,6 +293,8 @@ Partial Class einstellungen
'TabPage2
'
Me.TabPage2.BackColor = System.Drawing.Color.FromArgb(CType(CType(243, Byte), Integer), CType(CType(243, Byte), Integer), CType(CType(243, Byte), Integer))
Me.TabPage2.Controls.Add(Me.CheckBox1)
Me.TabPage2.Controls.Add(Me.GroupBox2)
Me.TabPage2.Controls.Add(Me.SoftSubs)
Me.TabPage2.Controls.Add(Me.GB_SubLanguage)
Me.TabPage2.Controls.Add(Me.GB_Resolution)
@ -299,6 +305,36 @@ Partial Class einstellungen
Me.TabPage2.TabIndex = 1
Me.TabPage2.Text = "Output Settings"
'
'GroupBox2
'
Me.GroupBox2.BackColor = System.Drawing.Color.Transparent
Me.GroupBox2.Controls.Add(Me.FFMPEG_Command)
Me.GroupBox2.Enabled = False
Me.GroupBox2.Font = New System.Drawing.Font("Arial", 9.75!)
Me.GroupBox2.ForeColor = System.Drawing.Color.Black
Me.GroupBox2.Location = New System.Drawing.Point(6, 346)
Me.GroupBox2.Name = "GroupBox2"
Me.GroupBox2.Size = New System.Drawing.Size(449, 63)
Me.GroupBox2.TabIndex = 40
Me.GroupBox2.TabStop = False
Me.GroupBox2.Text = "ffmpeg command"
'
'FFMPEG_Command
'
Me.FFMPEG_Command.DrawMode = System.Windows.Forms.DrawMode.OwnerDrawFixed
Me.FFMPEG_Command.DropDownHeight = 250
Me.FFMPEG_Command.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList
Me.FFMPEG_Command.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.FFMPEG_Command.FormattingEnabled = True
Me.FFMPEG_Command.IntegralHeight = False
Me.FFMPEG_Command.ItemHeight = 16
Me.FFMPEG_Command.Items.AddRange(New Object() {" -c copy -bsf:a aac_adtstoasc ", " -c:v hevc_nvenc -preset fast -b:v 6M -bsf:a aac_adtstoasc ", " -c:v libx265 -preset fast -b:v 6M -bsf:a aac_adtstoasc "})
Me.FFMPEG_Command.Location = New System.Drawing.Point(6, 25)
Me.FFMPEG_Command.Name = "FFMPEG_Command"
Me.FFMPEG_Command.Size = New System.Drawing.Size(437, 22)
Me.FFMPEG_Command.Sorted = True
Me.FFMPEG_Command.TabIndex = 33
'
'SoftSubs
'
Me.SoftSubs.BackColor = System.Drawing.Color.Transparent
@ -315,7 +351,7 @@ Partial Class einstellungen
Me.SoftSubs.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.SoftSubs.Location = New System.Drawing.Point(6, 134)
Me.SoftSubs.Name = "SoftSubs"
Me.SoftSubs.Size = New System.Drawing.Size(449, 203)
Me.SoftSubs.Size = New System.Drawing.Size(449, 186)
Me.SoftSubs.TabIndex = 49
Me.SoftSubs.TabStop = False
Me.SoftSubs.Text = "SoftSubs"
@ -324,7 +360,7 @@ Partial Class einstellungen
'
Me.MergeMP4.AutoSize = True
Me.MergeMP4.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.MergeMP4.Location = New System.Drawing.Point(129, 165)
Me.MergeMP4.Location = New System.Drawing.Point(128, 155)
Me.MergeMP4.Name = "MergeMP4"
Me.MergeMP4.Size = New System.Drawing.Size(194, 20)
Me.MergeMP4.TabIndex = 6
@ -685,6 +721,17 @@ Partial Class einstellungen
Me.comboBox3.Size = New System.Drawing.Size(441, 23)
Me.comboBox3.TabIndex = 1
'
'CheckBox1
'
Me.CheckBox1.AutoSize = True
Me.CheckBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.CheckBox1.Location = New System.Drawing.Point(67, 326)
Me.CheckBox1.Name = "CheckBox1"
Me.CheckBox1.Size = New System.Drawing.Size(351, 20)
Me.CheckBox1.TabIndex = 6
Me.CheckBox1.Text = "i know that re-encoding the video takes time and power"
Me.CheckBox1.UseVisualStyleBackColor = True
'
'einstellungen
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
@ -714,6 +761,8 @@ Partial Class einstellungen
Me.GroupBox4.ResumeLayout(False)
CType(Me.PictureBox2, System.ComponentModel.ISupportInitialize).EndInit()
Me.TabPage2.ResumeLayout(False)
Me.TabPage2.PerformLayout()
Me.GroupBox2.ResumeLayout(False)
Me.SoftSubs.ResumeLayout(False)
Me.SoftSubs.PerformLayout()
Me.GB_SubLanguage.ResumeLayout(False)
@ -777,4 +826,7 @@ Partial Class einstellungen
Public WithEvents comboBox4 As ComboBox
Public WithEvents ComboBox2 As ComboBox
Public WithEvents comboBox3 As ComboBox
Friend WithEvents GroupBox2 As GroupBox
Friend WithEvents FFMPEG_Command As ComboBox
Friend WithEvents CheckBox1 As CheckBox
End Class

View File

@ -120,4 +120,7 @@
<metadata name="ToolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="ToolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

View File

@ -103,6 +103,14 @@ Public Class einstellungen
End If
NumericUpDown1.Value = Main.MaxDL
TextBox1.Text = Main.Startseite
If Main.ffmpeg_command = " -c:v hevc_nvenc -preset fast -b:v 6M -bsf:a aac_adtstoasc " Then
FFMPEG_Command.SelectedIndex = 1
ElseIf Main.FFMPEG_Command = " -c:v libx265 -preset fast -b:v 6M -bsf:a aac_adtstoasc " Then
FFMPEG_Command.SelectedIndex = 2
Else
FFMPEG_Command.SelectedIndex = 0
End If
Try
Dim rkg As RegistryKey = Registry.CurrentUser.OpenSubKey("Software\CRDownloader")
Firefox_True.Checked = CBool(Integer.Parse(rkg.GetValue("NoUse").ToString))
@ -186,14 +194,6 @@ Public Class einstellungen
Main.MergeSubstoMP4 = False
rk.SetValue("MergeMP4", "0", RegistryValueKind.String)
End If
'If RawVideo.Checked = True Then
' Main.SoftSubs = True
' rk.SetValue("RawVideo", 1, RegistryValueKind.String)
' 'MsgBox("Diese Einstellung benötigt einen Neustart des Programmes!", MsgBoxStyle.OkOnly)
'Else
' Main.SoftSubs = False
' rk.SetValue("RawVideo", 0, RegistryValueKind.String)
'End If
If RBAnime.Checked = True Then
Main.SubFolder = 1
rk.SetValue("SubFolder", 1, RegistryValueKind.String)
@ -201,6 +201,17 @@ Public Class einstellungen
Main.SubFolder = 2
rk.SetValue("SubFolder", 2, RegistryValueKind.String)
End If
If FFMPEG_Command.SelectedText = "" Then
Else
rk.SetValue("ffmpeg_command", FFMPEG_Command.SelectedText, RegistryValueKind.String)
End If
If FFMPEG_Command.SelectedText = " -c:v hevc_nvenc -preset fast -b:v 6M -bsf:a aac_adtstoasc " Then
NumericUpDown1.Value = 4
ElseIf FFMPEG_Command.SelectedText = " -c:v libx265 -preset fast -b:v 6M -bsf:a aac_adtstoasc " Then
NumericUpDown1.Value = 1
End If
rk.SetValue("SL_DL", NumericUpDown1.Value, RegistryValueKind.String)
Main.MaxDL = NumericUpDown1.Value
If Firefox_True.Checked = True Then
@ -208,6 +219,7 @@ Public Class einstellungen
ElseIf Firefox_True.Checked = False Then
rk.SetValue("NoUse", 0, RegistryValueKind.String)
End If
#Region "sof subs"
Main.SoftSubs.Clear()
If CBdeDE.Checked = True Then
@ -359,7 +371,7 @@ Public Class einstellungen
Private Sub ComboBox1_DrawItem(sender As Object, e As DrawItemEventArgs) Handles ComboBox1.DrawItem, ComboBox2.DrawItem, comboBox3.DrawItem, comboBox4.DrawItem
Private Sub ComboBox1_DrawItem(sender As Object, e As DrawItemEventArgs) Handles ComboBox1.DrawItem, ComboBox2.DrawItem, comboBox3.DrawItem, comboBox4.DrawItem, FFMPEG_Command.DrawItem
sender.BackColor = Color.White
If e.Index >= 0 Then
Using st As New StringFormat With {.Alignment = StringAlignment.Center}
@ -399,7 +411,7 @@ Public Class einstellungen
End If
End Sub
Private Sub MergeMP4_Click(sender As Object, e As EventArgs) Handles MergeMP4.Click
Private Sub MergeMP4_Click(sender As Object, e As EventArgs) Handles MergeMP4.Click, CheckBox1.Click
If MergeMP4.Checked = True Then
If AAuto.Checked = True Then
If MessageBox.Show("Resolution '[Auto]' and merge the subtitle with the video file will download all resolutions!" + vbNewLine + "Press 'Yes' to enable it anyway", "Prepare for unforeseen consequences.", MessageBoxButtons.YesNo) = DialogResult.Yes Then
@ -471,6 +483,23 @@ Public Class einstellungen
Next
End Sub
Private Sub FFMPEG_Command_SelectedIndexChanged(sender As Object, e As EventArgs) Handles FFMPEG_Command.SelectedIndexChanged
If CheckBox1.Checked = True Then
MsgBox("Other commands than " + Chr(34) + " -c copy -bsf:a aac_adtstoasc " + Chr(34) + "convert the Video into h265/hevc!", MsgBoxStyle.Information)
If FFMPEG_Command.SelectedText = " -c:v hevc_nvenc -preset fast -b:v 6M -bsf:a aac_adtstoasc " Then
MsgBox("This command requires a Nvidia GTX 6xx/7xx (Kepler generation) or higher.", MsgBoxStyle.Information)
ElseIf FFMPEG_Command.SelectedText = " -c:v libx265 -preset fast -b:v 6M -bsf:a aac_adtstoasc " Then
MsgBox("CPU encoding is low and uses all resources of the computer.", MsgBoxStyle.Information) ' -c:v libx265 -preset fast -b:v 6M -bsf:a aac_adtstoasc
End If
End If
End Sub
Private Sub CheckBox1_CheckedChanged(sender As Object, e As EventArgs) Handles CheckBox1.CheckedChanged
GroupBox2.Enabled = CheckBox1.CheckState
End Sub