TimeSide icon indicating copy to clipboard operation
TimeSide copied to clipboard

Audio artifacts on FLAC encoded files

Open gnuletik opened this issue 4 years ago • 3 comments

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

gnuletik avatar Jun 23 '20 13:06 gnuletik

Linked to the libav opus decoder.

yomguy avatar Oct 12 '20 14:10 yomguy

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

gnuletik avatar Jan 27 '21 12:01 gnuletik

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:

  • making sure aubio was compiled with libflac support (trying the above command for instance)
  • the flac encoder is used in aubio/src/io/sink.c

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.

piem avatar Jan 27 '21 12:01 piem

No pb in the last 1.2 version using aubio 0.4.9

yomguy avatar Apr 19 '23 14:04 yomguy