ワンセグ分離

ぐぐるさんに訊くと、Windowsで、TSReader Liteでワンセグ絡みのPIDを調べて、tsselectで抽出する、というのが定番のよう。残念ながらWindowsでないし、foltiaの録画時にワンセグ取り出したいので、GUIで確認といわれても困る。

multimedia/tstools portsの中のtsinfoでは、PATの最初のプログラムのPMTしか拾ってくれない。ワンセグの0x1fc8はたいてい最後。最初のを拾うように決め打っているところを、とりあえず4番目を拾うようにすると、ワンセグ絡みのPMTを読んでPIDを列挙してくれた。

$ tsinfo -m 10000 out.ts
Reading from out.ts
Scanning 10000 TS packets

Packet 655 is PAT
Program list:
    Program 1056 -> PID 0101 (257)
    Program 1057 -> PID 0102 (258)
    Program 1058 -> PID 0103 (259)
    Program 1440 -> PID 1fc8 (8136)
Multiple programs in PAT - using the first
force using [3]

Packet 1120 is PMT with PID 1fc8 (8136)
  Program 1440, version 5, PCR PID 0150 (336)
     Program info (7 bytes): c1 01 88 de 02 ef ff
     Descriptor tag c1 (193) (1 byte): 88
     Descriptor tag de (222) (2 bytes): ef ff
  Program streams:
    PID 0151 ( 337) -> Stream type 1b ( 27) H.264/14496-10 video (MPEG-4/AVC)
        ES info (3 bytes): 52 01 81
        Descriptor tag 52 ( 82) (1 byte): 81
    PID 0152 ( 338) -> Stream type 0f ( 15) 13818-7 Audio with ADTS transport syntax
        ES info (3 bytes): 52 01 83
        Descriptor tag 52 ( 82) (1 byte): 83
    PID 0154 ( 340) -> Stream type 06 (  6) H.222.0/13818-1 PES private data (maybe Dolby/AC-3 in DVB)
        ES info (8 bytes): 52 01 87 fd 03 00 12 ad
        Descriptor tag 52 ( 82) (1 byte): 87
        Descriptor tag fd (253) (3 bytes): 00 12 ad
    PID 0850 (2128) -> Stream type 0d ( 13) 13818-6 type D
        ES info (15 bytes): 52 01 80 fd 0a 00 0d 3f 2f 00 0c 00 00 ff bf
        Descriptor tag 52 ( 82) (1 byte): 80
        Descriptor tag fd (253) (10 bytes): 00 0d 3f 2f 00 0c 00 00 ff bf
    PID 0851 (2129) -> Stream type 0d ( 13) 13818-6 type D
        ES info (10 bytes): 52 01 8b fd 05 00 0d 1f ff bf
        Descriptor tag 52 ( 82) (1 byte): 8b
        Descriptor tag fd (253) (5 bytes): 00 0d 1f ff bf
    PID 085a (2138) -> Stream type 0d ( 13) 13818-6 type D
        ES info (3 bytes): 52 01 89
        Descriptor tag 52 ( 82) (1 byte): 89
    PID 085b (2139) -> Stream type 0d ( 13) 13818-6 type D
        ES info (3 bytes): 52 01 8a
        Descriptor tag 52 ( 82) (1 byte): 8a

Found 18 PAT packets and 2 PMT packets in 10000 TS packets

これでいうところの、0x0000 0x1fc8 と、0x0150 0x0151 0x0152 0x0154 0x0850 0x0851 0x085a 0x085bをtsselectに食わすと、サイズの小さいTSを出力できた。視聴確認はWindowsVLCなのだけど、抽出したTSもVLCで再生できた。

日本テレビテレビ朝日テレビ東京MXテレビ、どれも綺麗に再生できた(60秒ずつ)。おかしいのはフジテレビ。なんというか、「3歩進んで、2歩下がる」というか映像が、再生・少し巻き戻る・再生、という繰り返しになる。音声は、聞く限りは問題なし。朝10時ころのワイドショー、夜10時ころのドラマ、11時のバラエティーのすべてでフジテレビだけそんな状況。何かこつがあるのか?

。。。という課題はあるけど、まあTXとMXが9割を占めるはず(ぉぃ)なので、いいか。ノイタミナワンセグでみないことにして。

tsselectをいじるのはしんどそう。tsinfoをいじって、ワンセグ絡みのPIDを列挙させるようにして

$ tsselect src.ts oneseg.ts `tsinfo-oneseg src.ts`

とかできればいいのか?