2

Does Apple specify this? How many access units should one put in a PES packet payload?

Also, I'm wondering which prefix start codes (if any) are present in PES packets. I assume that the one preceding the first NAL unit within an access unit is useless and mustn't be put. Right?

I'd like to know how it's done specifically in HLS - not necessarily any other MPEG-2 TS application.

matt-pielat
  • 1,659
  • 3
  • 20
  • 33

1 Answers1

7

I'd like to know how it's done specifically in HLS - not necessarily any other MPEG-2 TS application.

HLS is a standard MPEG-2 TS stream. HLS does not do it any differently, except limit to a single audio and singe video stream. And limit codecs to AVC/AAC/MP3

For the rest of the answers, I will assume you are referring to the AVC codec. (AAC and and MP3 have different answers)

How many access units should one put in a PES packet payload?

One. However for efficiency, the last NALU may be truncated on a TS boundary, and the remainder prepended to the next AU at the start of the next PES. This is optional, but it does reduce bitrate.

I'm wondering which prefix start codes (if any) are present in PES packets.

MPEGTS requires annex B style start codes. One start code before every NALU. An AU will have several NALUs as AUDs are required in mpegts.

I assume that the one preceding the first NAL unit within an access unit is useless and mustn't be put. Right?

Completely wrong. Every NALU must begin with a start code,

szatmary
  • 29,969
  • 8
  • 44
  • 57
  • Thank you very much! Does an audio access unit span one PES packet payload as well? – matt-pielat Sep 15 '14 at 20:51
  • 1
    several audio frames maybe be inserted into a single PES packet. (But in the case of AAC every frame should have its own ADTS header) If you use the audio PID for PCR, then you should not put more that 100ms in a single packet. Nor should you never put more than 8191 bytes due to an old bug in android. And finally, audio frames can not be split and continued like AVC frames can. – szatmary Sep 15 '14 at 20:56
  • @szatmary Hello, I know it's been 6 years you've written this, but I am currently working on a project, which I need these information. I have T-REC-H.222.0-201703, but it doesn't seem to contain the information you mentioned in the comment, do you have a suggestion where I can find these info ? My HLS searchs in google were unfruitful. Thank you for your time. – Rockybilly Jul 24 '20 at 08:00
  • Nope, no idea where it’s documented. I discovered it by reverse engendering. – szatmary Jul 24 '20 at 11:16
  • @szatmary, That's all I've been doing :D Thanks anyway :) – Rockybilly Jul 25 '20 at 05:48
  • I know you already gave your disappointing answer, but maybe there's still a chance for me. Question: I understand that one PES packet payload may contain multiple audio frames, but what exactiy is ACCESS UNIT (the term used in H.222 spec) - is it FRAME or also the group of frames contained in one PES packet payload? The dillema is because the buffering rules rely on the "access unit" term, but then H.222 gives no hint how to extract single frames from multiple frames in one PES packet payload. – Ethouris Nov 22 '21 at 16:13
  • Please don’t ask new questions in the comments. If you have a new question, make a new post. – szatmary Nov 23 '21 at 17:30