dvbsnoop用法

Just4life發表於2014-05-15
1、安裝
sudo apt-get dvbsnoop
2、ts檢測相關引數簡介

通用引數:

-s ts
檢測型別為ts流
-if 檔名
離線檢測ts流檔案
-pd <mode>
    解碼的輸出細節程度 0-9 ,0表示沒有輸出
-npd
    等同於  -pd 0.
-ph <mode>
指定16進位制輸出的細節程度:
0=no hexdump output, 1=hex output, 2=hex line,
3=ascii line, 4=alternate hex output. (default is 4)
-hexdumpbuffer
-nohexdumpbuffer
Switch  on/off  hexdump  of  stream input buffer.  May be used to
enhance -ph option. (e.g. -ph 4 -nohexdumpbuffer)
-nph
    廢棄,等同於 -nohexdumpbuffer.
-t<mode>
    時間標籤輸出模式:
-tf = full timestamp
-td = delta timestamp mode,
-tn = no time stamp.
-b
二進位制輸出包,取消其他輸出.  用於輸出原資料
Use  this option  to  store  raw data in file or chain data to another pro‐
gram.
E.g.:  dvbsnoop -s ts 0x00 -b > file
dvbsnoop -s pes 0x3FF -b | ./myprogram

There might be a file limit on your system  (mostly  2  GB)  when
writing files using '>'.

TS特有引數:

-tssubdecode

對TS流中si表格資訊、PS/PES資訊進行解碼
Sub-decode  SI  data  (sections)  or  PS/PES  data from transport
stream decoding. This reads transport stream packets and tries to
decode  its  content.   Useful  to  decode  PES or SI data from a
transport stream file.
-tsraw
Read full transport stream (all  pids).   Your  hardware/firmware
has to support this mode.
-N <value>
解碼value個包之後停止,-N表示成功解碼出來的包 -n表示讀入多少個包進行解碼  
預設是0         
Stop after decoding <value> packets. Use this to limit the packet
decoding process.  Useful, when reading stream  data  from  file.
-n  limits  the  read  packet  process,  -N  limits  the decoding
process. Using dvb hardware filters -n would be the same  as  -N.
Default is 0 (no limit).

命令範例:
dvbsnoop -s ts -tssubdecode  -if Gqxsp.ts  -N 2 0x0000 -nph -pd 6

輸出結果:

dvbsnoop V1.4.50 -- http://dvbsnoop.sourceforge.net/

------------------------------------------------------------
TS-Packet: 00000001   PID: 0 (0x0000), Length: 188 (0x00bc)
from file: Gqxsp.ts
------------------------------------------------------------
Sync-Byte 0x47: 71 (0x47)
Transport_error_indicator: 0 (0x00)  [= packet ok]
Payload_unit_start_indicator: 1 (0x01)  [= Packet data starts]
transport_priority: 0 (0x00)
PID: 0 (0x0000)  [= ISO 13818-1 Program Association Table (PAT)]
transport_scrambling_control: 0 (0x00)  [= No scrambling of TS packet payload]
adaptation_field_control: 1 (0x01)  [= no adaptation_field, payload only]
continuity_counter: 0 (0x00)  [= (sequence ok)]
Payload: (len: 184)
==> pointer_field: 0 (0x00)
==> Section table: 0 (0x00)  [= Program Association Table (PAT)]
Data-Bytes:
0000:  00 00 b0 0d 00 05 c1 00  00 01 f7 e1 03 eb a0 5d   ...............]
0010:  4e ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   N...............
0020:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
0030:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
0040:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
0050:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
0060:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
0070:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
0080:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
0090:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
00a0:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
00b0:  ff ff ff ff ff ff ff ff                            ........
==========================================================


TS sub-decoding (1 packet(s) stored for PID 0x0000):
=====================================================
TS contains Section...
SI packet (length=16):
PID:  0 (0x0000)  [= assigned for: ISO 13818-1 Program Association Table (PAT)]

Guess table from table id...
PAT-decoding....
Table_ID: 0 (0x00)  [= Program Association Table (PAT)]
section_syntax_indicator: 1 (0x01)
(fixed): 0 (0x00)
reserved_1: 3 (0x03)
Section_length: 13 (0x000d)
Transport_Stream_ID: 5 (0x0005)
reserved_2: 3 (0x03)
Version_number: 0 (0x00)
current_next_indicator: 1 (0x01)  [= valid now]
Section_number: 0 (0x00)
Last_Section_number: 0 (0x00)

Program_number: 503 (0x01f7)
reserved: 7 (0x07)
Program_map_PID: 259 (0x0103)

CRC: 3953155406 (0xeba05d4e)




------------------------------------------------------------
TS-Packet: 00000002   PID: 0 (0x0000), Length: 188 (0x00bc)
from file: Gqxsp.ts
------------------------------------------------------------
Sync-Byte 0x47: 71 (0x47)
Transport_error_indicator: 0 (0x00)  [= packet ok]
Payload_unit_start_indicator: 1 (0x01)  [= Packet data starts]
transport_priority: 0 (0x00)
PID: 0 (0x0000)  [= ISO 13818-1 Program Association Table (PAT)]
transport_scrambling_control: 0 (0x00)  [= No scrambling of TS packet payload]
adaptation_field_control: 1 (0x01)  [= no adaptation_field, payload only]
continuity_counter: 1 (0x01)  [= (sequence ok)]
Payload: (len: 184)
==> pointer_field: 0 (0x00)
==> Section table: 0 (0x00)  [= Program Association Table (PAT)]
Data-Bytes:
0000:  00 00 b0 0d 00 05 c1 00  00 01 f7 e1 03 eb a0 5d   ...............]
0010:  4e ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   N...............
0020:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
0030:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
0040:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
0050:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
0060:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
0070:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
0080:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
0090:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
00a0:  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff   ................
00b0:  ff ff ff ff ff ff ff ff                            ........

==========================================================


3、列出ts檔案中的所有pid
$dvbsnoop -s ts -tssubdecode  -if Gqxsp.ts    -pd 6  | grep  "^PID:" |sort| uniq
輸出:
PID: 0 (0x0000)  [= ISO 13818-1 Program Association Table (PAT)]
PID: 259 (0x0103)  [= ]
PID: 514 (0x0202)  [= ]
PID: 670 (0x029e)  [= ]
PID: 8191 (0x1fff)  [= Null Packet]
檢視pat表
$dvbsnoop -s ts -tssubdecode  -if Gqxsp.ts    0 -N 2
輸出:
TS sub-decoding (1 packet(s) stored for PID 0x0000):
=====================================================
TS contains Section...
SI packet (length=16):
PID:  0 (0x0000)  [= assigned for: ISO 13818-1 Program Association Table (PAT)]

Guess table from table id...
PAT-decoding....
Table_ID: 0 (0x00)  [= Program Association Table (PAT)]
section_syntax_indicator: 1 (0x01)
(fixed): 0 (0x00)
reserved_1: 3 (0x03)
Section_length: 13 (0x000d)
Transport_Stream_ID: 5 (0x0005)
reserved_2: 3 (0x03)
Version_number: 0 (0x00)
current_next_indicator: 1 (0x01)  [= valid now]
Section_number: 0 (0x00)
Last_Section_number: 0 (0x00)

Program_number: 503 (0x01f7)
reserved: 7 (0x07)
Program_map_PID: 259 (0x0103)
檢視PMT表
$dvbsnoop -s ts -tssubdecode  -if Gqxsp.ts    259 -N 2
輸出:
TS sub-decoding (1 packet(s) stored for PID 0x0103):
=====================================================
TS contains Section...
SI packet (length=31):
PID:  259 (0x0103)

Guess table from table id...
PMT-decoding....
Table_ID: 2 (0x02)  [= Program Map Table (PMT)]
section_syntax_indicator: 1 (0x01)
(fixed '0'): 0 (0x00)
reserved_1: 3 (0x03)
Section_length: 28 (0x001c)
Program_number: 503 (0x01f7)
reserved_2: 3 (0x03)
Version_number: 0 (0x00)
current_next_indicator: 1 (0x01)  [= valid now]
Section_number: 0 (0x00)
Last_Section_number: 0 (0x00)
reserved_3: 7 (0x07)
PCR PID: 514 (0x0202)
reserved_4: 15 (0x0f)
Program_info_length: 0 (0x0000)

Stream_type loop:

Stream_type: 2 (0x02)  [= ITU-T Rec. H.262 | ISO/IEC 13818-2 Video | ISO/IEC 11172-2 constr. parameter video stream]
reserved_1: 7 (0x07)
Elementary_PID: 514 (0x0202)
reserved_2: 15 (0x0f)
ES_info_length: 5 (0x0005)

MPEG-DescriptorTag: 2 (0x02)  [= video_stream_descriptor]
descriptor_length: 3 (0x03)
multiple_frame_rate_flag: 0 (0x00)
frame_rate_code: 3 (0x0003)
MPEG_1_only_flag: 0 (0x00)
constrained_parameter_flag: 0 (0x00)
still_picture_flag: 1 (0x01)


Stream_type: 3 (0x03)  [= ISO/IEC 11172 Audio]
reserved_1: 7 (0x07)
Elementary_PID: 670 (0x029e)
reserved_2: 15 (0x0f)
ES_info_length: 0 (0x0000)

CRC: 4271305530 (0xfe96f33a)


CRC: 3953155406 (0xeba05d4e)