Karaf Console: Issue playing AAC streams

Platform information:

  • Hardware: RaspberryPi3
  • OS: openHabian 3.0.1
  • openHAB version: 3.0.1

Hi,

I am trying to create an Item in my system to play online radio and allowing the user to select the channel. Just to make sure everything worked before jumping to the scripting part, I went to the Karaf console and it seems I am unable to stream from sources with .AAC extensions but others work.

For example, out of the following two, the first one works perfectly and starts streaming right away but the second does not stream anything:

openhab> openhab:audio stream https://crtve-ice-edge-2001-fra-eco-cdn.cast.addradio.de/crtve/rnerc/main/mp3/high
openhab> openhab:audio stream https://22343.live.streamtheworld.com/CADENASERAAC.aac

However, checking the log, the following gets printed for both:

==> /var/log/openhab/openhab.log <==
2021-02-21 18:34:48.729 [WARN ] [nternal.javasound.JavaSoundAudioSink] - Cannot determine master volume level - assuming 100%
2021-02-21 18:34:49.197 [ERROR] [nternal.javasound.JavaSoundAudioSink] - An exception occurred while playing audio : 'Bitstream errorcode 102'

To rule out issues with codecs missing, I installed MPlayer and tried both streams with it. There was some lag (specially for the second one), but both ended up playing just fine. I went back to the Karaf console and the .AAC one is still not working. Any ideas?

Just for information sake, MPlayer did print some information about each of the streams, including the codecs. First stream:

openhabian@openHABianDevice:~ $ mplayer https://crtve-ice-edge-2001-fra-eco-cdn.cast.addradio.de/crtve/rnerc/main/mp3/high
MPlayer 1.3.0 (Debian), built with gcc-8 (C) 2000-2016 MPlayer Team
do_connect: could not connect to socket
connect: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing https://crtve-ice-edge-2001-fra-eco-cdn.cast.addradio.de/crtve/rnerc/main/mp3/high.
libavformat version 58.20.100 (external)
Cannot seek backward in linear streams!
... (Several lines with the same message)
Audio only file format detected.
==========================================================================
Opening audio decoder: [mpg123] MPEG 1.0/2.0/2.5 layers I, II, III
AUDIO: 44100 Hz, 2 ch, s16le, 128.0 kbit/9.07% (ratio: 16000->176400)
Selected audio codec: [mpg123] afm: mpg123 (MPEG 1.0/2.0/2.5 layers I, II, III)
==========================================================================

Second stream:

openhabian@openHABianDevice:~ $ mplayer https://22343.live.streamtheworld.com/SER_BILBAOAAC.aac
MPlayer 1.3.0 (Debian), built with gcc-8 (C) 2000-2016 MPlayer Team
do_connect: could not connect to socket
connect: No such file or directory
Failed to open LIRC support. You will not be able to use your remote control.

Playing https://22343.live.streamtheworld.com/SER_BILBAOAAC.aac.
libavformat version 58.20.100 (external)
Cannot seek backward in linear streams!
... (Several lines with the same message)
libavformat file format detected.
Cannot seek backward in linear streams!
[lavf] stream 0: audio (aac), -aid 0
==========================================================================
Opening audio decoder: [ffmpeg] FFmpeg/libavcodec audio decoders
libavcodec version 58.35.100 (external)
AUDIO: 44100 Hz, 2 ch, floatle, 54.4 kbit/1.93% (ratio: 6804->352800)
Selected audio codec: [ffaac] afm: ffmpeg (FFmpeg AAC (MPEG-2/MPEG-4 Audio))
==========================================================================

Short update: tried installing packages libavcodec58, libavcodec-extra and ffmpeg and all their dependencies on my RPi, as those are supposed to be the packages adding support for ffmpeg codecs.

After installing ffmpeg I did test that the codecs worked fine again, using ffplay <stream>.aac -nodisp and the stream plays perfectly.

Still, from the openhab console nothing and unfortunately setting the logging level of org.openhab.core.audio to DEBUG does not help at all as nothing beyond the WARN and ERROR from the already posted logs is showing.

Is it possible that the openhab console does not support these streams even if openhabian does? If that is the case, how could I play the streams from a script? My intention was to use the following but, from my understanding, if the openhab console does not work, this won’t either:

var Audio = Java.type("org.openhab.core.model.script.actions.Audio");
Audio.playStream(sink, myStreamUrl);