› labaspl › edu › mpeg2_ts(nctu2)a.pdf · dvb-t transport streamtable pointer to pmt 4 … ts...

58
1 DVB-T Transport Stream 陳偉凱 尤信程 國立台北科技大學 資工系

Upload: others

Post on 26-Feb-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

  • 1

    DVB-T Transport Stream陳偉凱

    尤信程

    國立台北科技大學

    資工系

  • 2

    致謝感謝台北科技大學資工系

    林彥龍同學

    協助製作本投影片

  • 3

    Outline

    • Introduction to MPEG-2 part 1• Overview of MPEG-2 Transport Stream (TS)• TS defined (used) in DVB-T• Synchronization technique• Examples from “real” TS files• Conclusions

  • 4

    Introduction (1)

    DVB-T Channel coder & modulator

    Transport Stream (TS)

  • 5

    Introduction (2)

    MPEG-2 Encoder

    MPEG-1 Encoder

    Packetizer

    Packetizer

    MUXMPEG-2 part 1

    VideoSource

    AudioSource

    MPEG encoded stream

    DataSource Packetizer

    Uncompressed stream PES TS

  • 6

    Introduction (3)

    • MPEG-2 part 1(ISO 13818-1) defines multiplexing scheme for streams of video, audio, and data

    • Used by – DVB– DVD– ATSC

  • 7

    Introduction (4)

    • MPEG-2 part 1 defines two schemes for the multiplexing process– Program Stream– Transport Stream

  • 8

    Introduction (5)

    • Program Stream– Mainly for storage media, eg. Disc or Hard Disk– Grouping of video, audio, and data elementary streams that have

    a common time base– Each program stream consists of only one program– Useful in error free environments

    • Large packet size • Packet size may be variable (hard for decoder to predict start

    and end of packets)– DVD standard uses the MPEG-2 Program Stream

  • 9

    MPEG-2 Transport Stream (1)

    • Transport Stream– Combines multiple programs into a single stream– The programs may or may not have common time base– Fixed length packet size

    • Intended for non-error-free environments• Easier to detect start and end of frames• Easy to recover from packet loss/corruption• More difficult to produce and de-multiplex than program

    stream

  • 10

    MPEG-2 Transport Stream (2)

    EncoderVideo

    Audio

    EncoderVideo

    Audio

    EncoderVideo

    Audio

    Program1

    Program2

    Program3

    MPEG

    TS MU

    LTIPLEXER

  • 11

    MPEG-2 Transport Stream (3)

    • ES: Elementary Stream• PES: Packetized Elementary Stream• PES packet: variable length, up to 64 kbytes

    payload• Transport stream packet: 188 bytes• Video, audio, and data (including Program

    Specific Information, PSI) are MUX’ed

  • 12

    Packetized Elementary Stream (1)

    PES PAYLOAD

    3byte star code prefix 00 00 01

    PES Header

    1byte stream type

    2byte length indicator

    Optional PES Header (including DTS/PTS)

    Up to 64 kbytes

    Var length

  • 13

    Packetized Elementary Stream (2)

    • A PES packet is not equal to one frame of video or audio stream

    • The size of a specific PES is solely determined by the multiplexer without parsing the elementary streams

    • Buffer status is the main concern to determine the PES size

  • 14

    Packetized Elementary Stream (3)

    PES packet payload

    Header Payload Adaptation Field(used for stuffing here)

    PES packet Header

  • 15

    Transport Stream Packet (1)

    188 bytes

    4 bytes

    - sync_byte(sync the decoder: 0x47)- tansport_error_indicator- payload_unit_start_indicator (PSI or PES packet)- transport priority (usefule in scalable MPEG2)- PID (13 bit id for each stream)- transport_scrambling control- adaptation_field _control- continuity_counter(counts packets of PES)- PES packet length

    Adaptation field(may not be present)Header

    - discontinuity_indicator- random_access_indicator- ES_priority_indicator- various flags (PCR_flag...)- PCR (if PCR_flag is set) (system time clock,

    every 0.1sec, sync decoder and encoder time)- other fields depending of which flags are set

    Payload(may not be present)

  • 16

    Transport Stream Packet (2)

    • Packet header: 0x47. Detecting of five consecutive 0x47 every 188 bytes confirms the correct lock of packet header

    • PID: Program ID, the unique number assigned to each type of elementary streams

    • PCR: Program Counter Reference, used for audio & video synchronization

    • Recall that one PES packet may across many TS packets

  • 17

    Program Specific Information (1)

    • Having so many packets, where to start de-multiplexing? Answer: PSI

    • PSI transport packets - used by decoder to learn about the transport stream

    • Must decode PSI to know the information related to the “program”

  • 18

    Program Specific Information (2)

    PAT Program Association Table PMT Program Map TableCAT Condition Access TableNIT Network Information Table

    NIT Network Information TableSDT Service Description Table

    BAT Bouquet Association TableEIT Event Information TableRST Running Status TableTDT Time and Date TableTOT Time Offset Table

    ST Stuffing Table

    MPEG2Program Specific Information

    DVB Service Information

    Private Table

  • 19

    Program Specific Information (3)

    • Program Association Table (PAT)– Contains complete list of all programs in the transport stream

    along with the PID for the PMT for each program– Transmitted in transport packets with PID 0– Program number 0 point to the NIT

    • Program Map Table (PMT)– contains the PID for each of the channels associated with a

    particular program– Transmitted in transport packets with PID provided by PAT

  • 20

    Program Specific Information (4)

    TSheader

    Payload ofTS packet

    PID = 0x00 pointer toPMT 1

    pointer toPMT 2

    pointer toPMT 3

    PAT = Program Association

    Table

    pointer toPMT 4

    TSheader

    Payload ofTS packet

    PID fromPAT

    pointer tovideo ES

    pointer toaudio ES

    PMT = Program Map

    Table

    1 PID entry per program

    1 PID entry per elementary stream

  • 21

    Program Specific Information (5)

    • Conditional Access Table (CAT)– must be sent when the elementary stream is scrambled– Not currently in use in Taiwan– Many different methods available – Some approaches uses smart card

    • Some additional information are defined in the DVB-T standard (ETSI EN 300 468), but not in MPEG-2 system part

  • 22

    DVB Service Information (1)

    • Network Information Table (NIT)– Optional and contents are private (not part of MPEG standard)– Actual / other transport stream– service id (program number)– service type– transmission mode– radio frequency– order of QAM– network provider name– bandwidth

  • 23

    DVB Service Information (2)

    • Service Description Table (SDT)– List the names and other parameter of the service with TS– Actual / other transport stream– service name– service provider name– EIT present/following and schedule exit actual TS?– service running status– service scrambling

  • 24

    DVB Service Information (3)

    • Event Information Table (EIT)– Transmission information about present, following, and future

    events– Actual / other transport stream– EIT present/following – EIT schedule– event id– event name– additional event information

  • 25

    DVB Service Information (4)

    • Time and Date Table (TDT)– Transmission actual UCT-time coded as Modified Julian Date

    (MJD) – It may be used to synchronize the internal clock of an Integrated

    Receiver Decoder (IRD)

  • 26

    Decoding Flow (1)

    Transport stream synchronization Sync byte 0x47

    Read out of TS content Program specificationInformation PAT PMT

    Accessing programs Packet identification PID

    Descrambling if require Condition access tableCAT

    Program Synchronization PCR DTS PTS

    Decoding additional data Service information

  • 27

    Decoding Flow (2)Start

    Parse PMT

    Parse NIT

    No header error

    No

    YesNo

    Is PID=0x10 Yes

    No

    Parse SDTIs PID=0x11 Yes

    No

    Parse EITIs PID=0x12Yes

    Parse PATIs PID=0

    Yes

    No

    Is PID in PM_PID

    Yes

    Parse TS header

    Find sync_byte and Read a ts packet

    Define PN and PM_PID

    More ts packets?

    EndNo

    No

    Parse PESIS PID in ES_PIDYes

    No

    Define PN ES_PID

    2 1 2

    1

    No

    Yes

  • 28

    PSI Association (1)PAT

    (PID=0x00)NIT

    (PID=0x10)定義

    PMT(PID 由 PAT

    定義)

    SDT(PID=0x11)

    EIT(PID=0x12)

    TDT(PID=0x14)

    讀取 讀取 讀取

    定義

    定義 提供提供

    提供

    提供

    Service(每個service對應一個

    service_id即program_number)

    提供UTC-time,可用來同步IRD的

    internal clock

    每個program 對應之video 與audio之

    PID

    每個service對應的 name與其他

    service info

    每個service目前/未來所播放之節目資訊,如:播放時間,節目摘要

    每個service的詳細節目單如:播放時間,節目摘要等

  • 29

    PSI Association (2)

    傳送UTC-time,可用來與IDR的internal clock作同步TDT

    提供每一個service的event information。分為 present/following EIT 與schedule EIT。present/following EIT提供目前與下一個播放節目的資訊如:開始播放時間、節目時間長度、節目摘要等);schedule EIT提供較詳細(不限於目前與下一個節目)的節目單

    EIT

    定義每一個service的service info,如service name、service provider name等,以及一個service是否具有EIT present/following或schedule

    SDT

    定義每一個program 所對應之service、service_id(program_number)及此service之type(如DBS、DTS),並提供此transport stream 之transmission parameter,如:QAM order, bandwidth等

    NIT

    定義一個program所對應之 video、audio及 other data之PIDPMT

    定義此transport stream 所包含之program number(可能有好幾個),並提供每個program所對應的PMT的PID(簡寫為PM_PID)

    PAT說明PSI名稱

  • 30

    A/V Synchronization (1)

    • Audio & Video synchronization is necessary• Why? To have lip sync• The A/V sync has nothing to do with the OFDM

    sync (including sampling rate 48/7 MHz)• Therefore, there are two independent timing

    systems inside the DVB-T receiver

  • 31

    A/V Synchronization (2)

    • A/V sync is achieved via STC, PCR, PTS, & DTS• STC: System Time Clock• PCR: Program Counter Reference• PTS : Presentation time stamp • DTS : Decoding time stamp

  • 32

    A/V Synchronization (3)

    • STC is a clock source with a frequency of 27 MHz• PCR is at the adaptation field of the TS packet• PCR is transmitted every 40 ms• For encoder, PCR is a 42-bit counter whose input

    clock is from STC

  • 33

    A/V Synchronization (4)

    • PTS & DTS are at the optional PES headers• PTS & DTS are 33 bits in length• PTS & DTS are transmitted less frequently than

    the PCR case

  • 34

    A/V Synchronization (5)

  • 35

    A/V Synchronization (6)

    • Synchronization approach– Hardware-based approach– Software-based approach

    • Hardware approach requires the actual implementation of the STC at the receiver side. It is suitable for set-top box

    • Software approach requires no additional hardware, and is for PC-based solution

  • 36

    A/V Synchronization (7)

    counter

    27MHz STC

    MPEG-2Encoder

    42bit

    Video

    Audio

    copy

    MPEG-2Decoder

    counter

    27MHz STC

    load

    PCRPCR

    MPEG2-ts

    Every 40ms

    +

    42bit

    Video

    Audio

    LPF

  • 37

    Decoded Example (1)PAT

    0x0149program map PID0x00B4 program number

    0x05DCprogram map PID0x0096 program number

    0x03FCprogram map PID0x0066 program number

    0x03F2program map PID0x0065 program number

    0x03E8program map PID0x0064 program number

    0x0010Network PID0x0000program number

  • 38

    Decoded Example (2)

    program number 0x65 之 PMT0x3F2program number 0x64 之 audio elementary stream PID0x3EBprogram number 0x64 之 audio elementary stream PID0x3EAprogram number 0x64 之 video elementary stream PID0x3E9program number 0x64 之 PMT0x3E8TDT0x14EIT0x12SDT0x11NIT0x10

    PAT(定義program_number 0x64、0x65、0x66、0x96、0xB4及其對應之PM_PID 0x3E8、0x3F2、0x3FC、0x5DC、0x149)

    0x0說明PID

  • 39

    Decoded Example (3)

    null packet0x1FFF

    program number 0xB4之MPEG2 private section packet PID0x150

    program number 0xB4之PMT0x149

    program number 0x96之 MPEG2 part 6 type D packet PID0x5DE

    program number 0x96之 MPEG2 part 6 type D packet PID0x5DD

    program number 0x96之 PMT0x5DC

    program number 0x66之 audio elementary stream PID0x3FE

    program number 0x66之 video elementary stream PID0x3FD

    program number 0x66之 PMT0x3FC

    program number 0x65之 audio elementary stream PID0x3F4

    program number 0x65之 video elementary stream PID0x3F3

  • 40

    Decoded Example (4)

    program_number:0x0066 PMT

    0x03FEelementary PIDMPEG2 audiostream type0x03FDelementary PIDMPEG2 video stream type0x3FDPCR_PID

    program_number:0x0065 PMT

    0x03F4elementary PIDMPEG2 audiostream type0x03F3elementary PIDMPEG2 video stream type0x3F3PCR_PID

    program_number:0x0064 PMT

    0x03EAelementary PID

    0x03E9elementary PID

    MPEG2 audiostream type

    MPEG2 audiostream type0x03E8elementary PIDMPEG2 video stream type0x3E8PCR_PID

  • 41

    Decoded Example (5)

    program_number:0x0096 PMT

    0x05DEelementary PIDMPEG2 part 6 type Dstream type005DDelementary PIDMPEG2 part 6 type Dstream typeNULLPCR_PID

    program_number:0x00B4 PMT

    0x0150elementary PIDMPEG2 private sectionstream typeNULLPCR_PID

  • 42

    Decoded Example (6)

    DBSservice_type

    0x96service_id

    DTSservice_type

    0x66service_id

    DTSservice_type

    0x65service_id

    DTSservice_type

    0x64service_id

    CTVchar

    network name descriptor

    no other frequencyother_frequency_flag

    8k modetransmission_mode

    guard interval value 1/4guard_interval

    2/3 modulation levelcode_rate_LP_stream

    2/3 modulation levelcode_rate_HP_stream

    no hierarchyhierarchy_information

    16-QAMconstellation

    MPE_FEC not usedMPE_FEC_indicator

    Time Slicing not usedTime_Slicing_indicator

    high priorityPriority

    6 MHzbandwhidth

    6.8228MHzcentre_frequency

    terrestrial delivery descriptor

    NIT

  • 43

    Decoded Example (7)

    中視數位台char

    CTVchar

    DTSservice_type

    0x64service_id

    service descriptor

    中視新聞台char

    CTVchar

    DTSservice_type

    0x65service_id

    service descriptor

    生活頻道Char

    CTVchar

    DTSservice_type

    0x66service_id

    service descriptor

    SDT

    GEMSTARchar

    CTVchar

    DBSservice_type

    0x96service_id

    service descriptor

  • 44

    Decoded Example (8)

    晚間新聞搶先報event_name_char

    MPEG2 video aspect ratio 30Hzcomponent_type

    MPEG1 layer 2 audio dual mono channelcomponent_type

    1小時Duration

    2006-6-28-10:00:00start_time

    0x0Bevent_id

    presentpresent/following

    0x0066service_id

    EIT present/following

  • 45

    Decoded Example (9)

    中視新聞全球報導LIVEevent_name_char

    MPEG2 video aspect ratio 30Hzcomponent_type

    MPEG1 layer 2 audio dual mono channelcomponent_type

    1小時Duration

    2006-6-28-11:00:00start_time

    0x0Bevent_id

    followingpresent/following

    0x0066service_id

  • 46

    Decoded Example (10)

    非常男女event_name_char

    MPEG2 video aspect ratio 30Hzcomponent_type

    MPEG1 layer 2 audio dual mono channelcomponent_type

    1小時Duration

    2006-6-28-10:00:00start_time

    0x0Bevent_id

    presentpresent/following

    0x0065service_id

  • 47

    Decoded Example (11)

    晚間新聞(聯播母台)event_name_charMPEG2 video aspect ratio 30Hzcomponent_type

    MPEG1 layer 2 audio dual mono channelcomponent_type

    1小時Duration

    2006-6-28-11:00:00start_time

    0x0Bevent_id

    followingpresent/following

    0x0065service_id

  • 48

    Decoded Example (12)

    大家來說笑event_name_charMPEG2 video aspect ratio 30Hzcomponent_typeMPEG1 layer 2 audio dual mono channelcomponent_type 1小時Duration2006-6-28-10:00:00start_time0x0Bevent_idpresentpresent/following0x0064service_id

  • 49

    Decoded Example (13)

    大家來說笑集數: 669 1、康丁說笑話、吐槽素珠、石松2 、康丁演唱 “ 可憐的戀花再會吧 “3、素珠說笑話、吐槽康丁、石松4 、素珠演唱 “ 四季紅 “5 、石松說笑話、吐槽康丁、素珠6 、石松演唱 “ 阿公店 “

    text_char

    康康郁方康丁素珠石松text_char

  • 50

    Decoded Example (14)

    中視新聞全球報導event_name_char

    MPEG2 video aspect ratio 30Hzcomponent_type

    MPEG1 layer 2 audio dual mono channelcomponent_type

    1小時Duration

    2006-6-28-11:00:00start_time

    0x0Bevent_id

    followingpresent/following

    0x0064service_id

  • 51

    Decoded Example (15)

    EIT schedule (以0x64部份schedule為例)

    大家來說笑event_name_charMPEG2 video aspect ratio 30Hzcomponent_typeMPEG1 layer 2 audio dual mono channelcomponent_type 1小時Duration

    2006-6-28-10:00:00start_time

    0x15event_id

    0x0064service_id

  • 52

    Decoded Example (16)

    大家來說笑集數: 669 1、康丁說笑話、吐槽素珠、石松2 、康丁演唱 “ 可憐的戀花再會吧 “3、素珠說笑話、吐槽康丁、石松4 、素珠演唱 “ 四季紅 “5 、石松說笑話、吐槽康丁、素珠6 、石松演唱 “ 阿公店 “

    text_char

    康康郁方康丁素珠石松text_char

  • 53

    Decoded Example (17)

    中視新聞全球報導event_name_char

    MPEG2 video aspect ratio 30Hzcomponent_type

    MPEG1 layer 2 audio dual mono channelcomponent_type

    1小時Duration

    2006-6-28-11:00:00start_time

    0x16event_id

    followingpresent/following

    0x0064service_id

  • 54

    Decoded Example (18)

    紅拂女第 8 集 李密卻趁機設計翟讓被殺是虯髯客所為,將花夫人囚禁在石牢中,準備等虯髯客來救妻子時,將他一舉成擒。逃跑的程咬金無意間發現李密勾結宇文化及,陰謀讓瓦崗軍和李淵的軍隊相鬥,漁翁得利。虯髯客大急,但苦於重傷,只得忍耐等待時機。 …

    text_char

    data占207bytetext_length

    舒淇霍建華於榮光鄭則仕text_char

    風塵三俠之紅拂女event_name_char

    MPEG2 video aspect ratio 30Hzcomponent_type

    MPEG1 layer 2 audio dual mono channelcomponent_type

    1小時 30 分鐘duration

    2006-6-28-12:00:00start_time

    0x17event_id

    0x0064service_id

  • 55

    Decoded Example (19)

    愛上九點半event_name_charMPEG2 video aspect ratio 30Hzcomponent_typeMPEG1 layer 2 audio dual mono channelcomponent_type 1小時duration2006-6-28-13:30:00start_time0x18event_idfollowingpresent/following0x0064service_id

  • 56

    Decoded Example (20)

    文茜小妹大event_name_charMPEG2 video aspect ratio 30Hzcomponent_typeMPEG1 layer 2 audio dual mono channelcomponent_type 1小時duration2006-6-28-14:30:00start_time0x19event_idfollowingpresent/following0x0064service_id

  • 57

    Decoded Example (21)

    孝莊秘史event_name_charMPEG2 video aspect ratio 30Hzcomponent_typeMPEG1 layer 2 audio dual mono channelcomponent_type 1小時duration2006-6-28-15:30:00start_time0x1Aevent_idfollowingpresent/following0x0064service_id

  • 58

    Conclusions

    • MPEG-2 system overview• Terminologies explained: ES, PES, TS, TS packet,

    etc• MPEG-2 defined: PAT, PMT, and CAT• DVB SI: NIT, SDT, EIT, and TDT• Synchronization concepts• Decoded examples