savonet / liquidsoap

Liquidsoap is a statically typed scripting general-purpose language with dedicated operators and backend for all thing media, streaming, file generation, automation, HTTP backend and more.
http://liquidsoap.info
GNU General Public License v2.0
1.4k stars 130 forks source link

Some tracks are polluted with frequent pops and clicks #3429

Closed caturria closed 1 year ago

caturria commented 1 year ago

Describe the bug Since at least Liquidsoap >= 2.0, quite a few of my audio tracks play back with steady pops and clicks. These tracks do not play like this in other software, when decoded directly via Ffmpeg, or in Liquidsoap versions before 2.0. I do not want to link to a copyrighted track here, however one of the tracks in question was privately sent to @Toots while discussing another issue. I can send this and other tracks that reproduce again if needed. Though this track is definitely hot (it maxes out at around -10 LUFS), its sample peak is -0.8 dB (it doesn't clip). I can play it (and several other tracks) back in Liquidsoap with no processing applied and get distorted results.

To Reproduce radio = single("MOT () - cloudy SEOUL( ).ogg") output.file(%wav, "test.wav", radio)

Expected behavior Track plays back glitch free (as it does in VLC, previous versions of Liq, etc). Version details

vitoyucepi commented 1 year ago

Hi @caturria,

Could you try to reproduce this problem with one of the newer versions? Currently, the latest version is 2.2.1. It would be great if you could also check against the main branch.

Offtop There are currently no plans to continue support for the *2.0* and *2.1* branches. The *2.0.1* and *2.0.3* releases are deprecated, and the last available release for the *2.0* branch is *2.0.7*. If I were you, I would try to migrate to *2.1.4* or *2.2.1*.
caturria commented 1 year ago

Hi, That is a typographical error on my part. I wrote 2.0.1 but meant to write 2.2.1. I'll just edit the comment.

caturria commented 1 year ago

Doesn't seem like I can edit it. But yes; the correct versions are 2.2.1 and 2.2.3.

vitoyucepi commented 1 year ago

Excuse me, but what does 2.2.3 mean? Just to clarify, there's a long line of versions every time you start liquidsoap. Could you copy and paste that part of the liquidsoap startup log?

Log ``` 2023/09/25 02:22:13 [main:3] Liquidsoap 2.2.2+git@80c0621ef 2023/09/25 02:22:13 [main:3] Using: alsa=0.3.0 angstrom=0.15.0 ao=0.2.4 asetmap=0.8.1 asn1-combinators=0.2.6 astring=0.8.5 base64=3.5.1 bigarray=[distributed with OCaml] bigarray-compat=1.1.0 bigstringaf=0.9.1 bjack=0.1.6 bos=0.2.1 bytes=[distributed with OCaml] ca-certs=v0.2.3 camlimages.all_formats=4.2.6 camlimages.core=5.0.4 camlimages.exif=5.0.4 camlimages.gif=5.0.4 camlimages.jpeg=5.0.4 camlimages.png=5.0.4 camlimages.tiff=5.0.4 camlimages.xpm=5.0.4 camlp-streams camomile.lib=2.0 cohttp=5.1.0 cohttp-lwt=5.1.0 cohttp-lwt-unix=5.1.0 conduit=6.2.0 conduit-lwt=6.2.0 conduit-lwt-unix=6.2.0 cry=1.0.2 cstruct=6.2.0 ctypes=0.20.2 ctypes.foreign=0.20.2 ctypes.stubs=0.20.2 curl=0.9.2 domain-name=0.4.0 dssi=0.1.5 dtools=0.4.5 dune-build-info=3.8.2 dune-private-libs.dune-section=3.8.2 dune-site=3.8.2 dune-site.private=3.8.2 duppy=0.9.3 eqaf=0.9 eqaf.bigstring=0.9 eqaf.cstruct=0.9 faad=0.5.2 fdkaac=0.3.3 ffmpeg-av=1.1.9 ffmpeg-avcodec=1.1.9 ffmpeg-avdevice=1.1.9 ffmpeg-avfilter=1.1.9 ffmpeg-avutil=1.1.9 ffmpeg-swresample=1.1.9 ffmpeg-swscale=1.1.9 fileutils=0.6.4 flac=0.5.0 flac.decoder=0.5.0 flac.ogg=0.5.0 fmt=0.9.0 fpath=0.7.3 frei0r=0.1.2 gd=1.0a5 gen=1.1 gmap=0.3.0 hkdf=1.0.4 inotify=2.4.1 integers ipaddr=5.5.0 ipaddr-sexp=5.5.0 ipaddr.unix=5.5.0 irc-client irc-client-unix jemalloc ladspa=0.2.2 lame=0.3.7 lastfm=0.3.3 lilv=0.1.0 liquidsoap-lang=2.2.2 liquidsoap-lang.console=2.2.2 liquidsoap_alsa=v2.2.1-3-g80c0621-dirty liquidsoap_ao=v2.2.1-3-g80c0621-dirty liquidsoap_bjack=v2.2.1-3-g80c0621-dirty liquidsoap_builtins=v2.2.1-3-g80c0621-dirty liquidsoap_camlimages=v2.2.1-3-g80c0621-dirty liquidsoap_core=v2.2.1-3-g80c0621-dirty liquidsoap_dssi=v2.2.1-3-g80c0621-dirty liquidsoap_faad=v2.2.1-3-g80c0621-dirty liquidsoap_fdkaac=v2.2.1-3-g80c0621-dirty liquidsoap_ffmpeg=v2.2.1-3-g80c0621-dirty liquidsoap_flac=v2.2.1-3-g80c0621-dirty liquidsoap_frei0r=v2.2.1-3-g80c0621-dirty liquidsoap_gd=v2.2.1-3-g80c0621-dirty liquidsoap_irc=v2.2.1-3-g80c0621-dirty liquidsoap_jemalloc=v2.2.1-3-g80c0621-dirty liquidsoap_ladspa=v2.2.1-3-g80c0621-dirty liquidsoap_lame=v2.2.1-3-g80c0621-dirty liquidsoap_lastfm=v2.2.1-3-g80c0621-dirty liquidsoap_lilv=v2.2.1-3-g80c0621-dirty liquidsoap_lo=v2.2.1-3-g80c0621-dirty liquidsoap_mad=v2.2.1-3-g80c0621-dirty liquidsoap_magic=v2.2.1-3-g80c0621-dirty liquidsoap_mem_usage=v2.2.1-3-g80c0621-dirty liquidsoap_memtrace=v2.2.1-3-g80c0621-dirty liquidsoap_ogg=v2.2.1-3-g80c0621-dirty liquidsoap_ogg_flac=v2.2.1-3-g80c0621-dirty liquidsoap_optionals=v2.2.1-3-g80c0621-dirty liquidsoap_opus=v2.2.1-3-g80c0621-dirty liquidsoap_osc=v2.2.1-3-g80c0621-dirty liquidsoap_oss=v2.2.1-3-g80c0621-dirty liquidsoap_portaudio=v2.2.1-3-g80c0621-dirty liquidsoap_posix_time=v2.2.1-3-g80c0621-dirty liquidsoap_prometheus=v2.2.1-3-g80c0621-dirty liquidsoap_pulseaudio=v2.2.1-3-g80c0621-dirty liquidsoap_runtime=v2.2.1-3-g80c0621-dirty liquidsoap_samplerate=v2.2.1-3-g80c0621-dirty liquidsoap_sdl=v2.2.1-3-g80c0621-dirty liquidsoap_shine=v2.2.1-3-g80c0621-dirty liquidsoap_soundtouch=v2.2.1-3-g80c0621-dirty liquidsoap_speex=v2.2.1-3-g80c0621-dirty liquidsoap_srt=v2.2.1-3-g80c0621-dirty liquidsoap_ssl=v2.2.1-3-g80c0621-dirty liquidsoap_stereotool=v2.2.1-3-g80c0621-dirty liquidsoap_taglib=v2.2.1-3-g80c0621-dirty liquidsoap_theora=v2.2.1-3-g80c0621-dirty liquidsoap_tls=v2.2.1-3-g80c0621-dirty liquidsoap_vorbis=v2.2.1-3-g80c0621-dirty liquidsoap_xmlplaylist=v2.2.1-3-g80c0621-dirty liquidsoap_yaml=v2.2.1-3-g80c0621-dirty lo=0.2.0 logs=0.7.0 logs.fmt=0.7.0 logs.lwt=0.7.0 lwt=5.6.1 lwt.unix=5.6.1 macaddr=5.5.0 mad=0.5.3 magic=0.7.3 magic-mime=1.3.0 mem_usage=0.0.4 memtrace=0.2.3 menhirLib=20230608 metadata=0.2.0 mirage-crypto=0.11.1 mirage-crypto-ec=0.11.1 mirage-crypto-pk=0.11.1 mirage-crypto-rng=0.11.1 mirage-crypto-rng.unix=0.11.1 mm=0.8.4 mm.audio=0.8.4 mm.base=0.8.4 mm.image=0.8.4 mm.midi=0.8.4 mm.video=0.8.4 ocplib-endian ocplib-endian.bigstring ogg=0.7.4 ogg.decoder=0.7.4 opus=0.2.3 opus.decoder=0.2.3 osc osc-unix parsexp=v0.16.0 pbkdf pcre=7.5.0 portaudio=0.2.3 posix-base=b516d46 posix-socket=b516d46 posix-socket.constants=b516d46 posix-socket.stubs=b516d46 posix-socket.types=b516d46 posix-time2=b516d46 posix-time2.constants=b516d46 posix-time2.stubs=b516d46 posix-time2.types=b516d46 posix-types=b516d46 posix-types.constants=b516d46 ppx_sexp_conv.runtime-lib=v0.16.0 prometheus=1.2 prometheus-app=1.2 ptime=1.1.0 ptime.clock.os=1.1.0 pulseaudio=0.1.6 re=1.10.4 result=1.5 rresult=0.7.0 samplerate=0.1.6 sedlex=a1362bd seq=[distributed with OCaml 4.07 or above] sexplib=v0.16.0 sexplib0=v0.16.0 shine=0.2.3 soundtouch=0.1.9 speex=0.4.2 speex.decoder=0.4.2 srt=0.3.0 srt.constants=0.3.0 srt.stubs=0.3.0 srt.stubs.locked=0.3.0 srt.types=0.3.0 ssl=0.7.0 stdlib-shims=0.3.0 stereotool=v2.2.1-3-g80c0621-dirty str=[distributed with OCaml] stringext=1.6.0 taglib=0.3.10 theora=0.4.1 theora.decoder=0.4.1 threads=[distributed with OCaml] threads.posix=[distributed with OCaml] tls=0.17.0 tsdl=v1.0.0 tsdl-image=0.5 tsdl-ttf=0.5 unix=[distributed with OCaml] unix-errno=52c6ecb unix-errno.errno_bindings=52c6ecb unix-errno.errno_types=52c6ecb unix-errno.errno_types_detected=52c6ecb unix-errno.unix=52c6ecb uri=4.2.0 uri-sexp=4.2.0 uri.services=4.2.0 vorbis=0.8.1 vorbis.decoder=0.8.1 x509=0.16.4 xmlm=1.4.0 xmlplaylist=0.1.5 yaml=3.1.0 yaml.bindings=3.1.0 yaml.bindings.types=3.1.0 yaml.c=3.1.0 yaml.ffi=3.1.0 yaml.types=3.1.0 zarith=1.12 ```
caturria commented 1 year ago

My apologies for the errors. I have 2.2.1: caturria@caturria:~$ liquidsoap --version
Liquidsoap 2.2.1+dev
Copyright (c) 2003-2023 Savonet team
Liquidsoap is open-source software, released under GNU General Public License.
See http://liquidsoap.info for more information.

I also tested with this particular branch: https://github.com/savonet/liquidsoap/tree/fix-3318 as I was working with @Toots on https://github.com/savonet/liquidsoap/issues/3318#issuecomment-1732622841 This build is identified as 2.3.0, not 2.2.3 as I had incorrectly written: Liquidsoap 2.3.0+git@373373cc7
Copyright (c) 2003-2023 Savonet team
Liquidsoap is open-source software, released under GNU General Public License.
See http://liquidsoap.info for more information. Sorry again for the confusion; that's what I get for posting while in a rush.

toots commented 1 year ago

Hi @caturria and thanks for reporting. Would you mind sending me this track?

caturria commented 1 year ago

Hi, I have sent it to your email.

Thank you.

toots commented 1 year ago

Thanks I have it. I'm not able to reproduce yet. Could you share some logs with log.level := 4 added to your script? Thanks!

caturria commented 1 year ago

Sure thing. Logs: https://cloud.caturria.ca/s/4G3a3TFqWGspmHW Here's how it sounds for me: https://cloud.caturria.ca/s/JGo2c2aK4AnaKFq Thank you.

toots commented 1 year ago

Thanks for reporting. The bug has been identified and fixed. It was due to some issues with how we use libsamplerate. It had not shown up until the recent switch to the internal ogg decoder for ogg files (due to ffmpeg limitations decoding chained ogg streams). Should be fixed in main and rolling-release-v2.2.x.

The v2.2.3 release should happen fairly soon. Meanwhile, a good workaround is to use the ffmpeg sampleate converter in your script:

settings.audio.converter.samplerate.converters := ["ffmpeg"]