From cd1b5dc5632e30f60befa3f3addeba8fd310de6c Mon Sep 17 00:00:00 2001 From: Heavenly Avenger Date: Sun, 9 Nov 2025 01:17:25 -0300 Subject: [PATCH 1/5] Fixes mp3 degradation issue. --- YoutubeExplode.Converter/Converter.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/YoutubeExplode.Converter/Converter.cs b/YoutubeExplode.Converter/Converter.cs index 326d9b98..f8d43821 100644 --- a/YoutubeExplode.Converter/Converter.cs +++ b/YoutubeExplode.Converter/Converter.cs @@ -99,9 +99,7 @@ private async ValueTask ProcessAsync( { if (streamInput.Info is IAudioStreamInfo audioStreamInfo) { - arguments - .Add($"-b:a:{lastAudioStreamIndex++}") - .Add(Math.Round(audioStreamInfo.Bitrate.KiloBitsPerSecond) + "K"); + arguments.Add($"-q:a:{lastAudioStreamIndex++}").Add("0"); // Have ffmpeg determine best quality possible } } } From 5445abda7a38d9451d0e698035ba7b77d1af9d98 Mon Sep 17 00:00:00 2001 From: Oleksii Holub <1935960+Tyrrrz@users.noreply.github.com> Date: Tue, 11 Nov 2025 14:35:40 +0200 Subject: [PATCH 2/5] Apply suggestion from @Tyrrrz --- YoutubeExplode.Converter/Converter.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/YoutubeExplode.Converter/Converter.cs b/YoutubeExplode.Converter/Converter.cs index f8d43821..9d9d3429 100644 --- a/YoutubeExplode.Converter/Converter.cs +++ b/YoutubeExplode.Converter/Converter.cs @@ -99,7 +99,8 @@ private async ValueTask ProcessAsync( { if (streamInput.Info is IAudioStreamInfo audioStreamInfo) { - arguments.Add($"-q:a:{lastAudioStreamIndex++}").Add("0"); // Have ffmpeg determine best quality possible + // Have ffmpeg determine best quality possible + arguments.Add($"-q:a:{lastAudioStreamIndex++}").Add("0"); } } } From cf0cbd2c45f81346af72002e7452cc3c1e12cc5d Mon Sep 17 00:00:00 2001 From: Oleksii Holub <1935960+Tyrrrz@users.noreply.github.com> Date: Tue, 11 Nov 2025 15:06:29 +0200 Subject: [PATCH 3/5] Format --- YoutubeExplode.Converter/Converter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/YoutubeExplode.Converter/Converter.cs b/YoutubeExplode.Converter/Converter.cs index 9d9d3429..9ec33c07 100644 --- a/YoutubeExplode.Converter/Converter.cs +++ b/YoutubeExplode.Converter/Converter.cs @@ -100,7 +100,7 @@ private async ValueTask ProcessAsync( if (streamInput.Info is IAudioStreamInfo audioStreamInfo) { // Have ffmpeg determine best quality possible - arguments.Add($"-q:a:{lastAudioStreamIndex++}").Add("0"); + arguments.Add($"-q:a:{lastAudioStreamIndex++}").Add("0"); } } } From eec387d8cabd7776f349f01083305f66f8a99d09 Mon Sep 17 00:00:00 2001 From: Oleksii Holub <1935960+Tyrrrz@users.noreply.github.com> Date: Tue, 11 Nov 2025 15:06:39 +0200 Subject: [PATCH 4/5] Apply suggestion from @Tyrrrz --- YoutubeExplode.Converter/Converter.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/YoutubeExplode.Converter/Converter.cs b/YoutubeExplode.Converter/Converter.cs index 9ec33c07..9da29a2b 100644 --- a/YoutubeExplode.Converter/Converter.cs +++ b/YoutubeExplode.Converter/Converter.cs @@ -99,7 +99,7 @@ private async ValueTask ProcessAsync( { if (streamInput.Info is IAudioStreamInfo audioStreamInfo) { - // Have ffmpeg determine best quality possible + // Have FFmpeg determine best quality possible arguments.Add($"-q:a:{lastAudioStreamIndex++}").Add("0"); } } From 66eacad00d08c1881fcf263e13eeec5c836ad84d Mon Sep 17 00:00:00 2001 From: Oleksii Holub <1935960+Tyrrrz@users.noreply.github.com> Date: Tue, 11 Nov 2025 15:30:14 +0200 Subject: [PATCH 5/5] Apply suggestion from @Tyrrrz --- YoutubeExplode.Converter/Converter.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/YoutubeExplode.Converter/Converter.cs b/YoutubeExplode.Converter/Converter.cs index 9da29a2b..4ab3a3f0 100644 --- a/YoutubeExplode.Converter/Converter.cs +++ b/YoutubeExplode.Converter/Converter.cs @@ -91,7 +91,9 @@ private async ValueTask ProcessAsync( // MP3: explicitly specify the bitrate for audio streams, otherwise their metadata // might contain invalid total duration. - // https://superuser.com/a/893044 +// MP3: explicitly specify the quality for audio streams, otherwise their metadata +// might contain invalid total duration. +// https://superuser.com/a/893044 if (container == Container.Mp3) { var lastAudioStreamIndex = 0;