savonet/liquidsoap

Error while sending data: Lang.Runtime_error { kind: "encoder", msg: "Invalid configuration: aot" }!

periode opened this issue · 7 comments

Description

Hello!

I'm trying to stream an AAC-encoded file, and I get the following error:

2024/07/23 10:08:16 [/stream_aac:2] Error while sending data: Lang.Runtime_error { kind: "encoder", msg: "Invalid configuration: aot", pos: [at script/broadcaster.liq, line 39 char 2 - line 44 char 3] }!

Meanwhile, there's also an OPUS stream that works perfectly.

This is the relevant part of the script (I've tried to remove the aot field, and I get the same error)

output.icecast(
  %fdkaac(
    channels = 2,
    samplerate = 44100,
    bandwidth = "auto",
    aot = "mpeg4_hev2_aac",
    bitrate = 128,
  ),
  mount="/stream.aac",
  description="ufo radio stream (aac)",
  host=icecast_host,
  port=icecast_port,
  password=icecast_password,
  radio
)

Steps to reproduce

  • Install opam
  • Install opam deps (including ffmpeg and fdkaac)
  • Install ffmpeg

Expected behavior

Creates an AAC stream and outputs it to Icecast

Liquidsoap version

Liquidsoap 2.2.5+dev

Liquidsoap build config

* Liquidsoap version  : 2.2.5+dev

 * Compilation options
   - Release build       : false
   - Git SHA             : (none)
   - OCaml version       : 4.14.2
   - OS type             : Unix
   - Libs versions       : alsa=0.3.0 angstrom=0.16.0 bigarray=[distributed with Ocaml] bigstringaf=0.9.1 bytes=[distributed with OCaml 4.02 or above] camlp-streams camomile.lib=2.0 cry=1.0.3 curl=0.9.2 dtools=0.4.5 dune-build-info=3.16.0 dune-private-libs.dune-section=3.16.0 dune-site=3.16.0 dune-site.private=3.16.0 duppy=0.9.4 fdkaac=0.3.3 ffmpeg-av=1.1.11 ffmpeg-avcodec=1.1.11 ffmpeg-avdevice=1.1.11 ffmpeg-avfilter=1.1.11 ffmpeg-avutil=1.1.11 ffmpeg-swresample=1.1.11 ffmpeg-swscale=1.1.11 fileutils=0.6.4 gen=1.1 lame=0.3.7 liquidsoap-lang=2.2.5 liquidsoap-lang.console=2.2.5 liquidsoap_alsa liquidsoap_builtins liquidsoap_core liquidsoap_fdkaac liquidsoap_ffmpeg liquidsoap_lame liquidsoap_mad liquidsoap_ogg liquidsoap_optionals liquidsoap_opus liquidsoap_oss liquidsoap_runtime liquidsoap_samplerate liquidsoap_taglib liquidsoap_vorbis mad=0.5.3 magic-mime=1.3.1 menhirLib=20231231 metadata=0.3.0 mm=0.8.5 mm.audio=0.8.5 mm.base=0.8.5 mm.image=0.8.5 mm.midi=0.8.5 mm.video=0.8.5 ogg=0.7.4 ogg.decoder=0.7.4 opus=0.2.2 opus.decoder=0.2.2 pcre=7.5.0 re=1.11.0 samplerate=0.1.6 sedlex=3.2 seq=[distributed with OCaml 4.07 or above] stdlib-shims=0.3.0 str=[distributed with Ocaml] stringext=1.6.0 taglib=0.3.10 threads=[distributed with Ocaml] threads.posix=[internal] unix=[distributed with Ocaml] uri=4.4.0 vorbis=0.8.0 vorbis.decoder=0.8.0
   - architecture        : amd64
   - host                : x86_64-pc-linux-gnu
   - target              : x86_64-pc-linux-gnu
   - system              : linux
   - ocamlopt_cflags     : -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC
   - native_c_compiler   : gcc -O2 -fno-strict-aliasing -fwrapv -pthread -fPIC -D_FILE_OFFSET_BITS=64
   - native_c_libraries  : -lm

 * Configured paths
   - mode              : default
   - standard library  : (set by dune-site)
   - scripted binaries : (set by dune-site)
   - rundir            : (set by dune-site)
   - logdir            : (set by dune-site)
   - camomile files    : (set by dune-site)

 * Supported input formats
   - MP3               : yes
   - AAC               : no (requires faad)
   - Ffmpeg            : yes
   - Flac (native)     : no (requires flac)
   - Flac (ogg)        : no (requires ogg)
   - Opus              : yes
   - Speex             : no (requires speex)
   - Theora            : no (requires theora)
   - Vorbis            : yes

 * Supported output formats
   - FDK-AAC           : yes
   - Ffmpeg            : yes
   - MP3               : yes
   - MP3 (fixed-point) : no (requires shine)
   - Flac (native)     : no (requires flac)
   - Flac (ogg)        : no (requires ogg)
   - Opus              : yes
   - Speex             : no (requires speex)
   - Theora            : no (requires theora)
   - Vorbis            : yes

 * Tags
   - Taglib (ID3 tags) : yes
   - Vorbis            : yes

 * Input / output
   - ALSA              : yes
   - AO                : no (requires ao)
   - FFmpeg            : yes
   - GStreamer         : no (requires gstreamer)
   - JACK              : no (requires bjack)
   - OSS               : yes
   - Portaudio         : no (requires portaudio)
   - Pulseaudio        : no (requires pulseaudio)
   - SRT               : no (requires srt)

 * Audio manipulation
   - FFmpeg            : yes
   - LADSPA            : no (requires ladspa)
   - Lilv              : no (requires lilv)
   - Samplerate        : yes
   - SoundTouch        : no (requires soundtouch)
   - StereoTool        : no (requires ctypes-foreign)

 * Video manipulation
   - camlimages        : no (requires camlimages)
   - FFmpeg            : yes
   - frei0r            : no (requires frei0r)
   - ImageLib          : no (requires imagelib)
   - SDL               : no (requires tsdl-image & tsdl-ttf)

 * MIDI manipulation
   - DSSI              : no (requires dssi)

 * Visualization
   - GD                : no (requires gd)
   - Graphics          : no (requires graphics)
   - SDL               : no (requires tsdl-image & tsdl-ttf)

 * Additional libraries
   - FFmpeg filters    : yes
   - FFmpeg devices    : yes
   - inotify           : no (requires inotify)
   - irc               : no (requires irc-client-unix)
   - jemalloc          : no (requires jemalloc)
   - lastfm            : no (requires lastfm)
   - lo                : no (requires lo)
   - memtrace          : no (requires memtrace)
   - mem_usage         : no (requires mem_usage)
   - osc               : no (requires osc-unix)
   - ssl               : no (requires ssl)
   - tls               : no (requires tls-liquidsoap)
   - posix-time2       : no (requires posix)
   - windows service   : no (requires winsvc)
   - YAML support      : no (requires yaml)
   - XML playlists     : no (requires xmlplaylist)

 * Monitoring
   - Prometheus        : no (requires prometheus)

Installation method

From OPAM

Additional Info

Tried to downgrade to 2.2.1, and same issue.

Hi @periode,
The aot = "mpeg4_hev2_aac" is invalid, it should be one of the

  • mpeg4_aac_lc
  • mpeg4_he_aac
  • mpeg4_he_aac_v2
  • mpeg4_aac_ld
  • mpeg4_aac_eld
  • mpeg2_aac_lc
  • mpeg2_he_aac
  • mpeg2_he_aac_v2

Could you share where you found this value?

Hi @vitoyucepi

To be honest, I don't remember. But I just tried with mpeg4_he_aac_v2, and I tried previously without the aot field, in order to fallback to the default setting, and the result is the same.

Just installed 4.14.2 switch and LS to test. If I have mpeg4_hev2_aac I get

At test25.liq, line 9, char 10-26:
    aot = "mpeg4_hev2_aac",

Error 8: Invalid aot value

With valid value everything works as expected.

Hi @gAlleb,
I agree with your conclusion. There's something wrong with the script, but not with the reference snippet.

@periode,
Could you post the full broadcaster.liq script so I can test it locally?
Also, could you post the result of lsb_release -a, maybe there's something wrong with your OS.

Here's the full script

variables that are included in env.liq are:

  • library_dir (folder with songs)
  • harbor_port (i guess you could remove this, and the request handler with it)
  • fallback_track (single mp3 file)
  • icecast host, port and password
%include "env.liq"

settings.decoder.priorities.ogg.set(20)
settings.harbor.bind_addrs.set(["127.0.0.1"])

current_track = ref([])
def log_current_track(m)
  current_track := [
    ("title", m["title"]),
    ("artist",  m["artist"])
    ]
end

def handle_current(_) =
  let curr = current_track()
  let data = json()
  data.add("title", curr["title"])
  data.add("artist", curr["artist"])
  str = json.stringify(data)

  http.response(content_type="application/json", data=str)
end

harbor.http.register.simple(port=harbor_port, "/current", handle_current)

fallback_track = single("#{fallback_track}")

radio =
  playlist(mode="normal", reload_mode="watch", loop=true, "#{library_dir}")
radio = mksafe(radio)
radio = fallback([radio, fallback_track])
radio.on_track(log_current_track)

# outputs

# output.icecast(
#   %fdkaac(
#     channels = 2,
#     samplerate = 44100,
#     bandwidth = "auto",
#     aot = "mpeg4_he_aac_v2",
#     bitrate = 128,
#   ),
#   mount="/stream.aac",
#   description="ufo radio stream (aac)",
#   host=icecast_host,
#   port=icecast_port,
#   password=icecast_password,
#   radio
# )

output.icecast(
  %opus(
    samplerate = 48000,
    bitrate = 128,
    vbr = "none",
    application = "audio",
    channels = 2,
    signal = "music",
    max_bandwidth = "full_band"
  ),
  mount="/stream.opus",
  description="ufo radio stream (opus)",
  host=icecast_host,
  port=icecast_port,
  password=icecast_password,
  radio
)

lsb_release -a gives:

No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 24.04 LTS
Release:        24.04
Codename:       noble

Thanks for the help!

I've found the reason for this problem.
Ubuntu:24.04 switched from fdk-aac to fdk-aac-free, which has no support for aac-he.

Oh, how interesting!