Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

aac+ issue #4

Open
miketyson666 opened this issue May 4, 2024 · 3 comments
Open

aac+ issue #4

miketyson666 opened this issue May 4, 2024 · 3 comments

Comments

@miketyson666
Copy link

Hi Carsten,

I recently noticed an issue with ts2shout with a specific aac+ stream.
It can be played on LMS with ts2shout (ffmpeg built) using your faad script based on ffmpeg (not with faad bin, even compiling faad2) but it is not stable, sometimes the play doesn't start.

I analyzed the ts2shout log and the stream using ffmpeg -i, both for the original stream and the stream encoded by ts2shout.
See below my results, and here https://www.croci.it/download/aac_latm.ts a stream sample. Maybe you are interested to check how this stream is processed by ts2shout (I suspect the issue is the aac_latm codec)

ts2shout log ----- Start
[Mon Apr 22 15:41:52.241994 2024] [ts2shout:info] [pid 1591415] init_structures(): Subscribing to MPEG-TS PID 0, 17, 18 (CHANNEL_TYPE_PAT, CHANNEL_TYPE_SDT, CHANNEL_TYPE_EIT)
[Mon Apr 22 15:41:52.242171 2024] [ts2shout:info] [pid 1591415] ts2shout version unknown compiled 21.04.2024 18:00 started
[Mon Apr 22 15:41:52.242192 2024] [ts2shout:info] [pid 1591415] MPEG streaming without shoutcast support, audio only in CGI mode with RDS support.
[Mon Apr 22 15:41:52.243946 2024] [ts2shout:info] [pid 1591415] fetch_cached_parameters(): found parameters for programme RaiRadio3DVBT
[Mon Apr 22 15:41:55.022856 2024] [ts2shout:info] [pid 1591415] add_channel(): Subscribing to MPEG-TS PID 111 (Type CHANNEL_TYPE_PMT)
[Mon Apr 22 15:41:55.023042 2024] [ts2shout:info] [pid 1591415] extract_pat_payload(): Added 1 possible PMT id(s) with transport_stream_id: 1.
[Mon Apr 22 15:41:55.023200 2024] [ts2shout:info] [pid 1591415] add_payload_from_pmt(): stream language ita' [Mon Apr 22 15:41:55.023260 2024] [ts2shout:info] [pid 1591415] Sorry, no configuration for AAC profile (id=0x80) found. All values guessed. [Mon Apr 22 15:41:55.023300 2024] [ts2shout:info] [pid 1591415] add_payload_from_pmt(): Audio Unkown AAC profile (89)'
[Mon Apr 22 15:41:55.023335 2024] [ts2shout:info] [pid 1591415] add_payload_from_pmt(): Found LATM audio stream in PID 311 (service_id 1)
[Mon Apr 22 15:41:55.023371 2024] [ts2shout:info] [pid 1591415] add_channel(): Subscribing to MPEG-TS PID 311 (Type CHANNEL_TYPE_PAYLOAD)
[Mon Apr 22 15:41:55.033399 2024] [ts2shout:info] [pid 1591415] AAC inline RDS messages are enabled
[Mon Apr 22 15:41:55.033542 2024] [ts2shout:info] [pid 1591415] process_ts_packet: Warning: PID 311 is scrambled.
[Mon Apr 22 15:41:55.033769 2024] [ts2shout:info] [pid 1591415] Synced to LATM, Guessed Samplerate 48000 Hz, Bitrate 128 kBit/s
[Mon Apr 22 15:41:55.033877 2024] [ts2shout:info] [pid 1591415] SDT: Stream is station Rai Radio 3 from network Rai.
[Mon Apr 22 15:41:55.464115 2024] [ts2shout:info] [pid 1591415] aac_decode(): Error submitting the packet to the decoder: Invalid data found when processing input
[Mon Apr 22 15:41:55.464672 2024] [ts2shout:info] [pid 1591415] aac_decode(): Error submitting the packet to the decoder: Invalid data found when processing input
[Mon Apr 22 15:42:00.674609 2024] [ts2shout:info] [pid 1591415] curl_download: Terminated after fetching 0.12 MB and writing 0.07 MB. Exiting.
ts2shout log ----- End

ffmpeg -i From TVH stream with profile=pass
Input #0, mpegts, from 'http://192.168.3.13:9981/stream/channelname/RaiRadio3DVBT?profile=pass':
Duration: N/A, start: 93526.653078, bitrate: N/A
Program 1
Metadata:
service_name : Rai Radio 3
service_provider: Rai
Stream #0:10x137: Audio: aac_latm (HE-AAC) ([17][0][0][0] / 0x0011), 48000 Hz, stereo, fltp
No Program
Stream #0:0[0x12]: Data: epg


ffmpeg -i From ts2shout

[aac @ 0x5a7daf3500c0] More than one AAC RDB per ADTS frame is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[aac @ 0x5a7daf3500c0] Multiple frames in a packet.
[aac @ 0x5a7daf3500c0] channel element 2.11 is not allocated
[aac @ 0x5a7daf3500c0] channel element 2.10 is not allocated
[aac @ 0x5a7daf3500c0] channel element 1.13 is not allocated
[aac @ 0x5a7daf3500c0] Error decoding AAC frame header.
[aac @ 0x5a7daf3500c0] channel element 1.12 is not allocated
[aac @ 0x5a7daf3500c0] channel element 2.11 is not allocated
[aac @ 0x5a7daf3500c0] channel element 1.12 is not allocated
[aac @ 0x5a7daf3500c0] channel element 3.12 is not allocated
[aac @ 0x5a7daf3500c0] channel element 3.8 is not allocated
[aac @ 0x5a7daf3500c0] skip_data_stream_element: Input buffer exhausted before END element found
[aac @ 0x5a7daf3500c0] channel element 2.15 is not allocated
[aac @ 0x5a7daf3500c0] channel element 2.3 is not allocated
[aac @ 0x5a7daf3500c0] channel element 3.7 is not allocated
[aac @ 0x5a7daf3500c0] channel element 2.10 is not allocated
[aac @ 0x5a7daf3500c0] Error decoding AAC frame header.
[aac @ 0x5a7daf3500c0] channel element 1.10 is not allocated
[aac @ 0x5a7daf3500c0] Sample rate index in program config element does not match the sample rate index configured by the container.
[aac @ 0x5a7daf3500c0] decode_pce: Input buffer exhausted before END element found
[aac @ 0x5a7daf3500c0] channel element 3.1 is not allocated
[aac @ 0x5a7daf3500c0] channel element 2.2 is not allocated
[aac @ 0x5a7daf3500c0] channel element 2.0 is not allocated
[aac @ 0x5a7daf3500c0] channel element 2.11 is not allocated
[aac @ 0x5a7daf3500c0] Sample rate index in program config element does not match the sample rate index configured by the container.
[aac @ 0x5a7daf3500c0] Too large remapped id is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[aac @ 0x5a7daf3500c0] If you want to help, upload a sample of this file to https://streams.videolan.org/upload/ and contact the ffmpeg-devel mailing list. ([email protected])
[aac @ 0x5a7daf3500c0] channel element 1.7 is not allocated
[aac @ 0x5a7daf3500c0] channel element 1.6 is not allocated
[aac @ 0x5a7daf3500c0] SBR was found before the first channel element.
[aac @ 0x5a7daf3500c0] channel element 3.0 is not allocated
[aac @ 0x5a7daf3500c0] channel element 1.6 is not allocated
[aac @ 0x5a7daf3500c0] channel element 3.0 is not allocated
[aac @ 0x5a7daf3500c0] Reserved bit set.
[aac @ 0x5a7daf3500c0] Number of bands (5) exceeds limit (1).
[aac @ 0x5a7daf3500c0] skip_data_stream_element: Input buffer exhausted before END element found
[aac @ 0x5a7daf3500c0] channel element 2.11 is not allocated
[aac @ 0x5a7daf3500c0] Error decoding AAC frame header.
[aac @ 0x5a7daf3500c0] channel element 3.14 is not allocated
[aac @ 0x5a7daf3500c0] channel element 3.5 is not allocated
[aac @ 0x5a7daf3500c0] Reserved bit set.
[aac @ 0x5a7daf3500c0] Prediction is not allowed in AAC-LC.
[aac @ 0x5a7daf3500c0] Reserved bit set.
[aac @ 0x5a7daf3500c0] Number of bands (21) exceeds limit (2).
[aac @ 0x5a7daf3500c0] Error decoding AAC frame header.

...The errors go on and on...

Input #0, aac, from 'http://192.168.3.13/radio/RaiRadio3DVBT':
Metadata:
icy-br : 128
icy-sr : 48000
icy-name : Rai Radio 3
Duration: N/A, bitrate: 837 kb/s
Stream #0:0: Audio: aac (Main), 4.0, fltp, 837 kb/s

bye

@carsten-gross
Copy link
Owner

Hello [miketyson666]

I got a MPEG TS already about this issue. It very much seems that this is caused by shoutcast stuff being put into the output stream but the receiver being unable to handle it correctly. If you use ts2shout on the command line you can try (please take care to set "noshout").

cat teststream.ts | ts2shout rds noshout > output.aac

This should give you the plain aac without included shoutcast stuff. Shoutcast bytes are only allowed for players that support it and request it with the Icy-MetaData header in a http(s) request. The resulting aac should be playable with mplayer without error messages.

Regards,
Carsten

@miketyson666
Copy link
Author

Hi Carsten,
sorry, I'm not sure to understand correctly. Let me provide one more example.
Processing two different streams, both without any EPG or RDS information and both aac with the command line, (with or without the parameter noshout doesn't matter) I get a different process report:

Example #1, aac stream with no EPG or RDS (processing this stream with th2shout CGI has no problems)

cat testGamma.ts | ts2shout rds > outputGamma.aac
[Tue May 07 14:51:42.515882 2024] [ts2shout:info] [pid 373719] init_structures(): Subscribing to MPEG-TS PID 0, 17, 18 (CHANNEL_TYPE_PAT, CHANNEL_TYPE_SDT, CHANNEL_TYPE_EIT)
[Tue May 07 14:51:42.516058 2024] [ts2shout:info] [pid 373719] ts2shout version unknown compiled 25.01.2023 21:46 started
[Tue May 07 14:51:42.516075 2024] [ts2shout:info] [pid 373719] MPEG streaming with shoutcast StreamTitles in FILTER mode with RDS support.
[Tue May 07 14:51:42.516158 2024] [ts2shout:info] [pid 373719] add_channel(): Subscribing to MPEG-TS PID 300 (Type CHANNEL_TYPE_PMT)
[Tue May 07 14:51:42.516180 2024] [ts2shout:info] [pid 373719] extract_pat_payload(): Added 1 possible PMT id(s) with transport_stream_id: 1.
[Tue May 07 14:51:42.516203 2024] [ts2shout:info] [pid 373719] add_payload_from_pmt(): Found AAC audio stream in PID 202 (service_id 1)
[Tue May 07 14:51:42.516228 2024] [ts2shout:info] [pid 373719] add_channel(): Subscribing to MPEG-TS PID 202 (Type CHANNEL_TYPE_PAYLOAD)
[Tue May 07 14:51:42.516273 2024] [ts2shout:info] [pid 373719] SDT: Stream is station Radio Gamma Stereo from network Telespazio.
[Tue May 07 14:51:42.524847 2024] [ts2shout:info] [pid 373719] filter_global_loop: read from stream 1.05 MB, wrote 0.35 MB, no bytes left to read - EOF. Exiting.

Example #2, aac stream with no EPG or RDS (processing this stream with th2shout CGI produce the errors reported in my first post)

cat testaac.ts | ts2shout rds > outputTestaac.aac
[Tue May 07 14:52:06.748314 2024] [ts2shout:info] [pid 373805] init_structures(): Subscribing to MPEG-TS PID 0, 17, 18 (CHANNEL_TYPE_PAT, CHANNEL_TYPE_SDT, CHANNEL_TYPE_EIT)
[Tue May 07 14:52:06.748499 2024] [ts2shout:info] [pid 373805] ts2shout version unknown compiled 25.01.2023 21:46 started
[Tue May 07 14:52:06.748518 2024] [ts2shout:info] [pid 373805] MPEG streaming with shoutcast StreamTitles in FILTER mode with RDS support.
[Tue May 07 14:52:06.748617 2024] [ts2shout:info] [pid 373805] add_channel(): Subscribing to MPEG-TS PID 111 (Type CHANNEL_TYPE_PMT)
[Tue May 07 14:52:06.748640 2024] [ts2shout:info] [pid 373805] extract_pat_payload(): Added 1 possible PMT id(s) with transport_stream_id: 1.
[Tue May 07 14:52:06.748690 2024] [ts2shout:info] [pid 373805] add_payload_from_pmt(): stream language ita' [Tue May 07 14:52:06.748717 2024] [ts2shout:info] [pid 373805] Sorry, no configuration for AAC profile (id=0x0) found. All values guessed. [Tue May 07 14:52:06.748736 2024] [ts2shout:info] [pid 373805] add_payload_from_pmt(): Audio Unkown AAC profile (89)'
[Tue May 07 14:52:06.748751 2024] [ts2shout:info] [pid 373805] add_payload_from_pmt(): Found HE-AAC audio stream in PID 311 (service_id 1)
[Tue May 07 14:52:06.748770 2024] [ts2shout:info] [pid 373805] add_channel(): Subscribing to MPEG-TS PID 311 (Type CHANNEL_TYPE_PAYLOAD)
[Tue May 07 14:52:06.748828 2024] [ts2shout:info] [pid 373805] SDT: Stream is station Rai Radio 3 from network Rai.
[Tue May 07 14:52:06.748897 2024] [ts2shout:info] [pid 373805] Synced to HE-AAC, Guessed Samplerate 48000 Hz, Bitrate 128 kBit/s
[Tue May 07 14:52:06.760439 2024] [ts2shout:info] [pid 373805] filter_global_loop: short read, only got 136 bytes, instead of 188, trying to resync
[Tue May 07 14:52:07.211046 2024] [ts2shout:info] [pid 373805] ts_continuity_check: TS continuity error (pid: 311)
[Tue May 07 14:52:07.211161 2024] [ts2shout:info] [pid 373805] Synced to HE-AAC, Guessed Samplerate 48000 Hz, Bitrate 128 kBit/s
[Tue May 07 14:52:07.214499 2024] [ts2shout:info] [pid 373805] filter_global_loop: read from stream 1.20 MB, wrote 0.68 MB, no bytes left to read - EOF. Exiting.

Here the links to the streams:
https://www.croci.it/download/testaac.ts
https://www.croci.it/download/testGamma.ts

As these streams don't carry any EPG or RDS information, it is not a problem play them, as we can avoid ts2shout and simply process with TVH with audio profile. Nevertheless, if the problem is related to the aac format, I suppose one day we can face the same type of streams but with EPG/RDS and ts2shout will be unable to process. I'm submitting this issue just in this perspective.

bye
Damiano

@carsten-gross
Copy link
Owner

Yes, it is the same case as in my above comment. Please use the option "noshout" if you convert at the command prompt and the resulting file is a valid aac file that can be played without errors with a decent version of mplayer/ffmpeg etc.

cat testGamma.ts | ./ts2shout rds noshout > testGamma.aac
[Wed May 29 20:41:33.273228 2024] [ts2shout:info] [pid 5175] init_structures(): Subscribing to MPEG-TS PID 0, 17, 18 (CHANNEL_TYPE_PAT, CHANNEL_TYPE_SDT, CHANNEL_TYPE_EIT)
[Wed May 29 20:41:33.273361 2024] [ts2shout:info] [pid 5175] ts2shout version v0.99-8-g4605a03 compiled 29.05.2024 20:40 started
[Wed May 29 20:41:33.273377 2024] [ts2shout:info] [pid 5175] MPEG streaming without shoutcast support, audio only in FILTER mode with RDS support.
[Wed May 29 20:41:33.273461 2024] [ts2shout:info] [pid 5175] add_channel(): Subscribing to MPEG-TS PID 300 (Type CHANNEL_TYPE_PMT)
[Wed May 29 20:41:33.273481 2024] [ts2shout:info] [pid 5175] extract_pat_payload(): Added 1 possible PMT id(s) with transport_stream_id: 1.
[Wed May 29 20:41:33.273499 2024] [ts2shout:info] [pid 5175] add_payload_from_pmt(): Found AAC audio stream in PID 202 (service_id 1)
[Wed May 29 20:41:33.273514 2024] [ts2shout:info] [pid 5175] add_channel(): Subscribing to MPEG-TS PID 202 (Type CHANNEL_TYPE_PAYLOAD)
[Wed May 29 20:41:33.273566 2024] [ts2shout:info] [pid 5175] SDT: Stream is station Radio Gamma Stereo from network Telespazio.
[Wed May 29 20:41:33.287155 2024] [ts2shout:info] [pid 5175] filter_global_loop: read from stream 1.05 MB, wrote 0.35 MB, no bytes left to read - EOF. Exiting.
The version of mplayer I used for playing the resulting aac is:
mplayer -v
MPlayer 1.4 (Debian), built with gcc-11 (C) 2000-2019 MPlayer Team

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants