Cannot stream in AAC/AAC+

Hi

I can stream using MP3 but I can’t get AAC streaming to work - LT just reports “Getting information from the server” and that just hangs. The AAC account is on an external Icecast server - and that account is working.

Here’s the output of:
grep aac /var/log/airtime/pypo-liquidsoap/ls_script_legacy.log

2020/11/08 13:21:44 [main:3] Using: graphics=[distributed with Ocaml] pcre=7.2.3 dtools=0.3.1 duppy=0.5.1 duppy.syntax=0.5.1 cry=0.2.2 mm=0.2.1 xmlplaylist=0.1.3 lastfm=0.3.0 ogg=0.4.5 vorbis=0.6.1 opus=0.1.0 speex=0.2.0 mad=0.4.4 flac=0.1.1 flac.ogg=0.1.1 dynlink=[distributed with Ocaml] lame=0.3.2 shine=0.2.0 gstreamer=0.2.0 frei0r=0.1.0 voaacenc=0.1.0 theora=0.3.0 gavl=0.1.5 bjack=0.1.4 alsa=0.2.3 ao=0.2.0 samplerate=0.1.2 taglib=0.3.1 magic=0.7.3 camomile=0.8.4 inotify=1.0 faad=0.3.2 soundtouch=0.1.7 portaudio=0.2.0 pulseaudio=0.1.2 ladspa=0.1.4 dssi=0.1.1 sdl=0.9.1 camlimages=4.2.0 lo=0.1.0 yojson=1.3.2 gd=1.0a5
2020/11/08 13:21:44 [dynamic.loader:3] Could not find dynamic module for fdkaac encoder.
2020/11/08 13:21:44 [dynamic.loader:3] Could not find dynamic module for aacplus encoder.
2020/11/08 13:21:44 [dynamic.loader:2] Loaded plugin file /usr/lib/liquidsoap/1.1.1/plugins/voaacenc.cmxs.

The plugins loaded are as follows:

2020/11/08 13:21:44 [dynamic.loader:3] Could not find dynamic module for fdkaac encoder.
2020/11/08 13:21:44 [dynamic.loader:3] Could not find dynamic module for aacplus encoder.
2020/11/08 13:21:44 [dynamic.loader:2] Loaded plugin file /usr/lib/liquidsoap/1.1.1/plugins/faad.cmxs.
2020/11/08 13:21:44 [dynamic.loader:2] Loaded plugin file /usr/lib/liquidsoap/1.1.1/plugins/lame.cmxs.
2020/11/08 13:21:44 [dynamic.loader:2] Loaded plugin file /usr/lib/liquidsoap/1.1.1/plugins/ao.cmxs.
2020/11/08 13:21:44 [dynamic.loader:2] Loaded plugin file /usr/lib/liquidsoap/1.1.1/plugins/alsa.cmxs.
2020/11/08 13:21:44 [dynamic.loader:2] Loaded plugin file /usr/lib/liquidsoap/1.1.1/plugins/voaacenc.cmxs.
2020/11/08 13:21:44 [dynamic.loader:2] Loaded plugin file /usr/lib/liquidsoap/1.1.1/plugins/cry.cmxs.
2020/11/08 13:21:44 [dynamic.loader:2] Loaded plugin file /usr/lib/liquidsoap/1.1.1/plugins/mad.cmxs.
2020/11/08 13:21:44 [dynamic.loader:2] Loaded plugin file /usr/lib/liquidsoap/1.1.1/plugins/pulseaudio.cmxs.
2020/11/08 13:21:44 [dynamic.loader:2] Loaded plugin file /usr/lib/liquidsoap/1.1.1/plugins/flac.cmxs.
2020/11/08 13:21:44 [dynamic.loader:2] Loaded plugin file /usr/lib/liquidsoap/1.1.1/plugins/portaudio.cmxs.
2020/11/08 13:21:44 [dynamic.loader:2] Loaded plugin file /usr/lib/liquidsoap/1.1.1/plugins/ogg.cmxs.
2020/11/08 13:21:44 [dynamic.loader:2] Loaded plugin file /usr/lib/liquidsoap/1.1.1/plugins/taglib.cmxs.
2020/11/08 13:21:44 [dynamic.loader:2] Loaded plugin file /usr/lib/liquidsoap/1.1.1/plugins/vorbis.cmxs.
2020/11/08 13:21:44 [dynamic.loader:2] Loaded plugin file /usr/lib/liquidsoap/1.1.1/plugins/flac_ogg.cmxs.

So, LT appears to be loading the lame plugin for MP3 and other codecs. But fdkaac/aacplus is b0rked.

What recommendations are there for installing fdkaac/aacplus ???

Many thanks in advance.

Hi, what about the info in this post?

is it usable nowadays?
thanks.

from the same thread:

just to confirm that this approach seems to be working! (in a hacky way as @hairmare says in that post :slight_smile:
Tomorrow I’ll try to reproduce the steps I followed but mainly are the ones there…
thanks!!

1 Like

Ok, thanks @matias-tecnosoul - I tried following the instructions but I’ve now wrecked MP3 streaming as well. I’m glad that I have a development box to work on…!

If you could post your successful steps here then that would be a great help - thank you.

Yeah, it’s a quite risky procedure :upside_down_face:
I already had a Libretime vf62ed7d2 running on an up-to-date Ubuntu 18.04 Lxc box.
So I installed Opam following: http://opam.ocaml.org/doc/Install.html

There is a ppa available that contains the current stable version of opam.

apt-get install software-properties-common #to add add-apt-repository to ubuntu18

add-apt-repository ppa:avsm/ppa

apt update

apt install opam

opam init

Since I want to use the Fraunhofer FDK AAC Codec Library

and saw that it

Conflicts * liquidsoap>=1.3.0 & <1.4.0

I installed a specific version of LS following: https://github.com/LibreTime/libretime/issues/192#issue-225071607

as a base but skipping some steps because the wanted version is now in Opam (it wasn’t then):

mkdir /usr/local/opam

chown liquidsoap:liquidsoap /usr/local/opam /usr/share/liquidsoap/

-# we need to switch to the liquidsoap user, some things do not like being installed as root

usermod -s /bin/bash liquidsoap

-# switch to now active liquidsoap user

sudo --login -u liquidsoap

-# run as liquidsoap user

opam init --root=/usr/local/opam

-# To setup the opam/ocaml you initialized in the current shell, you need to run:
-# Until you install a profile you need to do this each time you want liquidsoap on the $PATH

eval ``opam config env --root=/usr/local/opam` #beware of the quotes it’s single but the editor understands it as a mark.

-#From https://www.liquidsoap.info/doc-1.3.7/install.html

-#for LS 1.3.7 you should have OCaml version 4.07, which can be achieved by typing

opam switch create 4.07.1

-#I added a --set-root from a suggestion of Opam.

eval $(opam env --root=/usr/local/opam --set-root)

-# I installed the deps as root before re-installing as user liquidsoap
-# run this as root after running an additional eval opam config env --root=/usr/local/opam

eval opam config env --root=/usr/local/opam --set-root

[WARNING] Running as root is not recommended

opam depext alsa cry fdkaac lame liquidsoap mad opus taglib vorbis

-# install liquidsoap and deps we need (run this as user liquidsoap again)

sudo --login -u liquidsoap

-#I checked the “switch”

opam switch list

 switch compiler description

→ 4.07.1 ocaml-base-compiler.4.07.1 4.07.1

-#and finally installed the deps and LS v1.3.7

opam install alsa cry fdkaac lame mad opus taglib vorbis liquidsoap.1.3.7

#then I pinned LS

opam pin add liquidsoap 1.3.7

eval ´opam config env --root=/usr/local/opam --set-root’

-# remove distro liquidsoap

apt-get remove liquidsoap

-# run this as root to make liquidsoap your default on the whole system (extremely hacky)

ln -s /usr/share/liquidsoap/.opam/4.07.1/bin/liquidsoap /usr/bin/liquidsoap

-#/usr/share/liquidsoap is the “home”dir of the liquidsoap user

-#and now I can see LS v1.3.7! :nerd_face:

liquidsoap --version

Liquidsoap 1.3.7

-#then I updated LT’s git

~/libretime# git pull

-#What I understood from some posts is that now the installer has a check for Liquidsoap’s version and acts accordingly to that. So no more hacks should be necessary.

-#so I run the installer ignoring the deps so that distro LS doesn’t get installed again.

~/libretime# ./install --ignore-dependencies

I don’t know how this could be set to avoid future errors while updating or similar. But now I’m streaming on both mp3 and acc :smiley:

I have to admit I got quite lost running some opam’s commands as root and others as liquidsoap user and setting the “env” and stuff… So I’m not sure for how long this hybrid install is going to work. I tried rebooting the box and it started all correctly, but I’ll try to keep this post updated.

Also I’d like to collaborate with the LT’s docs regarding this if that’s possible. Of course would be much better to do it with someone else…. so, lets keep testing @Itcrowd
cheers…

1 Like

Thanks for this @matias-tecnosoul - if I get this going then I will certainly contribute toi the documentation anf give back to the community.

I’ll let you know if I am successful. I might have got confused between root user versus liquidsoap user so I may have to start again.

I think I specifically need to be streaming with aacplus as, I believe, that the codec supports higher bitrates and my user is demanding this.

I’ll let you know how I get on - many thanks for this :+1:t4:

wrt to AAC… Please consider encoding AAC using a hardware-codec from a vendor that has an MPEG-LA license. While it’s possible to get the %fdkaac codec to work in liquidsoap, it’s probably not going to sound nice since the open-sourced AAC codecs mostly have a focus on voice rather than HiFi audio.

The “open-sourced-via-google” codec from Fraunhofer most folx use doesn’t supprt parametric stereo encoding due to patent reasons and is not useable for things like DAB+. It’s more a version of the AAC codec gearded towards telefony rather than being broadcast grade.