Chinachu GammaでIPTV

2018年7月8日DTV・ffmpegDTV,Chinachu

 

chinachu-gamma
chinachu gammaでもIPTVがしたい。具体的にはKodiのIPTV Simple Clientを使いたい。なぜChinachu PVRを使わないかと言えば、僕はApple TVのMrMCを使っているからだ。ということで、無理矢理Chinachu GammaでもIPTVを使う方法をご紹介。

Chinachu GammaではIPTV API Addonが使えない

以前にこんな記事を書いた。これは、Chinachu Beta時代には使えたが、Chinachu Gammaを導入すると使えなくなってしまう。

Chinachu Gammaで利用できなくなった理由は、大きく分けて二点だ。

Mirakurunへの変更に伴いストリーミング再生の方法が変わった

従来はChinachu IPTV API Addonが提供するm2tsファイルを再生することでストリーミングを行っていたが、Mirakurunに移行したことによってこれらの機能を使うことが出来なくなってしまった。
しかし、Mirakurunはhttp・RestAPI形式でアクセスすることが出来る。今回はMirakurunを直接叩くことで、IPTVライクな使用が出来るように環境を整えることとする。

チャンネルIDの採番方式が変わった

正直これはどうでもいいといえばどうでもいいのだが。
基本的に、IPTV系のソフトウェアは、チャンネルリストが格納されているm3u8ファイルとepgファイルが書き込まれているxmlファイルを必要とし、両者はchannel id(チャンネルID)によって紐付けされる。epgでは"channel"として、m3u8では"tvg-id"として書き込まれている。
今回、Chnachu gammaでは、これまでの「GR_1056」等、「[GR or BS or CS] + サービスID」の形式から、「f0cp」などChinachuが独自に採番する形式に変更となった。そのため、使用するソフトウェアによってはEPGがきちんと読み込まれない。
(なお、XBMC/KODI/MrMCでは、チャンネルIDのほかにチャンネル名称によっても関連づけがされるため、こちらが正しければEPG情報を正しく表示することが出来る)

IPTV API Addonで動作する部分

epgをxml形式で吐き出してくれる機能は、Chinachu Gammaになっても健在だ。
今回はm3u8を手動で書き換え、IPTV API Addonが出力するxmlファイルを用いることで、引き続きChinachu GammaでもIPTVを使用出来る環境を整える。

Mirakurunを使用したストリームの取り出し

Mirakurunは下記の形式でストリームを取り出すことが出来る。

http://<Mirakurunのアドレス>:<ポート>/api/channels/<チャンネル種別>/<チャンネル番号>/services/<サービスID>/stream

MirakurunのChannelsに

- name:テレビ朝日  type:GR  channel:'24'

と記載をしているのであれば

http: //<Mirakurunのアドレス>:<ポート>/api/channels/GR/24/stream

で取り出すことが出来る(厳密には、地上波もサービスIDが複数存在しているため、

http: //localhost:0000/api/channels/GR/24/services/1064/stream

のようにサービスIDを指定してあげたほうが良いが)。

簡単に言ってしまえば、channels.m3u8のURL部分を全てMirakurunの形式に変更してしまえば良い。

Chinachuの採番するチャンネルに合わせる

さらに、channels.m3u8の"tvg-id"を、Chinachuが採番するチャンネルに合わせてあげる必要がある。これは、上記の「IPTV API Addon」が出力するepg.xmlから、

<channelid="1i50mps"tp="27"><display-namelang="ja_JP">NHK総合1・東京</display-name><service_id>1024</service_id>

と記述されている部分を探し(当然チャンネル分存在する)、「channel id=" “」の部分を使用すれば良い。例えば、上記であればli50mpsがチャンネルIDだ。

これらを行うと、channels.m3u8は次のような設定となる。

EXTM3U
#EXTINF:-1 tvg-id="1i597ds",フジテレビ
http: //localhost:0000/api/channels/GR/21/services/1056/stream#EXTINF:-1 tvg-id="1i5727s",TBS1
http: //localhost:0000/api/channels/GR/22/services/1048/stream#EXTINF:-1 tvg-id="1i5dhps",テレビ東京1
http: //localhost:0000/api/channels/GR/23/services/1072/stream#EXTINF:-1 tvg-id="1i5bcjs",テレビ朝日
http: //localhost:0000/api/channels/GR/24/services/1064/stream#EXTINF:-1 tvg-id="1i54x1s",日テレ1
http: //localhost:0000/api/channels/GR/25/services/1040/stream#EXTINF:-1 tvg-id="1i52rvs",NHKEテレ1東京
http: //localhost:0000/api/channels/GR/26/services/1032/stream#EXTINF:-1 tvg-id="1i52ru",NHKEテレ3東京
http: //localhost:0000/api/channels/GR/26/services/1034/stream#EXTINF:-1 tvg-id="1i50mpst",NHK総合1・東京
http: //localhost:0000/api/channels/GR/27/services/1024/stream#EXTINF:-1 tvg-id="1i50mpt",NHK総合2・東京
http: //localhost:0000/api/channels/GR/27/services/1025/stream#EXTINF:-1 tvg-id="8kpx",NHKBS1
http: //localhost:0000/api/channels/BS/BS15_0/services/101/stream#EXTINF:-1 tvg-id="8kpz",NHKBSプレミアム
http: //localhost:0000/api/channels/BS/BS15_1/services/103/stream#EXTINF:-1 tvg-id="8kr1",BS日テレ
http: //localhost:0000/api/channels/BS/BS13_0/services/141/stream#EXTINF:-1 tvg-id="8krb",BS朝日1
http: //localhost:0000/api/channels/BS/BS01_0/services/151/stream#EXTINF:-1 tvg-id="8krl",BS-TBS
http: //localhost:0000/api/channels/BS/BS01_1/services/161/stream#EXTINF:-1 tvg-id="8krv",BSジャパン
http: //localhost:0000/api/channels/BS/BS03_1/services/171/stream#EXTINF:-1 tvg-id="8ks5",BSフジ・181
http: //localhost:0000/api/channels/BS/BS13_1/services/181/stream#EXTINF:-1 tvg-id="8ksf",WOWOWプライム
http: //localhost:0000/api/channels/BS/BS03_0/services/191/stream#EXTINF:-1 tvg-id="8ksg",WOWOWライブ
http: //localhost:0000/api/channels/BS/BS05_0/services/192/stream#EXTINF:-1 tvg-id="8ksh",WOWOWシネマ
http: //localhost:0000/api/channels/BS/BS05_1/services/193/stream#EXTINF:-1 tvg-id="8kso",スターチャンネル1
http: //localhost:0000/api/channels/BS/BS09_1/services/200/stream#EXTINF:-1 tvg-id="8ksp",スターチャンネル2
http: //localhost:0000/api/channels/BS/BS07_0/services/201/stream#EXTINF:-1 tvg-id="8ksq",スターチャンネル3
http: //localhost:0000/api/channels/BS/BS07_0/services/202/stream#EXTINF:-1 tvg-id="8ksz",BS11イレブン
http: //localhost:0000/api/channels/BS/BS09_0/services/211/stream#EXTINF:-1 tvg-id="8kta",BS12トゥエルビ
http: //localhost:0000/api/channels/BS/BS09_2/services/222/stream#EXTINF:-1 tvg-id="8ktj",放送大学BS1
http: //localhost:0000/api/channels/BS/BS11_2/services/231/stream#EXTINF:-1 tvg-id="8ktk",放送大学BS2
http: //localhost:0000/api/channels/BS/BS11_2/services/232/stream#EXTINF:-1 tvg-id="8ktl",放送大学BS3
http: //localhost:0000/api/channels/BS/BS11_2/services/233/stream#EXTINF:-1 tvg-id="8ktm",グリーンチャンネル
http: //localhost:0000/api/channels/BS/BS19_0/services/234/stream#EXTINF:-1 tvg-id="8kto",BSアニマックス
http: //localhost:0000/api/channels/BS/BS07_1/services/236/stream#EXTINF:-1 tvg-id="8ktq",FOXスポーツエンタ
http: //localhost:0000/api/channels/BS/BS11_0/services/238/stream#EXTINF:-1 tvg-id="8ktt",BSスカパー!
http: //localhost:0000/api/channels/BS/BS11_1/services/241/stream#EXTINF:-1 tvg-id="8ktu",J SPORTS 1
http: //localhost:0000/api/channels/BS/BS19_1/services/242/stream#EXTINF:-1 tvg-id="8ktv",J SPORTS 2
http: //localhost:0000/api/channels/BS/BS19_2/services/243/stream#EXTINF:-1 tvg-id="8ktw",J SPORTS 3
http: //localhost:0000/api/channels/BS/BS21_1/services/244/stream#EXTINF:-1 tvg-id="8ktx",J SPORTS 4
http: //localhost:0000/api/channels/BS/BS21_2/services/245/stream#EXTINF:-1 tvg-id="8ku3",BS釣りビジョン
http: //localhost:0000/api/channels/BS/BS23_0/services/251/stream#EXTINF:-1 tvg-id="8ku4",イマジカBS・映画
http: //localhost:0000/api/channels/BS/BS21_0/services/252/stream#EXTINF:-1 tvg-id="8ku7",BS日本映画専門ch
http: //localhost:0000/api/channels/BS/BS23_1/services/255/stream#EXTINF:-1 tvg-id="8ku8",ディズニーチャンネル
http: //localhost:0000/api/channels/BS/BS07_2/services/256/stream#EXTINF:-1 tvg-id="8kua",ディーライフ
http: //localhost:0000/api/channels/BS/BS23_2/services/258/stream#EXTINF:-1 tvg-id="cv6z",テレ朝チャンネル2
http: //localhost:0000/api/channels/CS/CS2/services/299/stream#EXTINF:-1 tvg-id="cv6y",テレ朝チャンネル1
http: //localhost:0000/api/channels/CS/CS2/services/298/stream#EXTINF:-1 tvg-id="cv6w",TBSチャンネル1
http: //localhost:0000/api/channels/CS/CS2/services/296/stream#EXTINF:-1 tvg-id="f0ar",ザ・シネマ
http: //localhost:0000/api/channels/CS/CS4/services/227/stream#EXTINF:-1 tvg-id="f0an",映画・chNECO
http: //localhost:0000/api/channels/CS/CS4/services/223/stream#EXTINF:-1 tvg-id="f0be",スカイA
http: //localhost:0000/api/channels/CS/CS4/services/250/stream#EXTINF:-1 tvg-id="f0dy",ヒストリーチャンネル
http: //localhost:0000/api/channels/CS/CS4/services/342/stream#EXTINF:-1 tvg-id="f0ej",囲碁・将棋チャンネル
http: //localhost:0000/api/channels/CS/CS4/services/363/stream#EXTINF:-1 tvg-id="f0cm",ホームドラマCH
http: //localhost:0000/api/channels/CS/CS6/services/294/stream#EXTINF:-1 tvg-id="f0dl",歌謡ポップス
http: //localhost:0000/api/channels/CS/CS6/services/329/stream#EXTINF:-1 tvg-id="f0df",MTV HD
http: //localhost:0000/api/channels/CS/CS6/services/323/stream#EXTINF:-1 tvg-id="f0ea",CNNj
http: //localhost:0000/api/channels/CS/CS6/services/354/stream#EXTINF:-1 tvg-id="f0dw",ディスカバリー
http: //localhost:0000/api/channels/CS/CS6/services/340/stream#EXTINF:-1 tvg-id="f0dx",アニマルプラネット
http: //localhost:0000/api/channels/CS/CS6/services/341/stream#EXTINF:-1 tvg-id="cv8d",日テレNEWS24
http: //localhost:0000/api/channels/CS/CS8/services/349/stream#EXTINF:-1 tvg-id="cv4q",東映チャンネル
http: //localhost:0000/api/channels/CS/CS8/services/218/stream#EXTINF:-1 tvg-id="cv4r",衛星劇場
http: //localhost:0000/api/channels/CS/CS8/services/219/stream#EXTINF:-1 tvg-id="cv7q",ミュージック・エア
http: //localhost:0000/api/channels/CS/CS8/services/326/stream#EXTINF:-1 tvg-id="cv83",ディズニージュニア
http: //localhost:0000/api/channels/CS/CS8/services/339/stream#EXTINF:-1 tvg-id="cvkw",スカチャン0
http: //localhost:0000/api/channels/CS/CS10/services/800/stream#EXTINF:-1 tvg-id="cvkx",スカチャン1
http: //localhost:0000/api/channels/CS/CS10/services/801/stream#EXTINF:-1 tvg-id="cvky",スカチャン2
http: //localhost:0000/api/channels/CS/CS10/services/802/stream#EXTINF:-1 tvg-id="cvl1",スカチャン3
http: //localhost:0000/api/channels/CS/CS10/services/805/stream#EXTINF:-1 tvg-id="f0bi",GAORA
http: //localhost:0000/api/channels/CS/CS12/services/254/stream#EXTINF:-1 tvg-id="f0dh",エムオン!HD
http: //localhost:0000/api/channels/CS/CS12/services/325/stream#EXTINF:-1 tvg-id="f0dm",キッズステーション
http: //localhost:0000/api/channels/CS/CS12/services/330/stream#EXTINF:-1 tvg-id="f0cl",ファミリー劇場HD
http: //localhost:0000/api/channels/CS/CS14/services/293/stream#EXTINF:-1 tvg-id="f0d2",スーパー!ドラマHD
http: //localhost:0000/api/channels/CS/CS14/services/310/stream#EXTINF:-1 tvg-id="f0ck",時代劇専門chHD
http: //localhost:0000/api/channels/CS/CS14/services/292/stream#EXTINF:-1 tvg-id="f0ci",SKY STAGE
http: //localhost:0000/api/channels/CS/CS16/services/290/stream#EXTINF:-1 tvg-id="f0cx",銀河◆歴ドラ・サスペ
http: //localhost:0000/api/channels/CS/CS16/services/305/stream#EXTINF:-1 tvg-id="f0dp",AT−X
http: //localhost:0000/api/channels/CS/CS16/services/333/stream#EXTINF:-1 tvg-id="f0d3",AXN 海外ドラマ
http: //localhost:0000/api/channels/CS/CS16/services/311/stream#EXTINF:-1 tvg-id="f0dz",ナショジオチャンネル
http: //localhost:0000/api/channels/CS/CS16/services/343/stream#EXTINF:-1 tvg-id="f0e9",BBCワールド
http: //localhost:0000/api/channels/CS/CS16/services/353/stream#EXTINF:-1 tvg-id="f0b4",ムービープラスHD
http: //localhost:0000/api/channels/CS/CS18/services/240/stream#EXTINF:-1 tvg-id="f0bq",ゴルフネットHD
http: //localhost:0000/api/channels/CS/CS18/services/262/stream#EXTINF:-1 tvg-id="f0d6",女性ch/LaLa
http: //localhost:0000/api/channels/CS/CS18/services/324/stream#EXTINF:-1 tvg-id="f0cz",フジテレビONE
http: //localhost:0000/api/channels/CS/CS20/services/307/stream#EXTINF:-1 tvg-id="f0d0",フジテレビTWO
http: //localhost:0000/api/channels/CS/CS20/services/308/stream#EXTINF:-1 tvg-id="f0d1",フジテレビNEXT
http: //localhost:0000/api/channels/CS/CS20/services/309/stream#EXTINF:-1 tvg-id="f0cp",TBSチャンネル2
http: //localhost:0000/api/channels/CS/CS22/services/297/stream#EXTINF:-1 tvg-id="f0e7",TBSニュースバード
http: //localhost:0000/api/channels/CS/CS22/services/351/stream#EXTINF:-1 tvg-id="f0d4",FOX
http: //localhost:0000/api/channels/CS/CS22/services/312/stream#EXTINF:-1 tvg-id="f0de",スペースシャワーTV
http: //localhost:0000/api/channels/CS/CS22/services/322/stream#EXTINF:-1 tvg-id="f0dn",カートゥーン
http: //localhost:0000/api/channels/CS/CS22/services/331/stream#EXTINF:-1 tvg-id="f0bl",日テレジータス
http: //localhost:0000/api/channels/CS/CS24/services/257stream#EXTINF:-1 tvg-id="f0cs",日テレプラス
http: //localhost:0000/api/channels/CS/CS24/services/300/stream#EXTINF:-1 tvg-id="f0dd",スペシャプラス
http: //localhost:0000/api/channels/CS/CS24/services/321stream#EXTINF:-1 tvg-id="f0cn",MONDO TV
http: //localhost:0000/api/channels/CS/CS24/services/295/stream#EXTINF:-1 tvg-id="f0d8",AXNミステリー
http: //localhost:0000/api/channels/CS/CS24/services/316/stream

このchannels.m3u8と、IPTV Addonが出力するepg.xmlを使用すれば、これまでと同じようにIPTV系のソフトウェアで視聴することが可能だ。ひとまず、AppleTVに入れたMrMCのIPTV Simple Clientでは動作した。

ということで。

Posted by webnetforce