Raw Audio Output for ADTS vs LATM
Firstly, AAC audio inside MPEG-TS all seems a bit complex to begin with, so apologies if I'm understanding this completely wrong!
Basically, I use the TVHeadend 'audio' stream profile to stream satellite radio stations from TVHeadend on my Sonos speakers/internet radios in my home. As this profile is just supposed to give the raw audio track, like a webstream would, this usually works great and allows listening to the channels in full quality without transcoding.
The problem I have is with some AAC stations streamed in this way:-
- If the stream type of the AAC in the MPEG-TS is 'LATM', everything works OK and Sonos/Internet radios will play the TVH Audio profile stream perfectly. VLC reports these streams as LATM audio in TS format and then "MPEG AAC Audio (mp4a)" in raw audio profile format (see attached screenshots for "LATM RDP Antena 1" and sample TS/raw audio files 'rdpa1').
- However, if the stream type of the AAC in the MPEG-TS is 'ADTS', the demuxed raw audio version of the stream fails to play on any internet radio/Sonos speaker. VLC will play it, reporting the codec as ADTS in TS format, but also ADTS in raw audio profile format (see attached screenshots for "ADTS Los 40" and sample TS/raw audio files 'los40').
It seems to be that the raw audio profile turns LATM encapsulated AAC into pure AAC but leaves ADTS untouched, which makes it unplayable in a lot of players.
What I'm wondering is would there possibly be a way of getting the raw audio profile to give the raw AAC streams for both formats for maximum compatibility?
An update to this, -
Essentially, the problem is that if an audio stream is AAC (ADTS), TVHeadend doesn't seem to always be able to stream it as raw audio.
With the ADTS Los 40 streams above, I managed to fix it in the end (the MPEG-TS streams were ones I had created myself using FFMPEG from a UDP AAC LATM source). Adding -mpegts_flags 'latm' to force the output TS (input into TVHeadend via an IPTV Pipe input) to keep the LATM AAC encoding. This then plays properly on an Internet radio or Sonos speaker with the AAC-LATM audio decoded correctly. I think these work OK because FFMPEG is creating the MPEG-TS stream that is being later demuxed to raw audio in TVHeadend, so it's always 'compliant' in a way the demuxer in TVHeadend/FFMPEG understands.
However, on some satellite radio stations, where the audio is AAC (ADTS) within the MPEG-TS, the TVHeadend 'raw' audio output format doesn't work at all (the stream just doesn't play). A specific example is the French Alouette radio stations on Eutelsat 5W (11465H). These are all ADTS AAC audio streams.
I think it might be an FFMPEG bug as if I try to decode them to LATM audio using FFMPEG directly, I get a silent audio stream -
ffmpeg -i pipe:0 -c:a copy -f latm pipe:1
Adding '-bsf:a aac_adtstoasc' (although this is implicitly added for latm output anyway) also does not work.
The following outputs a valid ADTS audio stream, but this is only playable by VLC -
ffmpeg -i pipe:0 -c:a copy -f adts pipe:1
I think the raw audio output option of TVHeadend is affected by issues in FFMPEG/AVConv with decoding ADTS into LATM, which was also the cause of my problem before. What I don't understand is why my own accidentally generated ADTS MPEG-TS (Los 40) did at least play as ADTS raw audio in VLC, where the Alouette stations (with ?profile=audio) don't play at all.
However, strangely I also get the same issue with some Slovak radio stations on 1W (12149V Fun Radio 1-5) which are AAC-LATM within the MPEG-TS. Adding '?profile=audio' does not stream anything at all. Other LATM stations (like the RDP ones I posted a clip of before) still work fine.
Streaming raw AAC from TVHeadend just seems to be inconsistent as to whether it will work or not!