地デジ局のMPEG2-TS(MPTS)をVLCで再生すると、ワンセグが再生される現象がたまに発生します。もちろんVLCでプログラムを正しく選択すれば問題ありません。ただし一々プログラム選択するのは面倒です。
なぜ、ワンセグが選択されるか気になっていたので調査しました。
PSIの確認
基本、プログラムの認識はPAT->PMTの順で行われるはずなので、NGなパターンを確認します。
NGのパターンPSI/SI構成
まず、PATを確認します。
[root@devserver810 mp2sp_conv]# mp2sp_conv 6055-3-20210720-0210-23-TV-Tokyo.m2t | table_filter PAT | head -40
mp2sp_conv version 6.5.31 (c) 2021-2026 Kazuhiro WATANABE
****************** PAT Information ******************
Table_id(8) : 0x00(0)
Section_syntax_indicator(1) : 0x1(1) : true
fixed '0' : 0x0(0)
reserved(2) : 0x3(3)
Section_length(12) : 0x001D(29)
Transport_id(16) : 0x7FE6(32742)
reserved(2) : 0x3(3)
Version_number(5) : 0x00(0)
Current_next_indicator(1) : 0x1(1) : true
Section_number(8) : 0x00(0)
Last_section_number : 0x00(0)
Program_number(16) : 0x0000(0)
reserved(3) : 0x7(7)
PID(13) : 0x0010(16)
Program_number(16) : 0x0430(1072)
reserved(3) : 0x7(7)
PID(13) : 0x01F0(496)
Program_number(16) : 0x0431(1073)
reserved(3) : 0x7(7)
PID(13) : 0x04F0(1264)
Program_number(16) : 0x0432(1074)
reserved(3) : 0x7(7)
PID(13) : 0x05F0(1520)
Program_number(16) : 0x05B0(1456)
reserved(3) : 0x7(7)
PID(13) : 0x1FC8(8136)
CRC32(32) : 0x36AECA09
次に、SDTも確認します。
[root@devserver810 mp2sp_conv]# mp2sp_conv 6055-3-20210720-0210-23-TV-Tokyo.m2t 1456 | table_filter SDT | head -142
mp2sp_conv version 6.5.31 (c) 2021-2026 Kazuhiro WATANABE
****************** SDT(actual) Information ******************
Table_id(8) : 0x42(66)
Section_syntax_indicator(1) : 0x1(1)
Reserved_future_use(1) : 0x1(1)
reserved(2) : 0x03(3)
Section_length(12) : 0x0091(145)
Transport_stream_id(16) : 0x7FE6(32742)
reserved(2) : 0x3(3)
Version_number(5) : 0x00(0)
Current_next_indicator(1) : 0x1(1)
Section_number(8) : 0x00(0)
Last_section_number(8) : 0x00(0)
Original_network_id(16) : 0x7FE6(32742)
Reserved_future_use(8) : 0xFF(255)
Service ID(16) : 0x0430(1072)
reserved_future_use(3) : 0x7(7)
EIT_user_defined_flags(3) : 0x4(4) : Terrestrial digital broadcasting is as follows. Otherwise, it is set to 0x07 (unused). H-EIT exists
EIT_schedule_flag(1) : 0x1(1) : EIT schedule information for the service is present in the current Transport Stream
EIT_present_following_flag(1) : 0x1(1) : EIT_present_following information for the service is present in the current Transport Stream
Running_status(3) : 0x0(0) : undefined
Free_CA_mode(1) : 0x0(0) : all the component streams of the event are not scrambled
Descriptors_loop_length(12) : 0x19(25)
*** Service descriptor ***
Descriptor_tag(8) : 0x48(72)
Descriptor_length(8) : 0x0E(14)
Service_type(8) : 0x01(1) : Digital television service
Service_provider_name_length(8) : 0x00(0)
Service_name_length(8) : 0x0B(11)
Service name(n) :
1B 7C C6 EC D3 45 6C 35 7E 0E 31
テレビ東京1
*** Logo transmission descriptor ***
Descriptor_tag(8) : 0xCF(207)
Descriptor_length(8) : 0x07(7)
Logo_transmission_type(8) : 0x01(1): CDT transmission scheme 1:when referring to CDT directly with download data identification
reserved_future_use(7) : 0x7F(127)
Logo_id(9) : 0x0001(1)
reserved_future_use(4) : 0xF(15)
Logo_version(12) : 0x0003(3)
Download_data_id(16) : 0x0001(1)
Service ID(16) : 0x0431(1073)
reserved_future_use(3) : 0x7(7)
EIT_user_defined_flags(3) : 0x4(4) : Terrestrial digital broadcasting is as follows. Otherwise, it is set to 0x07 (unused). H-EIT exists
EIT_schedule_flag(1) : 0x1(1) : EIT schedule information for the service is present in the current Transport Stream
EIT_present_following_flag(1) : 0x1(1) : EIT_present_following information for the service is present in the current Transport Stream
Running_status(3) : 0x0(0) : undefined
Free_CA_mode(1) : 0x0(0) : all the component streams of the event are not scrambled
Descriptors_loop_length(12) : 0x15(21)
*** Service descriptor ***
Descriptor_tag(8) : 0x48(72)
Descriptor_length(8) : 0x0E(14)
Service_type(8) : 0x01(1) : Digital television service
Service_provider_name_length(8) : 0x00(0)
Service_name_length(8) : 0x0B(11)
Service name(n) :
1B 7C C6 EC D3 45 6C 35 7E 0E 32
テレビ東京2
*** Logo transmission descriptor ***
Descriptor_tag(8) : 0xCF(207)
Descriptor_length(8) : 0x03(3)
Logo_transmission_type(8) : 0x02(2): CDT transmission scheme 2:when referring to CDT using logo identification indirectly with download data identification
reserved_future_use(7) : 0x7F(127)
Logo_id(9) : 0x0001(1)
Service ID(16) : 0x0432(1074)
reserved_future_use(3) : 0x7(7)
EIT_user_defined_flags(3) : 0x4(4) : Terrestrial digital broadcasting is as follows. Otherwise, it is set to 0x07 (unused). H-EIT exists
EIT_schedule_flag(1) : 0x1(1) : EIT schedule information for the service is present in the current Transport Stream
EIT_present_following_flag(1) : 0x1(1) : EIT_present_following information for the service is present in the current Transport Stream
Running_status(3) : 0x0(0) : undefined
Free_CA_mode(1) : 0x0(0) : all the component streams of the event are not scrambled
Descriptors_loop_length(12) : 0x15(21)
*** Service descriptor ***
Descriptor_tag(8) : 0x48(72)
Descriptor_length(8) : 0x0E(14)
Service_type(8) : 0x01(1) : Digital television service
Service_provider_name_length(8) : 0x00(0)
Service_name_length(8) : 0x0B(11)
Service name(n) :
1B 7C C6 EC D3 45 6C 35 7E 0E 33
テレビ東京3
*** Logo transmission descriptor ***
Descriptor_tag(8) : 0xCF(207)
Descriptor_length(8) : 0x03(3)
ogo_transmission_type(8) : 0x02(2): CDT transmission scheme 2:when referring to CDT using logo identification indirectly with download data identification
reserved_future_use(7) : 0x7F(127)
Logo_id(9) : 0x0001(1)
Service ID(16) : 0x0436(1078)
reserved_future_use(3) : 0x7(7)
EIT_user_defined_flags(3) : 0x0(0) : Terrestrial digital broadcasting is as follows. Otherwise, it is set to 0x07 (unused). no EIT exists
EIT_schedule_flag(1) : 0x0(0) : the EIT schedule information for the service should not be present in the Transport Stream
EIT_present_following_flag(1) : 0x0(0) : EIT present/following information for the service should not be present in the Transport Stream
Running_status(3) : 0x0(0) : undefined
Free_CA_mode(1) : 0x0(0) : all the component streams of the event are not scrambled
Descriptors_loop_length(12) : 0x10(16)
*** Service descriptor ***
Descriptor_tag(8) : 0x48(72)
Descriptor_length(8) : 0x0E(14)
Service_type(8) : 0xA1(161) : Special video service
Service_provider_name_length(8) : 0x00(0)
Service_name_length(8) : 0x0B(11)
Service name(n) :
4E 57 3B 7E 1B 7C B5 21 3C D3 B9
臨時サービス
Service ID(16) : 0x05B0(1456)
reserved_future_use(3) : 0x7(7)
EIT_user_defined_flags(3) : 0x1(1) : Terrestrial digital broadcasting is as follows. Otherwise, it is set to 0x07 (unused). L-EIT exists
EIT_schedule_flag(1) : 0x0(0) : the EIT schedule information for the service should not be present in the Transport Stream
EIT_present_following_flag(1) : 0x1(1) : EIT_present_following information for the service is present in the current Transport Stream
Running_status(3) : 0x0(0) : undefined
Free_CA_mode(1) : 0x0(0) : all the component streams of the event are not scrambled
Descriptors_loop_length(12) : 0x19(25)
*** Service descriptor ***
Descriptor_tag(8) : 0x48(72)
Descriptor_length(8) : 0x10(16)
Service_type(8) : 0xC0(192) : Data service
Service_provider_name_length(8) : 0x00(0)
Service_name_length(8) : 0x0D(13)
Service name(n) :
1B 7C C6 EC D3 45 6C 35 7E 37 48 42 53
テレビ東京携帯
*** Logo transmission descriptor ***
Descriptor_tag(8) : 0xCF(207)
Descriptor_length(8) : 0x05(5)
Logo_transmission_type(8) : 0x03(3): Simple logo system
Logo_char(n) :
0E 89 54 58
TX
CRC32(32) : 0xC4A78662
以上から
| Program# | PID | Video Codec | SDTのService descriptor |
|---|---|---|---|
| 0x0430 ( 1072) | 0x01F0 (496) | ITU-T Rec. H.262 | ISO/IEC 13818(MPEG-2)-2 Video | テレビ東京1 |
| 0x0431 ( 1073) | 0x04F0 (1264) | ITU-T Rec. H.262 | ISO/IEC 13818(MPEG-2)-2 Video | テレビ東京2 |
| 0x0432 ( 1074) | 0x05F0 (1520) | ITU-T Rec. H.262 | ISO/IEC 13818(MPEG-2)-2 Video | テレビ東京3 |
| 0x05B0 ( 1456) | 0x1FC8 (8136) | ITU-T Rec. H.264 | ISO/IEC 14496(MPEG-4)-10 Video | テレビ東京携帯 |
| 0x0436 (1078) | (PATに記載なし) | 臨時サービス |
最初に受信したPMTを探します。
まず、PIDリストを作成します。
最初に受信したPATは
Packet:0x0000007D
----------------- TS Header -----------------
PID = 0x0000
TS Sync byte(8) : 0x47
transport_error_indicator(1) : 0x0(0) : false
payload_unit_start_indicator(1) : 0x1(1) : true
transport_priority(1) : 0x1(1) : true
PID(13) : 0x0000
transport_scrambling_control(2) : 0x0(0) : No scramble
adaptation_field_control(2) : 0x1(1) : Payload only
continuity_counter(4) : 0xC(12)
****************** PAT Information ******************
Table_id(8) : 0x00(0)
Section_syntax_indicator(1) : 0x1(1) : true
fixed '0' : 0x0(0)
reserved(2) : 0x3(3)
Section_length(12) : 0x001D(29)
Transport_id(16) : 0x7FE6(32742)
reserved(2) : 0x3(3)
Version_number(5) : 0x00(0)
Current_next_indicator(1) : 0x1(1) : true
Section_number(8) : 0x00(0)
Last_section_number : 0x00(0)
以降のPMT(PID = 0x0430, PID = 0x05B0)を検索します。
Packet:0x00000428
----------------- TS Header -----------------
PID = 0x01F0
TS Sync byte(8) : 0x47
transport_error_indicator(1) : 0x0(0) : false
payload_unit_start_indicator(1) : 0x0(0) : false
transport_priority(1) : 0x1(1) : true
PID(13) : 0x01F0
transport_scrambling_control(2) : 0x0(0) : No scramble
adaptation_field_control(2) : 0x1(1) : Payload only
continuity_counter(4) : 0x6(6)
****************** PMT Information ******************
Packet:0x000003E7
----------------- TS Header -----------------
PID = 0x1FC8
TS Sync byte(8) : 0x47
transport_error_indicator(1) : 0x0(0) : false
payload_unit_start_indicator(1) : 0x1(1) : true
transport_priority(1) : 0x1(1) : true
PID(13) : 0x1FC8
transport_scrambling_control(2) : 0x0(0) : No scramble
adaptation_field_control(2) : 0x1(1) : Payload only
continuity_counter(4) : 0x1(1)
****************** PMT Information ******************
以上の様に、セクション受信完了が、ワンセグが早くなってます。これが原因かと。
AIさんに尋ねてみた
VLCログもあわせて、AIさんの答えは以下の通りです。
実測データによる時系列の完全一致
Packet:0x000003E7(ワンセグ PMTPID = 0x1FC8)
payload_unit_start_indicator = 1,continuity_counter = 1- 1パケット完結で、
0x03E7パケット目で先にPMTセクションのデコードが完了。- VLCのログでも
first packet for pid=8136 cc=0x1→PMTCallBack called for program 1456→selecting program id=1456がここで発火。Packet:0x00000428(フルセグ PMTPID = 0x01F0)
payload_unit_start_indicator = 0,continuity_counter = 6(その直前にあるcc=5と合わせて2パケット目で完結)- ワンセグより 65パケット遅れて(
0x0428パケット目で)ようやくフルセグのPMTセクションが完成。- 実測とログで証明された真実:
PAT受信後に「PMTのセクションデコードが最初に完了したパケット番号」が、ワンセグ(0x03E7)の方がフルセグ(0x0428)よりも早かったため(フルセグPMTがPATの境界で1パケット目と2パケット目に分断され、次の周期のcc=5〜cc=6までセクション完成が遅れたため)。
VLCログの「selecting program id=1456」が決め手で、VLCでは最初に完全にセクションを受信できたPMTのプログラムが再生される仕様によるものですね。
PAT~PAT間に全プログラムのPMTがセクション番号が正しく挿入されるPSIの送信され、かつ、フルセグのPMTがワンセグのPMTのセクション受信完了より先になっているとよかったのですが。