Parisson / TimeSide

scalable audio processing framework and server written in Python
https://timeside.ircam.fr/docs/
GNU Affero General Public License v3.0
369 stars 59 forks source link

Audio artifacts on FLAC encoded files #207

Closed gnuletik closed 1 year ago

gnuletik commented 4 years ago

When a file is transcoded in FLAC from Youtube, there are audio artifacts in the file.

For example: https://ircam-web.github.io/timeside-player/#/item/84d171ba-6eef-4eb0-afca-2cfa92392db8 https://ircam-web.github.io/timeside-player/#/item/cd22b2c2-7fb2-40e9-b812-2bce34d3fd07 https://ircam-web.github.io/timeside-player/#/item/dcf918bc-d2fa-4f73-bb76-2e538026f747

However, it seems that some files are not concerned: https://ircam-web.github.io/timeside-player/#/item/d5e2e274-1b41-45a8-949a-86347ecb31f6

@piem told us that the transcoding is done by sink_sndfile. So this may be a bug on libsnd side : https://github.com/erikd/libsndfile/issues

It's also possible that the issue only occurs when transcoding from MP3/OGG (compressed format) to FLAC (which seems useless anyway). I don't know any way to encode WAV/FLAC files to confirm this hypothesis. If the issue only occurs when the source file is an MP3 file, then we can workaround this issue by only transcoding to FLAC when the source file is a lossless format (as described in https://github.com/Parisson/TimeSide/issues/173).

yomguy commented 3 years ago

Linked to the libav opus decoder.

gnuletik commented 3 years ago

Hi @yomguy, I just imported a new item on sandbox and the issue remains. See https://ircam-web.github.io/timeside-player/#/item/dad5394a-5a92-449d-9d7f-ab91819ad2da

The audio file is here : https://sandbox.wasabi.telemeta.org/timeside/api/items/dad5394a-5a92-449d-9d7f-ab91819ad2da/download/flac

Should we disable flac for demo purposes ? The mp3 file seems fine : https://sandbox.wasabi.telemeta.org/timeside/api/items/dad5394a-5a92-449d-9d7f-ab91819ad2da/download/mp3

piem commented 3 years ago

hi @gnuletik

if i download the mp3 and convert it to flac with latest aubio, it works well:

piem@localhost:~/projects/aubio/aubio(master)$ ./python/demos/demo_sink.py https://sandbox.wasabi.telemeta.org/timeside/api/items/dad5394a-5a92-449d-9d7f-ab91819ad2da/download/mp3 /tmp/t.flac
wrote 364.10s (17476992 frames in 68269 blocks at 48000Hz) from https://sandbox.wasabi.telemeta.org/timeside/api/items/dad5394a-5a92-449d-9d7f-ab91819ad2da/download/mp3 to /tmp/t.flac

I see aubio_sink_flac is used only on a file with a .flac extension. you could try:

the proper fix might involve adding a method in aubio to preset the sink format before starting to write into it, instead of using the file path to assume the output format, and/or disabling sndfile+flac altogether for now.

yomguy commented 1 year ago

No pb in the last 1.2 version using aubio 0.4.9