From 2a422c0d55f937a12b037fb95b9c9db8423381fb Mon Sep 17 00:00:00 2001
From: Mrgaton <arnaupost4@gmail.com>
Date: Tue, 16 Apr 2024 19:34:51 +0200
Subject: [PATCH] Added new options :0

---
 Youtuve downloader/App.config                 |  12 ++
 Youtuve downloader/Config.cs                  |   2 +-
 Youtuve downloader/Properties/AssemblyInfo.cs |   2 +-
 Youtuve downloader/YoutubeForm.Designer.cs    | 107 ++++++++++++++----
 Youtuve downloader/YoutubeForm.cs             |  62 +++++++---
 Youtuve downloader/Youtuve downloader.csproj  |  52 +++++----
 Youtuve downloader/packages.config            |  34 +++---
 7 files changed, 184 insertions(+), 87 deletions(-)

diff --git a/Youtuve downloader/App.config b/Youtuve downloader/App.config
index 955fae8..7b0f962 100644
--- a/Youtuve downloader/App.config	
+++ b/Youtuve downloader/App.config	
@@ -17,6 +17,18 @@
         <assemblyIdentity name="System.ValueTuple" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
         <bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
       </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Text.Encoding.CodePages" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="AngleSharp" publicKeyToken="e83494dcdc6d31ea" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-1.1.0.0" newVersion="1.1.0.0" />
+      </dependentAssembly>
+      <dependentAssembly>
+        <assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
+        <bindingRedirect oldVersion="0.0.0.0-8.0.0.2" newVersion="8.0.0.2" />
+      </dependentAssembly>
     </assemblyBinding>
   </runtime>
 </configuration>
\ No newline at end of file
diff --git a/Youtuve downloader/Config.cs b/Youtuve downloader/Config.cs
index 03992e2..80c09b5 100644
--- a/Youtuve downloader/Config.cs	
+++ b/Youtuve downloader/Config.cs	
@@ -31,7 +31,7 @@ public static string Get(string key)
         {
             if (!File.Exists(configPath)) return null;
 
-            return File.ReadAllText(configPath).Split('\n').FirstOrDefault(s => s.StartsWith(key + '=', StringComparison.InvariantCultureIgnoreCase)).Split('=').Last().Trim('\r');
+            return File.ReadAllText(configPath).Split('\n').FirstOrDefault(s => s.StartsWith(key + '=', StringComparison.InvariantCultureIgnoreCase))?.Split('=').LastOrDefault().Trim('\r');
         }
     }
 }
\ No newline at end of file
diff --git a/Youtuve downloader/Properties/AssemblyInfo.cs b/Youtuve downloader/Properties/AssemblyInfo.cs
index 300eedc..8c514b1 100644
--- a/Youtuve downloader/Properties/AssemblyInfo.cs	
+++ b/Youtuve downloader/Properties/AssemblyInfo.cs	
@@ -6,6 +6,6 @@
 
 [assembly: AssemblyTitle("Youtube downloader")]
 [assembly: AssemblyProduct("Youtube downloader")]
-[assembly: AssemblyCopyright("Copyright ©  2021")]
+[assembly: AssemblyCopyright("Copyright Mrgaton©  2021")]
 [assembly: ComVisible(false)]
 [assembly: Guid("b3b66ad0-ca13-4f35-9188-3d82431cc8c2")]
\ No newline at end of file
diff --git a/Youtuve downloader/YoutubeForm.Designer.cs b/Youtuve downloader/YoutubeForm.Designer.cs
index c573df2..9433496 100644
--- a/Youtuve downloader/YoutubeForm.Designer.cs	
+++ b/Youtuve downloader/YoutubeForm.Designer.cs	
@@ -37,17 +37,21 @@ private void InitializeComponent()
             this.VideoFotoPictureBox = new System.Windows.Forms.PictureBox();
             this.VideoNameLabel = new System.Windows.Forms.Label();
             this.DownloadProgressBar = new System.Windows.Forms.ProgressBar();
-            this.BitrateComboBox = new System.Windows.Forms.ComboBox();
+            this.VideoComboBox = new System.Windows.Forms.ComboBox();
+            this.ReEncodeAudioCheckBox = new System.Windows.Forms.CheckBox();
+            this.VideoBoxLabel = new System.Windows.Forms.Label();
+            this.AudioBoxLabel = new System.Windows.Forms.Label();
+            this.AudioComboBox = new System.Windows.Forms.ComboBox();
             ((System.ComponentModel.ISupportInitialize)(this.VideoFotoPictureBox)).BeginInit();
             this.SuspendLayout();
             // 
             // YoutubeLinkTextBox
             // 
             this.YoutubeLinkTextBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 18F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
-            this.YoutubeLinkTextBox.Location = new System.Drawing.Point(14, 48);
+            this.YoutubeLinkTextBox.Location = new System.Drawing.Point(14, 37);
             this.YoutubeLinkTextBox.Margin = new System.Windows.Forms.Padding(2);
             this.YoutubeLinkTextBox.Name = "YoutubeLinkTextBox";
-            this.YoutubeLinkTextBox.Size = new System.Drawing.Size(221, 35);
+            this.YoutubeLinkTextBox.Size = new System.Drawing.Size(185, 35);
             this.YoutubeLinkTextBox.TabIndex = 0;
             this.YoutubeLinkTextBox.TextChanged += new System.EventHandler(this.YoutubeLinkTextBox_TextChanged);
             this.YoutubeLinkTextBox.DoubleClick += new System.EventHandler(this.YoutubeLinkTextBox_DoubleClick);
@@ -56,7 +60,7 @@ private void InitializeComponent()
             // 
             this.YoutubeLinkLabel.AutoSize = true;
             this.YoutubeLinkLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 16.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
-            this.YoutubeLinkLabel.Location = new System.Drawing.Point(5, 9);
+            this.YoutubeLinkLabel.Location = new System.Drawing.Point(11, 9);
             this.YoutubeLinkLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.YoutubeLinkLabel.Name = "YoutubeLinkLabel";
             this.YoutubeLinkLabel.Size = new System.Drawing.Size(140, 26);
@@ -74,7 +78,7 @@ private void InitializeComponent()
             "mp3",
             "mp4",
             "mux"});
-            this.FormatComboBox.Location = new System.Drawing.Point(239, 48);
+            this.FormatComboBox.Location = new System.Drawing.Point(203, 38);
             this.FormatComboBox.Margin = new System.Windows.Forms.Padding(2);
             this.FormatComboBox.Name = "FormatComboBox";
             this.FormatComboBox.Size = new System.Drawing.Size(72, 34);
@@ -86,10 +90,10 @@ private void InitializeComponent()
             // 
             this.DownloadButton.Enabled = false;
             this.DownloadButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 13.8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
-            this.DownloadButton.Location = new System.Drawing.Point(475, 7);
+            this.DownloadButton.Location = new System.Drawing.Point(565, 75);
             this.DownloadButton.Margin = new System.Windows.Forms.Padding(2);
             this.DownloadButton.Name = "DownloadButton";
-            this.DownloadButton.Size = new System.Drawing.Size(122, 37);
+            this.DownloadButton.Size = new System.Drawing.Size(251, 48);
             this.DownloadButton.TabIndex = 3;
             this.DownloadButton.Text = "Descargar";
             this.DownloadButton.UseVisualStyleBackColor = true;
@@ -98,10 +102,10 @@ private void InitializeComponent()
             // VideoFotoPictureBox
             // 
             this.VideoFotoPictureBox.BackColor = System.Drawing.SystemColors.ControlDark;
-            this.VideoFotoPictureBox.Location = new System.Drawing.Point(14, 112);
+            this.VideoFotoPictureBox.Location = new System.Drawing.Point(10, 127);
             this.VideoFotoPictureBox.Margin = new System.Windows.Forms.Padding(2);
             this.VideoFotoPictureBox.Name = "VideoFotoPictureBox";
-            this.VideoFotoPictureBox.Size = new System.Drawing.Size(583, 306);
+            this.VideoFotoPictureBox.Size = new System.Drawing.Size(806, 458);
             this.VideoFotoPictureBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
             this.VideoFotoPictureBox.TabIndex = 4;
             this.VideoFotoPictureBox.TabStop = false;
@@ -111,7 +115,7 @@ private void InitializeComponent()
             // 
             this.VideoNameLabel.AutoSize = true;
             this.VideoNameLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
-            this.VideoNameLabel.Location = new System.Drawing.Point(9, 85);
+            this.VideoNameLabel.Location = new System.Drawing.Point(11, 100);
             this.VideoNameLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
             this.VideoNameLabel.Name = "VideoNameLabel";
             this.VideoNameLabel.Size = new System.Drawing.Size(180, 25);
@@ -120,32 +124,81 @@ private void InitializeComponent()
             // 
             // DownloadProgressBar
             // 
-            this.DownloadProgressBar.Location = new System.Drawing.Point(14, 422);
+            this.DownloadProgressBar.Location = new System.Drawing.Point(10, 589);
             this.DownloadProgressBar.Margin = new System.Windows.Forms.Padding(2);
             this.DownloadProgressBar.MarqueeAnimationSpeed = 30;
             this.DownloadProgressBar.Maximum = 1000;
             this.DownloadProgressBar.Name = "DownloadProgressBar";
-            this.DownloadProgressBar.Size = new System.Drawing.Size(583, 41);
+            this.DownloadProgressBar.Size = new System.Drawing.Size(806, 51);
             this.DownloadProgressBar.Step = 30;
             this.DownloadProgressBar.TabIndex = 6;
             // 
-            // BitrateComboBox
-            // 
-            this.BitrateComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
-            this.BitrateComboBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 16.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
-            this.BitrateComboBox.FormattingEnabled = true;
-            this.BitrateComboBox.Location = new System.Drawing.Point(315, 48);
-            this.BitrateComboBox.Margin = new System.Windows.Forms.Padding(2);
-            this.BitrateComboBox.Name = "BitrateComboBox";
-            this.BitrateComboBox.Size = new System.Drawing.Size(282, 34);
-            this.BitrateComboBox.TabIndex = 7;
+            // VideoComboBox
+            // 
+            this.VideoComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.VideoComboBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 16.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+            this.VideoComboBox.FormattingEnabled = true;
+            this.VideoComboBox.Location = new System.Drawing.Point(279, 37);
+            this.VideoComboBox.Margin = new System.Windows.Forms.Padding(2);
+            this.VideoComboBox.Name = "VideoComboBox";
+            this.VideoComboBox.Size = new System.Drawing.Size(282, 34);
+            this.VideoComboBox.TabIndex = 7;
+            // 
+            // ReEncodeAudioCheckBox
+            // 
+            this.ReEncodeAudioCheckBox.AutoSize = true;
+            this.ReEncodeAudioCheckBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 14.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+            this.ReEncodeAudioCheckBox.Location = new System.Drawing.Point(644, 10);
+            this.ReEncodeAudioCheckBox.Name = "ReEncodeAudioCheckBox";
+            this.ReEncodeAudioCheckBox.Size = new System.Drawing.Size(172, 28);
+            this.ReEncodeAudioCheckBox.TabIndex = 8;
+            this.ReEncodeAudioCheckBox.Text = "ReEncode audio";
+            this.ReEncodeAudioCheckBox.UseVisualStyleBackColor = true;
+            this.ReEncodeAudioCheckBox.CheckedChanged += new System.EventHandler(this.Mp4aCodecCheckBox_CheckedChanged);
+            // 
+            // VideoBoxLabel
+            // 
+            this.VideoBoxLabel.AutoSize = true;
+            this.VideoBoxLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 16.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+            this.VideoBoxLabel.Location = new System.Drawing.Point(274, 9);
+            this.VideoBoxLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.VideoBoxLabel.Name = "VideoBoxLabel";
+            this.VideoBoxLabel.Size = new System.Drawing.Size(68, 26);
+            this.VideoBoxLabel.TabIndex = 9;
+            this.VideoBoxLabel.Text = "Video";
+            // 
+            // AudioBoxLabel
+            // 
+            this.AudioBoxLabel.AutoSize = true;
+            this.AudioBoxLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 16.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+            this.AudioBoxLabel.Location = new System.Drawing.Point(560, 9);
+            this.AudioBoxLabel.Margin = new System.Windows.Forms.Padding(2, 0, 2, 0);
+            this.AudioBoxLabel.Name = "AudioBoxLabel";
+            this.AudioBoxLabel.Size = new System.Drawing.Size(68, 26);
+            this.AudioBoxLabel.TabIndex = 11;
+            this.AudioBoxLabel.Text = "Audio";
+            // 
+            // AudioComboBox
+            // 
+            this.AudioComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+            this.AudioComboBox.Font = new System.Drawing.Font("Microsoft Sans Serif", 16.2F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
+            this.AudioComboBox.FormattingEnabled = true;
+            this.AudioComboBox.Location = new System.Drawing.Point(565, 37);
+            this.AudioComboBox.Margin = new System.Windows.Forms.Padding(2);
+            this.AudioComboBox.Name = "AudioComboBox";
+            this.AudioComboBox.Size = new System.Drawing.Size(251, 34);
+            this.AudioComboBox.TabIndex = 10;
             // 
             // YoutubeForm
             // 
             this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
             this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
-            this.ClientSize = new System.Drawing.Size(600, 470);
-            this.Controls.Add(this.BitrateComboBox);
+            this.ClientSize = new System.Drawing.Size(826, 650);
+            this.Controls.Add(this.AudioBoxLabel);
+            this.Controls.Add(this.AudioComboBox);
+            this.Controls.Add(this.VideoBoxLabel);
+            this.Controls.Add(this.ReEncodeAudioCheckBox);
+            this.Controls.Add(this.VideoComboBox);
             this.Controls.Add(this.DownloadProgressBar);
             this.Controls.Add(this.VideoNameLabel);
             this.Controls.Add(this.VideoFotoPictureBox);
@@ -175,7 +228,11 @@ private void InitializeComponent()
         private System.Windows.Forms.PictureBox VideoFotoPictureBox;
         private System.Windows.Forms.Label VideoNameLabel;
         private System.Windows.Forms.ProgressBar DownloadProgressBar;
-        private System.Windows.Forms.ComboBox BitrateComboBox;
+        private System.Windows.Forms.ComboBox VideoComboBox;
+        private System.Windows.Forms.CheckBox ReEncodeAudioCheckBox;
+        private System.Windows.Forms.Label VideoBoxLabel;
+        private System.Windows.Forms.Label AudioBoxLabel;
+        private System.Windows.Forms.ComboBox AudioComboBox;
     }
 }
 
diff --git a/Youtuve downloader/YoutubeForm.cs b/Youtuve downloader/YoutubeForm.cs
index f6346e0..f01d2e4 100644
--- a/Youtuve downloader/YoutubeForm.cs	
+++ b/Youtuve downloader/YoutubeForm.cs	
@@ -37,8 +37,10 @@ public YoutubeForm()
             YoutubeLinkTextBox.Text = Config.Get("lastVideo");
 
             if (int.TryParse(Config.Get("formatIndex"), out int index)) FormatComboBox.SelectedIndex = index;
+            if (bool.TryParse(Config.Get("ReEncodeAudio"), out bool mp4a)) ReEncodeAudioCheckBox.Checked = mp4a;
 
             wc.DownloadProgressChanged += (s, e) => DownloadProgressBar.Value = e.ProgressPercentage * 10;
+
             wc.DownloadFileCompleted += (s, e) => DownloadProgressBar.Value = 0;
         }
 
@@ -55,18 +57,18 @@ private async void DownloadButton_Click(object sender, EventArgs e)
             switch (FormatComboBox.SelectedItem.ToString())
             {
                 case "mp3":
-                    streamInfo = audioStreamsInfo.ToList()[BitrateComboBox.SelectedIndex];
+                    streamInfo = audioStreamsInfo.ElementAt(AudioComboBox.SelectedIndex);
                     fileExtension = "mp3";
                     break;
 
                 case "com":
                 case "mp4":
-                    streamInfo = videoStreamsInfo.ToList()[BitrateComboBox.SelectedIndex];
+                    streamInfo = videoStreamsInfo.ElementAt(VideoComboBox.SelectedIndex);
                     fileExtension = "mp4";
                     break;
 
                 case "mux":
-                    streamInfo = muxedStreamsInfo.ToList()[BitrateComboBox.SelectedIndex];
+                    streamInfo = muxedStreamsInfo.ElementAt(VideoComboBox.SelectedIndex);
                     fileExtension = "mp4";
                     break;
             }
@@ -75,11 +77,11 @@ private async void DownloadButton_Click(object sender, EventArgs e)
 
             if (FormatComboBox.Text == "mp3")
             {
-                saveFileDialog1.Filter = "Mp3 Music | *." + FormatComboBox.Text;
+                saveFileDialog1.Filter = "Mp3 Music | *.mp3";
             }
             else if (FormatComboBox.Text == "mp4" || FormatComboBox.Text == "mux" || FormatComboBox.Text == "com")
             {
-                saveFileDialog1.Filter = "Mp4 Video | *." + FormatComboBox.Text;
+                saveFileDialog1.Filter = "Mp4 Video | *.mp4";
             }
 
             saveFileDialog1.Title = "Interesting question";
@@ -114,7 +116,7 @@ await Task.Run(() =>
 
                 string tempVideoFile = Path.GetTempFileName();
 
-                var audioStreamInfo = audioStreamsInfo.Last();
+                AudioOnlyStreamInfo audioStreamInfo = audioStreamsInfo.ElementAt(AudioComboBox.SelectedIndex);
 
                 long videoBytesSize = streamInfo.Size.Bytes;
                 long audioBytesSize = audioStreamInfo.Size.Bytes;
@@ -198,33 +200,52 @@ private async Task UpdateStreams()
 
             if (FormatComboBox.SelectedItem == null || muxedStreamsInfo == null) return;
 
-            BitrateComboBox.Items.Clear();
+            VideoComboBox.Items.Clear();
+
+            AudioComboBox.Items.Clear();
+
+            foreach (var stream in audioStreamsInfo) AudioComboBox.Items.Add(stream.Bitrate.ToString().Split(' ')[0] + "|" + stream.Size + "|" + stream.AudioCodec.ToUpper().Split('.')[0]);
+
+            if (FormatComboBox.SelectedItem.ToString() == "mux")
+            {
+                foreach (var stream in muxedStreamsInfo) VideoComboBox.Items.Add(stream.VideoResolution + "|" + stream.Size + "|" + stream.VideoCodec.Split('.')[0]);
+            }
+            else
+            {
+                foreach (var stream in videoStreamsInfo) VideoComboBox.Items.Add(stream.VideoResolution + "|" + stream.Size + "|" + stream.VideoCodec.Split('.')[0]);
+            }
 
             switch (FormatComboBox.SelectedItem.ToString())
             {
                 case "mp3":
-                    foreach (var stream in audioStreamsInfo)
-                        BitrateComboBox.Items.Add(stream.Bitrate.ToString().Split(' ')[0] + "|" + stream.Size + "|" + stream.AudioCodec.Split('.')[0]);
+                    VideoComboBox.Enabled = false;
+                    AudioComboBox.Enabled = true;
+                    ReEncodeAudioCheckBox.Enabled = false;
                     break;
 
                 case "mp4":
-                    foreach (var stream in videoStreamsInfo)
-                        BitrateComboBox.Items.Add(stream.VideoResolution + "|" + stream.Size + "|" + stream.VideoCodec.Split('.')[0]);
+                    VideoComboBox.Enabled = true;
+                    AudioComboBox.Enabled = false;
+                    ReEncodeAudioCheckBox.Enabled = false;
+
                     break;
 
                 case "mux":
-                    foreach (var stream in muxedStreamsInfo.ToList())
-                        BitrateComboBox.Items.Add(stream.VideoResolution + "|" + stream.Size + "|" + stream.VideoCodec.Split('.')[0]);
+                    VideoComboBox.Enabled = true;
+                    AudioComboBox.Enabled = false;
+                    ReEncodeAudioCheckBox.Enabled = false;
                     break;
 
                 case "com":
                     CheckAndDownloadFfmepg();
 
-                    foreach (var stream in videoStreamsInfo) BitrateComboBox.Items.Add(stream.VideoResolution + "|" + stream.Size + "|" + stream.VideoCodec.Split('.')[0]);
+                    VideoComboBox.Enabled = AudioComboBox.Enabled = true;
+                    ReEncodeAudioCheckBox.Enabled = true;
                     break;
             }
 
-            BitrateComboBox.SelectedIndex = BitrateComboBox.Items.Count - 1;
+            VideoComboBox.SelectedIndex = VideoComboBox.Items.Count - 1;
+            AudioComboBox.SelectedIndex = AudioComboBox.Items.Count - 1;
         }
 
         private void VideoFotoPictureBox_Click(object sender, EventArgs e)
@@ -253,15 +274,15 @@ private async Task CheckAndDownloadFfmepg()
             }
         }
 
-        private static async Task CombineAudioAndVideo(string videoPath, string audioPath, string outputFile)
+        private async Task CombineAudioAndVideo(string videoPath, string audioPath, string outputFile)
         {
             //string reference = "ffmepg.exe -i \"video.mp4\" -i \"audio.mp3\" -c:a copy -c:v copy -n oeut.mp4";
 
             ProcessStartInfo processStartInfo = new ProcessStartInfo()
             {
                 FileName = ffmepgTempPath,
-                Arguments = $" -i \"{videoPath}\" -i \"{audioPath}\" -c:a copy -c:v copy -n \"{outputFile}\"",
-                CreateNoWindow = true,
+                Arguments = $" -i \"{videoPath}\" -i \"{audioPath}\" -c:a {(ReEncodeAudioCheckBox.Checked ? "aac" : "copy")} -c:v copy -y \"{outputFile}\"",
+                CreateNoWindow = false,
                 //RedirectStandardError = true,
                 //RedirectStandardInput = true,
                 //RedirectStandardOutput = true,
@@ -273,6 +294,11 @@ private static async Task CombineAudioAndVideo(string videoPath, string audioPat
             await proc.WaitForExitAsync();
         }
 
+        private void Mp4aCodecCheckBox_CheckedChanged(object sender, EventArgs e)
+        {
+            Config.Set("ReEncodeAudio", ReEncodeAudioCheckBox.Checked.ToString());
+        }
+
         // old crapy code
         /*private async void DownloadFileWithProgress(string DownloadLink, string PathDe, bool WithLabel, ProgressBar LAbelsita)
         {
diff --git a/Youtuve downloader/Youtuve downloader.csproj b/Youtuve downloader/Youtuve downloader.csproj
index 4534f97..3866132 100644
--- a/Youtuve downloader/Youtuve downloader.csproj	
+++ b/Youtuve downloader/Youtuve downloader.csproj	
@@ -48,8 +48,8 @@
     <NoWin32Manifest>true</NoWin32Manifest>
   </PropertyGroup>
   <ItemGroup>
-    <Reference Include="AngleSharp, Version=1.0.7.0, Culture=neutral, PublicKeyToken=e83494dcdc6d31ea, processorArchitecture=MSIL">
-      <HintPath>..\packages\AngleSharp.1.0.7\lib\net472\AngleSharp.dll</HintPath>
+    <Reference Include="AngleSharp, Version=1.1.0.0, Culture=neutral, PublicKeyToken=e83494dcdc6d31ea, processorArchitecture=MSIL">
+      <HintPath>..\packages\AngleSharp.1.1.0\lib\net472\AngleSharp.dll</HintPath>
     </Reference>
     <Reference Include="Costura, Version=5.7.0.0, Culture=neutral, processorArchitecture=MSIL">
       <HintPath>..\packages\Costura.Fody.5.7.0\lib\netstandard1.0\Costura.dll</HintPath>
@@ -73,14 +73,14 @@
       <HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
     </Reference>
     <Reference Include="System.ComponentModel.Composition" />
-    <Reference Include="System.Console, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\packages\System.Console.4.3.0\lib\net46\System.Console.dll</HintPath>
+    <Reference Include="System.Console, Version=4.0.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Console.4.3.1\lib\net46\System.Console.dll</HintPath>
       <Private>True</Private>
       <Private>True</Private>
     </Reference>
     <Reference Include="System.Core" />
-    <Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.1.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
-      <HintPath>..\packages\System.Diagnostics.DiagnosticSource.4.3.0\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
+    <Reference Include="System.Diagnostics.DiagnosticSource, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Diagnostics.DiagnosticSource.8.0.0\lib\net462\System.Diagnostics.DiagnosticSource.dll</HintPath>
     </Reference>
     <Reference Include="System.Diagnostics.Tracing, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
       <HintPath>..\packages\System.Diagnostics.Tracing.4.3.0\lib\net462\System.Diagnostics.Tracing.dll</HintPath>
@@ -131,8 +131,8 @@
     <Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
       <HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
     </Reference>
-    <Reference Include="System.Net.Http, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\packages\System.Net.Http.4.3.0\lib\net46\System.Net.Http.dll</HintPath>
+    <Reference Include="System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll</HintPath>
       <Private>True</Private>
       <Private>True</Private>
     </Reference>
@@ -150,16 +150,16 @@
       <Private>True</Private>
       <Private>True</Private>
     </Reference>
-    <Reference Include="System.Runtime, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll</HintPath>
+    <Reference Include="System.Runtime, Version=4.1.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Runtime.4.3.1\lib\net462\System.Runtime.dll</HintPath>
       <Private>True</Private>
       <Private>True</Private>
     </Reference>
     <Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
       <HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
     </Reference>
-    <Reference Include="System.Runtime.Extensions, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\packages\System.Runtime.Extensions.4.3.0\lib\net462\System.Runtime.Extensions.dll</HintPath>
+    <Reference Include="System.Runtime.Extensions, Version=4.1.1.1, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Runtime.Extensions.4.3.1\lib\net462\System.Runtime.Extensions.dll</HintPath>
       <Private>True</Private>
       <Private>True</Private>
     </Reference>
@@ -175,7 +175,7 @@
     </Reference>
     <Reference Include="System.Runtime.Serialization" />
     <Reference Include="System.Security.Cryptography.Algorithms, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net463\System.Security.Cryptography.Algorithms.dll</HintPath>
+      <HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.1\lib\net463\System.Security.Cryptography.Algorithms.dll</HintPath>
       <Private>True</Private>
       <Private>True</Private>
     </Reference>
@@ -189,22 +189,22 @@
       <Private>True</Private>
       <Private>True</Private>
     </Reference>
-    <Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
+    <Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.2, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.3.2\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
       <Private>True</Private>
       <Private>True</Private>
     </Reference>
-    <Reference Include="System.Text.Encoding.CodePages, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\packages\System.Text.Encoding.CodePages.6.0.0\lib\net461\System.Text.Encoding.CodePages.dll</HintPath>
+    <Reference Include="System.Text.Encoding.CodePages, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Text.Encoding.CodePages.8.0.0\lib\net462\System.Text.Encoding.CodePages.dll</HintPath>
     </Reference>
     <Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
       <HintPath>..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
     </Reference>
-    <Reference Include="System.Text.Json, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
-      <HintPath>..\packages\System.Text.Json.8.0.0\lib\net462\System.Text.Json.dll</HintPath>
+    <Reference Include="System.Text.Json, Version=8.0.0.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
+      <HintPath>..\packages\System.Text.Json.8.0.2\lib\net462\System.Text.Json.dll</HintPath>
     </Reference>
     <Reference Include="System.Text.RegularExpressions, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\packages\System.Text.RegularExpressions.4.3.0\lib\net463\System.Text.RegularExpressions.dll</HintPath>
+      <HintPath>..\packages\System.Text.RegularExpressions.4.3.1\lib\net463\System.Text.RegularExpressions.dll</HintPath>
       <Private>True</Private>
       <Private>True</Private>
     </Reference>
@@ -224,12 +224,12 @@
     <Reference Include="System.Windows.Forms" />
     <Reference Include="System.Xml" />
     <Reference Include="System.Xml.ReaderWriter, Version=4.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
-      <HintPath>..\packages\System.Xml.ReaderWriter.4.3.0\lib\net46\System.Xml.ReaderWriter.dll</HintPath>
+      <HintPath>..\packages\System.Xml.ReaderWriter.4.3.1\lib\net46\System.Xml.ReaderWriter.dll</HintPath>
       <Private>True</Private>
       <Private>True</Private>
     </Reference>
-    <Reference Include="YoutubeExplode, Version=6.3.12.0, Culture=neutral, processorArchitecture=MSIL">
-      <HintPath>..\packages\YoutubeExplode.6.3.12\lib\net461\YoutubeExplode.dll</HintPath>
+    <Reference Include="YoutubeExplode, Version=6.3.13.0, Culture=neutral, processorArchitecture=MSIL">
+      <HintPath>..\packages\YoutubeExplode.6.3.13\lib\net461\YoutubeExplode.dll</HintPath>
     </Reference>
   </ItemGroup>
   <ItemGroup>
@@ -275,14 +275,16 @@
     <Content Include="youtube.ico" />
   </ItemGroup>
   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
-  <Import Project="..\packages\Fody.6.5.5\build\Fody.targets" Condition="Exists('..\packages\Fody.6.5.5\build\Fody.targets')" />
   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
     <PropertyGroup>
       <ErrorText>Este proyecto hace referencia a los paquetes NuGet que faltan en este equipo. Use la restauración de paquetes NuGet para descargarlos. Para obtener más información, consulte http://go.microsoft.com/fwlink/?LinkID=322105. El archivo que falta es {0}.</ErrorText>
     </PropertyGroup>
-    <Error Condition="!Exists('..\packages\Fody.6.5.5\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.6.5.5\build\Fody.targets'))" />
     <Error Condition="!Exists('..\packages\Costura.Fody.5.7.0\build\Costura.Fody.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.5.7.0\build\Costura.Fody.props'))" />
     <Error Condition="!Exists('..\packages\Costura.Fody.5.7.0\build\Costura.Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Costura.Fody.5.7.0\build\Costura.Fody.targets'))" />
+    <Error Condition="!Exists('..\packages\Fody.6.8.0\build\Fody.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Fody.6.8.0\build\Fody.targets'))" />
+    <Error Condition="!Exists('..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets'))" />
   </Target>
   <Import Project="..\packages\Costura.Fody.5.7.0\build\Costura.Fody.targets" Condition="Exists('..\packages\Costura.Fody.5.7.0\build\Costura.Fody.targets')" />
+  <Import Project="..\packages\Fody.6.8.0\build\Fody.targets" Condition="Exists('..\packages\Fody.6.8.0\build\Fody.targets')" />
+  <Import Project="..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets" Condition="Exists('..\packages\NETStandard.Library.2.0.3\build\netstandard2.0\NETStandard.Library.targets')" />
 </Project>
\ No newline at end of file
diff --git a/Youtuve downloader/packages.config b/Youtuve downloader/packages.config
index b5414d3..75ffbd6 100644
--- a/Youtuve downloader/packages.config	
+++ b/Youtuve downloader/packages.config	
@@ -1,19 +1,19 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
-  <package id="AngleSharp" version="1.0.7" targetFramework="net48" />
+  <package id="AngleSharp" version="1.1.0" targetFramework="net48" />
   <package id="Costura.Fody" version="5.7.0" targetFramework="net48" developmentDependency="true" />
-  <package id="Fody" version="6.5.5" targetFramework="net48" developmentDependency="true" />
+  <package id="Fody" version="6.8.0" targetFramework="net48" developmentDependency="true" />
   <package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net48" />
-  <package id="Microsoft.NETCore.Platforms" version="1.1.0" targetFramework="net48" />
+  <package id="Microsoft.NETCore.Platforms" version="7.0.4" targetFramework="net48" />
   <package id="Microsoft.Win32.Primitives" version="4.3.0" targetFramework="net48" />
-  <package id="NETStandard.Library" version="1.6.1" targetFramework="net48" />
+  <package id="NETStandard.Library" version="2.0.3" targetFramework="net48" />
   <package id="System.AppContext" version="4.3.0" targetFramework="net48" />
   <package id="System.Buffers" version="4.5.1" targetFramework="net48" />
   <package id="System.Collections" version="4.3.0" targetFramework="net48" />
   <package id="System.Collections.Concurrent" version="4.3.0" targetFramework="net48" />
-  <package id="System.Console" version="4.3.0" targetFramework="net48" />
+  <package id="System.Console" version="4.3.1" targetFramework="net48" />
   <package id="System.Diagnostics.Debug" version="4.3.0" targetFramework="net48" />
-  <package id="System.Diagnostics.DiagnosticSource" version="4.3.0" targetFramework="net48" />
+  <package id="System.Diagnostics.DiagnosticSource" version="8.0.0" targetFramework="net48" />
   <package id="System.Diagnostics.Tools" version="4.3.0" targetFramework="net48" />
   <package id="System.Diagnostics.Tracing" version="4.3.0" targetFramework="net48" />
   <package id="System.Globalization" version="4.3.0" targetFramework="net48" />
@@ -26,8 +26,8 @@
   <package id="System.Linq" version="4.3.0" targetFramework="net48" />
   <package id="System.Linq.Expressions" version="4.3.0" targetFramework="net48" />
   <package id="System.Memory" version="4.5.5" targetFramework="net48" />
-  <package id="System.Net.Http" version="4.3.0" targetFramework="net48" />
-  <package id="System.Net.Primitives" version="4.3.0" targetFramework="net48" />
+  <package id="System.Net.Http" version="4.3.4" targetFramework="net48" />
+  <package id="System.Net.Primitives" version="4.3.1" targetFramework="net48" />
   <package id="System.Net.Sockets" version="4.3.0" targetFramework="net48" />
   <package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net48" />
   <package id="System.ObjectModel" version="4.3.0" targetFramework="net48" />
@@ -35,29 +35,29 @@
   <package id="System.Reflection.Extensions" version="4.3.0" targetFramework="net48" />
   <package id="System.Reflection.Primitives" version="4.3.0" targetFramework="net48" />
   <package id="System.Resources.ResourceManager" version="4.3.0" targetFramework="net48" />
-  <package id="System.Runtime" version="4.3.0" targetFramework="net48" />
+  <package id="System.Runtime" version="4.3.1" targetFramework="net48" />
   <package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net48" />
-  <package id="System.Runtime.Extensions" version="4.3.0" targetFramework="net48" />
+  <package id="System.Runtime.Extensions" version="4.3.1" targetFramework="net48" />
   <package id="System.Runtime.Handles" version="4.3.0" targetFramework="net48" />
   <package id="System.Runtime.InteropServices" version="4.3.0" targetFramework="net48" />
   <package id="System.Runtime.InteropServices.RuntimeInformation" version="4.3.0" targetFramework="net48" />
   <package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net48" />
-  <package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net48" />
+  <package id="System.Security.Cryptography.Algorithms" version="4.3.1" targetFramework="net48" />
   <package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net48" />
   <package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net48" />
-  <package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net48" />
+  <package id="System.Security.Cryptography.X509Certificates" version="4.3.2" targetFramework="net48" />
   <package id="System.Text.Encoding" version="4.3.0" targetFramework="net48" />
-  <package id="System.Text.Encoding.CodePages" version="6.0.0" targetFramework="net48" />
+  <package id="System.Text.Encoding.CodePages" version="8.0.0" targetFramework="net48" />
   <package id="System.Text.Encoding.Extensions" version="4.3.0" targetFramework="net48" />
   <package id="System.Text.Encodings.Web" version="8.0.0" targetFramework="net48" />
-  <package id="System.Text.Json" version="8.0.0" targetFramework="net48" />
-  <package id="System.Text.RegularExpressions" version="4.3.0" targetFramework="net48" />
+  <package id="System.Text.Json" version="8.0.2" targetFramework="net48" />
+  <package id="System.Text.RegularExpressions" version="4.3.1" targetFramework="net48" />
   <package id="System.Threading" version="4.3.0" targetFramework="net48" />
   <package id="System.Threading.Tasks" version="4.3.0" targetFramework="net48" />
   <package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net48" />
   <package id="System.Threading.Timer" version="4.3.0" targetFramework="net48" />
   <package id="System.ValueTuple" version="4.5.0" targetFramework="net48" />
-  <package id="System.Xml.ReaderWriter" version="4.3.0" targetFramework="net48" />
+  <package id="System.Xml.ReaderWriter" version="4.3.1" targetFramework="net48" />
   <package id="System.Xml.XDocument" version="4.3.0" targetFramework="net48" />
-  <package id="YoutubeExplode" version="6.3.12" targetFramework="net48" />
+  <package id="YoutubeExplode" version="6.3.13" targetFramework="net48" />
 </packages>
\ No newline at end of file