ESP32-audioI2S icon indicating copy to clipboard operation
ESP32-audioI2S copied to clipboard

Radios with .TS extension extension do not work

Open BerranRemzi opened this issue 2 years ago • 8 comments

Some radios use m3u8playlist which contains TS files inside. This file contains an empty video header and AAC encoded audio data. e.g this radio have TS stream https://bss1.neterra.tv/magicfm/magicfm.m3u8

BerranRemzi avatar Jul 16 '22 20:07 BerranRemzi

I think this should be added to line 1835 for correct Sync word finding && (buf[i+1] != 0xFFu))

BerranRemzi avatar Jul 16 '22 20:07 BerranRemzi

Hello Berran, thanks for your contribution, the syncword is FFFx which makes finding it difficult when a FFFFFF... block exists. If the tests are successful I will implement the correction.

TS files are difficult. There is probably always a sequence of 188 byte frames where the PID decides if the payload is part of the stream. But I don't really know.

schreibfaul1 avatar Jul 16 '22 22:07 schreibfaul1

With this improvement, your library now has the ability to find the correct start offset, but still can't play TS files. I spend several hours for find a solution but there are no success

BerranRemzi avatar Jul 17 '22 08:07 BerranRemzi

Hi Berran, I cloned the Yokohama-Miyazawa (M5HLSPlayer) repo https://github.com/Yokohama-Miyazawa/M5HLSPlayer and saved it as a PlatformIO project with minor changes, see https://github.com/schreibfaul1/M5HLSPlayer it is able to play ts streams. Yokohama did a good job. In the next few days I will explore how TS streams work.

schreibfaul1 avatar Jul 18 '22 17:07 schreibfaul1

Thank you for your reply. I tried cloned code of Yokohama-Miyazawa, it's working with TS streams. But your code can decode almost all streams except TS.

BerranRemzi avatar Jul 18 '22 21:07 BerranRemzi

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 21 '22 02:09 stale[bot]

In the 2000's I had a dvb-c card to watch digital tv, that wasn't seen in my country at that time. I did :-) It was also in mpeg TS (transport stream). The problem is that you can not play it it properly, because it is not divided in to frames like a evry other mpeg is. You need to converted first to a valid format.

podaen avatar Oct 09 '22 19:10 podaen

Only AAC transport streams work, no *.ts as used with IPTV.

Example: https://air.pc.cdn.bitgravity.com/air/live/pbaudio001/playlist.m3u8 In the m3u8 playlist there is a link to https://air.pc.cdn.bitgravity.com/air/live/pbaudio001/chunklist.m3u8 and there you will find several ts files: https://air.pc.cdn.bitgravity.com/air/live/pbaudio001/media_29493.ts https://air.pc.cdn.bitgravity.com/air/live/pbaudio001/media_29494.ts which are then played, after which the playlist is fetched again and contains the next *.ts files. The *.ts files are only valid and available for a short time.

An valid AAC audio stream has the identifier #EXT-X-STREAM-INF:'mp4a.40, everything else is discarded

schreibfaul1 avatar Oct 09 '22 20:10 schreibfaul1