`

MPEG-2 TS PAT header decoding problem

阅读更多
引用


Hi,
I'm trying to develop a basic MPEG-2 Transport Stream decoder in order to extract metadatas about PSI packets. I have a bunch of books and documents (but not the standard itself) describing the stream layout; I also have some consistent TS files for testing and a TS analyser software (Manzanita's MP2TSA) to validate my assertions. The documents I use sometimes disagree, but I was able to filter the correct information up to this point. Now I have the following problem while trying to decode a PAT section: there's an extra byte in the PAT header, undocumented in all documents I've used so far. Below is the beginning of a TS Packet containing a PAT section (the remaining bytes of the packet have a value of FF):

Code:
47 40 00 10 00 00 B0 0D 00 01 C1 00 00 00 02 E1 E0 2F 39 8D 8D  .....
|TS Header |   PAT Header                 | ? |  Program   |  CRC32      | Stuffing bytes
According to all the docs I have, the PAT header's length should be equal to 8; but it ended with a mismatch when comparing my results to the ones given by MP2TSA (which is an accurate tool). Adjusting the header's length value to 9 "solves" the problem... but I don't like to use intuitive reasoning! The question is:

Does someone know the exact layout of a PAT header?

Another problem, leading to the same question:

I'm confused about the section_number and last_section_number field values of the PAT header (respectively 0xC1 and 0x00 in the sample above). I found the following description of these fields in the book "Video Demystified, A Handbook for the Digital Engineer", 4th edition (Keith Jack, Newnes, 2005, p.675):

Section_number
[...] The section_number of the first section in the PAT must be 0x00. It is incremented by 1 with each additional section in the PAT.
Last_section_number
This 8-bit binary number specifies the number of the last section (that is, the section with the highest section_number) of the complete PAT.
This is obviously wrong, but I can't figure out why... any ideas?

Thanks for reading

Jerome




引用

The problem is solved...

According to the ITU H.222.0 (05/06) Recommendation (http://www.itu.int/rec/T-REC-H.222.0-200605-I/en), section 2.4.4.2:

[...] When at least one section begins in a given Transport Stream packet, then the payload_unit_start_indicator (refer to 2.4.3.2) shall be set to '1' and the first byte of the payload of that Transport Stream packet shall contain the pointer. When no section begins in a given Transport Stream packet, then the payload_unit_start_indicator shall be set to '0' and no pointer shall be sent in the payload of that packet.
The content of the PAT packet is correctly interpreted this way:

Code:
47 40 00 10 00 00 B0 0D 00 01 C1 00 00 00 02 E1 E0 2F 39 8D 8D  .....
|TS Header | * | PAT Header                   |  Program   |  CRC32      | Stuffing bytes
* = pointer_field
The payload_unit_start is effectively set to 1, so the first byte of the payload data refers to a pointer_field which indicates the number of bytes until the first byte of the section. This makes perfect sense now.

Thanks to myself
:-)



http://forum.videohelp.com/threads/286326-MPEG-2-TS-PAT-header-decoding-problem
分享到:
评论

相关推荐

    MPEG-2 TS packet analyser

    MPEG-2传输流(Transport Stream,简称TS)是一种广泛应用于数字电视、卫星通信和多媒体存储格式的数据传输标准。TS包分析器是针对这种数据流进行深入解析和调试的重要工具,尤其对于从事视频编码、流媒体技术和数字...

    MPEG-2_TS_原理与测量

    MPEG-2_TS,即MPEG-2传输流(MPEG-2 Transport Stream),是MPEG-2标准的一部分,该标准由Moving Picture Experts Group(动态图像专家组,简称MPEG)制定。MPEG成立于1988年,其主要任务是开发视频和音频的压缩编码...

    MPEG-2 TS流无缝拼接

    ### MPEG-2 TS流无缝拼接技术解析 MPEG-2传输流(Transport Stream, TS)无缝拼接是一项关键技术,用于数字电视系统中多个TS流的整合,旨在确保视频流的连续性和时间精度,实现流畅播放。这项技术在数字电视节目的...

    mpeg-2ts流解复用

    MPEG-2传输流(Transport Stream,简称TS)是一种广泛应用于数字电视、卫星电视和有线电视等领域的数据传输格式。这种格式设计的初衷是为了在不可靠的信道上高效地传输多路音视频节目,它具有较强的错误纠正能力,...

    Mpeg2-ts.rar_MPEG_MPEg-2_TS节目_mpeg-4

    MPEG-2传送流(Transport Stream, TS)是MPEG-2系统层的重要组成部分,设计用于通过不可靠或变比特率的传输媒介如卫星、有线电视和互联网传输数据。TS由一系列固定长度的包组成,每个包通常包含188字节。每个TS包头...

    MPEG-2 TS流头文件

    MPEG-2传输流(Transport Stream,简称TS)是一种被广泛应用在数字电视广播中的数据传输格式,由MPEG(Moving Picture Experts Group)制定。MPEG-2 TS流头文件是理解这种码流的关键,它包含了控制和组织传输流数据...

    MPEG-2TS 流分析工具

    MPEG-2传输流(Transport Stream,简称TS)是一种广泛应用于数字电视广播、DVD和IP网络的数据传输格式。它被设计来处理不可靠的传输环境,通过将数据分割成小的、独立的数据包来实现这一点。TS包通常包含188字节,...

    MPEG-2 TS流拼接复用

    MPEG-2传输流(Transport Stream,简称TS)是一种广泛应用于数字电视、卫星通信和IP网络中的数据传输格式。在TS流拼接复用的过程中,我们需要理解几个关键概念和技术要点。 1. **TS包结构**:MPEG-2 TS由一系列188...

    MPEG-2 传输流拼接

    本文旨在探讨MPEG-2传输流(TS)拼接的技术细节,包括码流头尾部的剪切、PAT(Program Association Table)、PMT(Program Map Table)的重写以及PCR(Program Clock Reference)、PTS(Presentation Time Stamp)、...

    MPEG-2时钟同步系统及图像跳帧问题简析

    MPEG-2标准中的时钟同步系统主要依赖于以下四个关键元素:节目时钟参考(Program Clock Reference, PCR)、系统时间时钟(System Time Clock, STC)、解码时间戳(Decoding Time Stamp, DTS)和显示时间戳...

    mpeg2 ts编码

    MPEG-2传输流(Transport Stream,简称TS)是一种广泛应用于数字电视、卫星电视和有线电视等领域的数据传输格式,其设计目的是在不可靠的信道上传输视频和音频数据。下面,我们将深入探讨MPEG-2 TS编码的相关知识点...

    Python的一个解析MPEG-TS的小程序,解析PAT,PMT,PCR,PTS,DTS等信息_python_代码_下载

    它能够帮助开发者或研究人员提取MPEG-TS文件中的关键信息,如PAT(Program Association Table)、PMT(Program Map Table)、PCR(Program Clock Reference)、PTS(Presentation Time Stamp)和DTS(Decoding Time ...

    学习MPEG-2的笔记

    MPEG-2 TS中的音视频同步依赖于PTS(Presentation Time Stamp)和DTS(Decoding Time Stamp)。通过比较PTS,可以确保音频和视频在正确的时刻播放,避免音画不同步。 **ffmpeg转码MPEG2-TS的音视频同步机制分析**:...

    TS tools mpeg2ts 格式分析工具

    在IT领域,MPEG2-TS(Transport Stream)是一种广泛应用于数字电视、卫星广播和视频流媒体的容器格式。TS工具是专门用于分析和处理这种格式的文件的工具集,帮助我们理解、调试和优化MPEG2-TS流。下面我们将深入探讨...

    MPEG TS 文档整理很详细(自己整理)

    - **Program Specific Information (PSI)** 包括PAT(Program Association Table)、PMT(Program Map Table)等,提供了如何解析TS流的必要信息,帮助接收端找到感兴趣的节目和对应的ES数据。 - **Service ...

    一种MPEG-2基本流合成节目流的算法

    MPEG-2码流结构包括三种数据包:PES(Packetized Elementary Stream)、PS和TS,以及两种数据流:PS和TS。PES是由具有共同时间基准的打包基本流组成,每个ES由视频或音频的存储单元(AU-Access Unit)构成,包含头部...

    MPEG-1_Systems_DIS

    2. **时间同步(Time Synchronization)**:MPEG-1系统使用PTS(Presentation Time Stamp)和DTS(Decoding Time Stamp)来确保不同流之间的精确同步,使得解码器能正确地呈现音视频内容。 3. **错误检测与恢复...

    MPEG-1_Audio_CD.pdf

    2. **Part 2 - Video**:这部分规定了视频数据的编码表示及其解码过程,以重建图像。 3. **Part 3 - Audio**:这部分即为MPEG-1 Audio标准,规定了音频数据的编码表示及其解码过程,用于解码音频信号。 4. **Part 4 ...

    MPEG_2 TS流的拼接问题

    在多媒体领域,MPEG-2传输流(Transport Stream,简称TS)是一种广泛应用于数字电视、卫星电视和硬盘录像机等场景的数据传输格式。MPEG-2 TS流包含了大量的音视频数据包,每个包通常为188字节,用于无间断地传输连续...

Global site tag (gtag.js) - Google Analytics