axiomatic-systems / Bento4

Full-featured MP4 format, MPEG DASH, HLS, CMAF SDK and tools
http://www.bento4.com
1.93k stars 477 forks source link

mp42ts : PSI information not repeated #591

Open esimotas opened 3 years ago

esimotas commented 3 years ago

mp42ts only outputs a PAT and PMT once at the beginning of the stream. While the ISO/IEC 13818-1 which defines MPEG-2 TS does not define a repetition rate for PSI information (PAT, PMT) there are industry guidelines on repetition rates for this information: TR 101 290 standard defines an error should be generated if PSI is not repeated every 500ms ANSI_SCTE-137-6-2017 says 'It is recommended that the PAT repetition rate be eight per second and the PMT repetition rate be eight per second.' ATSC recommended practice is: PAT/PMT repetition interval error (200ms < cycle time ≤ 500ms) Many decoders choke on streams where PSI information is not repeated often enough.

I propose that PMT/PATs are inserted at least every 500ms in the output stream to comply with industry standards

barbibulle commented 3 years ago

Thanks for pointing that out. I’ll try to implement that in the next release.

lfaureyt commented 3 years ago

I would suggest to make the repetition of PSI tables in output MPEG2-TS files optional since (a) it impacts available bandwidth and (b) the specifications that mandate it are only applications (DVB, ATSC, ANSI, etc.) on top of ISO/IEC 13818-1. I know many applications that are fine with just one insertion at the beginning of the output file (e.g. HLS chunk/segment generation). By the way, DVB-SI specification, for instance, mandates many other things that you probably don't want to implement in your tools: insertion of NIT and of a dedicated entry for it in the PAT (pid 16, program 0), etc.

esimotas commented 3 years ago

For HLS RFC8216 says 'The first two Transport Stream packets in a Segment without an EXT-X-MAP tag SHOULD be a PAT and a PMT' Repeating the PAT,PMT sections in HLS TS segments does no harm and bandwidth overhead is minimum for most streams since typical PAT and PMT fit within a 188 TS packet meaning a repetition rate of 2/sec for each would translate to an additional 6kb/s (6 kilobits/sec) But as you say for HLS TS segment generation PSI table repetition could be optional.

In the cases however where mp42ts.exe is used to generate a single TS stream from an mp4 (ie no --segment duration option) I think PSI repetition should be enforced as best practice.

EK701 commented 1 year ago

I am also interested in this enhancement. Has there been any further update? Thanks!