MPEG-TS file audio and video frame length

2019-07-15 12:38发布

问题:

Can I discover byte length of each video(I,P,B) and audio frame in MPEG2 TS file not reading frame content byte by byte (from NAL unit header for example)?

回答1:

in MPEG-TS files, in the PES layer, there is a field called "PES length" which includes all the data but without the PES headers. To extract this information accurately you must understand if there is a PES header per frame or not. Alas, in video mostly, this field is often left 0, and the only true way to count the bytes per frame is between the video start codes in the ES level.