Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions YoutubeExplode.Converter/Converter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -91,17 +91,18 @@ 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;
foreach (var streamInput in streamInputs)
{
if (streamInput.Info is IAudioStreamInfo audioStreamInfo)
{
arguments
.Add($"-b:a:{lastAudioStreamIndex++}")
.Add(Math.Round(audioStreamInfo.Bitrate.KiloBitsPerSecond) + "K");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps it's worth noting I didn't investigate whether audioStreamInfo.Bitrate.KiloBitsPerSecond is used elsewhere. It seems it's still useful, at least, to implementations using YoutubeExplode, right? So perhaps no further refactoring is necessary.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you asking on the account of whether this property should be kept or removed? In that case, yes, it should be kept since it's part of YoutubeExplode's public API.

// Have FFmpeg determine best quality possible
arguments.Add($"-q:a:{lastAudioStreamIndex++}").Add("0");
}
}
}
Expand Down