[Bug]: Strong audio compression artifacts audible since version 0.22.0
Guidelines
- [X] I have encountered this bug in the latest release of FreeTube.
- [X] I have encountered this bug in the official downloads of FreeTube.
- [X] I have searched the issue tracker for open and closed issues that are similar to the bug report I want to file, without success.
- [X] I have searched the documentation for information that matches the description of the bug I want to file, without success.
- [X] This issue contains only one bug.
Describe the bug
Since updating to version 0.22.0 on Debian 12/Flatpak, I notice strong audio artifacts in videos using FreeTube that were not there before. The artifacts sound like a form of heavy audio compression ("aquarium-effect") and appear in every quality setting using the DASH video format. I can only compare legacy formats in 360p, however, even on this lower quality setting, the audio artifacts are less noticeable (or different) than using the DASH format.
The artifacts are much more noticeable with music, rather than speech. To reproduce, play the following video in both FreeTube and the native YouTube website: https://youtu.be/G4qVG_FL4_s
Already in the beginning, the artifacts can be heard in the "s"-sounds of the voice and the clarity of the precussion.
Expected Behavior
FreeTube should not introduce audio artifacts and did not in past versions (at least not audibly).
Issue Labels
feature stopped working
FreeTube Version
v0.22.0 Beta
Operating System Version
Debian 12
Installation Method
Flathub
Primary API used
Local API
Last Known Working FreeTube Version (If Any)
previous version
Additional Information
No response
Nightly Build
- [ ] I have encountered this bug in the latest nightly build.
I have encountered the same bug. I have a guess why it is happening. After the update the default audio quality of DASH format become 54 kbits/s. And there is no option to see or change it in the UI. it should have been max which is 140 kbits/s.
For now a temporary solution is switch to Audio format change the audio quality to 140 kbits/s and then switch back to DASH format, Although changing video quality after that brings back the problem again.
For a moment I thought this was not happening for other people, I even tried asking #5678 author who apparently got this problem fixed in 0.22.
Just to add a bit of information: it seems the player uses opus 249 stream for every video that has it available, instead of 251. Artifacts are extremely noticeable on stream 249 as its bitrate is really low. It's so impactful that for a reasonable amount of videos, the stream is not even generated by YouTube.
I replaced this line:
https://github.com/FreeTubeApp/FreeTube/blob/d158d2925d193e07414029cdc4b26b2a99f1a3ae/src/renderer/components/ft-shaka-video-player/ft-shaka-video-player.js#L1248
with
chosenVariant = matches.reduce((prev, current) => {
return (current.audioBandwidth > prev.audioBandwidth) ? current : prev
}, matches[0])
and it seems to improve things; I see Opus 251 and AAC 140 (128kbps?) instead of Opus 249. However, this is only if you don't select a quality manually. Selecting a quality manually chooses low quality audio streams. I don't know how to fix it fully (and this 'fix' is suspiciously hacky to me).
I'm having this issue with the latest version off the development branch as well.
This issue is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 7 days.
This issue is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 7 days.
Please do not close this, it's one of the issues that affects usability the most right now, only second to the new hapazard 403 errors. The workaround consisting of switching to legacy formats, cranking up the bitrate, and switching back to dash formats works but is really not viable as it has to be redone for every video.
This issue is stale because it has been open 28 days with no activity. Remove stale label or comment or this will be closed in 7 days.
Is this something we can expect to be changed? Freetube always seems to default to 53 kbps audio for me, which often sounds completely dreadful.
I can only change it by switching to audio formats, changing the audio bitrate and then back to video for every video individually.
Would be really nice to just have a separate audio quality option.
Would be really nice to just have a separate audio quality option.
It can be tied directly to video qulity, audio does not requite that much datarate. The Youtube web player uses high quality audio for 480p and above. I see no reason why Freetube can't do the same.
A slightly less annoying workaround is to set Freetube to default to audio formats, then switch to DASH for each video. For some reason, it seems to default to the highest bit rate that way. So, at the very least, you are switching from audio to DASH, rather than going from DASH to audio, changing the audio quality, then going back to DASH.
I wonder if it would be possible to simply add an audio quality button into DASH?
Still happens in v0.23.1.
It has now been nearly 8 months since this issue was closed and a fix was merged into the development branch, and yet every release in those past 8 months has been plagued by a bad default audio quality. This comment states that this is because the master branch is reserved for "patches and hotfixes", which seems to imply that the fix in question does not meet the criteria of either being a patch nor a hotfix.
I disagree with that assessment, as the issue at hand is a regression, which has now been affecting the codebase for more than a year, and the way it was fixed in the development branch involves a mere 29 lines of code which simply reorder audio streams before playing. As such, it seems to me that the PR fixing this issue does qualify as a hotfix, and I don't see any reason of not merging it further in master, especially given that the bug it fixes strongly affects usability, and there is no guarantee of when 0.24 will happen.