FreeTubeApp / FreeTube

An Open Source YouTube app for privacy
https://freetubeapp.io/
GNU Affero General Public License v3.0
13.59k stars 854 forks source link

[Bug]: Strong audio compression artifacts audible since version 0.22.0 #6138

Open MegadoomerX opened 5 days ago

MegadoomerX commented 5 days ago

Guidelines

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

mahidzzr commented 4 days ago

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.

jspast commented 22 hours ago

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.

AlyoshaVasilieva commented 11 hours ago

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).