録画サーバを作る Part3 Mirakurun-Server編

PT3 Linux

1.情報収集

Chinachu-γと同時期に出てきて、物理チューナー周りを引き受けてくれるMirakurun-Serverですが、あれこれググってみましたが、なんかちゃんとまとまっていないような感じでした。

2.インストール

公式サイト通りにすれば、とりあえずインストール出来るには出来ますが、ちょっと書き方が優しくないというか・・・・(この辺は作者のポリシーもあるでしょう)、初めての人にはちょっととっつきにくいのは否めないところでしょう。

3.インストールの実際

ここからは私が実際にやってみた手順を順をおって説明していきたいと思います。

最初にインストール要件として、nodeがインストールされている事が前提になりますので、もしまだならこの時に一緒に入れる必要があります。
また、自動起動を行うためにpm2のインストールも必要です。

# dnf -y install nodejs
# npm install pm2 -g

プログラムのインストールはこれだけ。
でも周辺のプログラムも一緒にインストールしましょう。

# npm install pm2 -g
# npm install mirakurun -g --unsafe --production
# npm install rivarun -g
# npm install arib-b25-stream-test -g --unsafe

でも、そんな簡単に終わるなら、わざわざ記事にしませんよね(苦笑)
そう。設定が本当に大変なんです・・・・・orz

4.設定の実際

さぁこれからが大変ですよ。
設定ファイルにはこの3種類がありますが、流れとしては以下の通りです。
server.ymlは基本デフォルトでOK。
channels.ymlは手でやると泣けるので後回しにします。
tunner.ymlは物理デバイスを記載する必要がありますので、チクチクやっていきましょう。

まず、一番大変なchannel.ymlですが、自分に負けないラボラトリーさんが作成されたスクリプトを利用させていただきました。

次に、server.ymlですが、このファイルはよほどのことがない限り触る必要はないでしょう。(デフォルトの待ち受けポートを変更したり、mirakrunを多段で構成するような時にはちょっと必要になるかも)

最後に、tunner.ymlの例をお示しします。
これはPT3が2枚の場合なので、他のデバイスの場合、デバイス名が違ったりしますが、大体は同じかと思います。
手元にあるもう一枚を入れようか悩み中・・・・・

# mirakrun config tuners

設定が終わったら、起動してみます。
statusがonlineになっていれば成功です。

# pm2 start mirakurun-server
# pm2 status
┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐
│ id │ name               │ mode     │ ↺    │ status    │ cpu      │ memory   │
├────┼────────────────────┼──────────┼──────┼───────────┼──────────┼──────────┤
│ 1  │ mirakurun-server   │ fork     │ 0    │ online    │ 1.3%     │ 468.9mb  │
└────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘
Module
┌────┬────────────────────┬──────────┬──────────┬──────────┐
│ id │ name               │ status   │ cpu      │ mem      │
├────┼────────────────────┼──────────┼──────────┼──────────┤
│ 0  │ pm2-logrotate      │ online   │ 0.1%     │ 92.3mb   │
└────┴────────────────────┴──────────┴──────────┴──────────┘

動作確認としては、とりあえずこんな感じでしょうか。
rivarunで実際に録画して、m2tsファイルが見れたら動作確認としては完了ですかね〜

$ curl -o - http://localhost:40772/api/version
{"current":"2.14.0","latest":"2.14.0"}

次はチャンネル情報がとれるかを確認します。
GR(地上波)だけでなく、BSやCSのチャンネル情報が取れていることを確認しましょう。

# rivarun --list | sed 's/},/},\n/g'
status: 200
headers: {"server":"Mirakurun/2.14.0","content-type":"application/json; charset=utf-8","date":"Mon, 13 Apr 2020 21:38:39 GMT","connection":"close","content-length":"13355"}
[{"type":"GR","channel":"16","name":"TOKYO MX","services":[{"id":3239123608,"serviceId":23608,"networkId":32391,"name":"TOKYO MX1"},
{"id":3239123609,"serviceId":23609,"networkId":32391,"name":"TOKYO MX1"},
{"id":3239123610,"serviceId":23610,"networkId":32391,"name":"TOKYO MX2"},
{"id":3239123992,"serviceId":23992,"networkId":32391,"name":"MXワンセグ1"},
{"id":3239123993,"serviceId":23993,"networkId":32391,"name":"MXワンセグ2"}]},
{"type":"GR","channel":"21","name":"フジテレビ","services":[{"id":3274001056,"serviceId":1056,"networkId":32740,"name":"フジテレビ"},

次に録画出来て視聴できるかを確認します。
生成されたファイルはローカルのPCで見てくださいね。
ここでは東京・NHK総合を10秒録画しています。

# rivarun --b25 --sid 1025 --ch GR/27 10 ./test.ts

最後に、私が現在運用中のtuner.ymlです。

- name: PT3-S1
  types:
    - BS
    - CS
  command: recpt1 --device /dev/pt3video0 --lnb 15 --strip <channel> - -
  decoder: arib-b25-stream-test
  isDisabled: false

- name: PT3-S2
  types:
    - BS
    - CS
  command: recpt1 --device /dev/pt3video1 --lnb 15 --strip <channel> - -
  decoder: arib-b25-stream-test
  isDisabled: false

- name: PT3-T1
  types:
    - GR
  command: recpt1 --device /dev/pt3video2 --strip <channel> - -
  decoder: arib-b25-stream-test
  isDisabled: false

- name: PT3-T2
  types:
    - GR
  command: recpt1 --device /dev/pt3video3 --strip <channel> - -
  decoder: arib-b25-stream-test
  isDisabled: false

- name: PT3-S3
  types:
    - BS
    - CS
  command: recpt1 --device /dev/pt3video4 --lnb 15 --strip <channel> - -
  decoder: arib-b25-stream-test
  isDisabled: false

- name: PT3-S4
  types:
    - BS
    - CS
  command: recpt1 --device /dev/pt3video5 --lnb 15 --strip <channel> - -
  decoder: arib-b25-stream-test
  isDisabled: false

- name: PT3-T3
  types:
    - GR
  command: recpt1 --device /dev/pt3video6 --strip <channel> - -
  decoder: arib-b25-stream-test
  isDisabled: false

- name: PT3-T4
  types:
    - GR
  command: recpt1 --device /dev/pt3video7 --strip <channel> - -
  decoder: arib-b25-stream-test
  isDisabled: false

最後に、tuner.ymlも載せてみます。これ東京なので丸コピーするとGR見れなくなります。GRだけはコマンドでやった方が良いかもしれません。

# cat channels.yml
- name: TOKYO MX
  type: GR
  channel: '16'
- name: フジテレビ
  type: GR
  channel: '21'
- name: TBS
  type: GR
  channel: '22'
- name: テレビ東京
  type: GR
  channel: '23'
- name: テレビ朝日
  type: GR
  channel: '24'
- name: 日テレ
  type: GR
  channel: '25'
- name: NHKEテレ
  type: GR
  channel: '26'
- name: NHK総合
  type: GR
  channel: '27'
- name: テレ玉
  type: GR
  channel: '32'
- name: BS朝日3
  type: BS
  channel: BS1_0
  serviceId: 153
- name: BS朝日1
  type: BS
  channel: BS1_0
  serviceId: 151
- name: BS朝日2
  type: BS
  channel: BS1_0
  serviceId: 152
- name: BS-TBS
  type: BS
  channel: BS1_1
  serviceId: 162
- name: BS-TBS
  type: BS
  channel: BS1_1
  serviceId: 161
- name: BS-TBS
  type: BS
  channel: BS1_1
  serviceId: 163
- name: BSテレ東3
  type: BS
  channel: BS1_2
  serviceId: 173
- name: BSテレ東2
  type: BS
  channel: BS1_2
  serviceId: 172
- name: BSテレ東
  type: BS
  channel: BS1_2
  serviceId: 171
- name: WOWOWプライム
  type: BS
  channel: BS3_0
  serviceId: 191
- name: NHKBSプレミアム
  type: BS
  channel: BS3_1
  serviceId: 104
- name: NHKBSプレミアム
  type: BS
  channel: BS3_1
  serviceId: 103
- name: ディズニーch
  type: BS
  channel: BS3_2
  serviceId: 256
- name: WOWOWライブ
  type: BS
  channel: BS5_0
  serviceId: 192
- name: WOWOWシネマ
  type: BS
  channel: BS5_1
  serviceId: 193
- name: BS11イレブン
  type: BS
  channel: BS9_0
  serviceId: 211
- name: スターチャンネル1
  type: BS
  channel: BS9_1
  serviceId: 200
- name: BS12トゥエルビ
  type: BS
  channel: BS9_2
  serviceId: 222
- name: FOXスポーツエンタ
  type: BS
  channel: BS11_0
  serviceId: 238
- name: BSスカパー!
  type: BS
  channel: BS11_1
  serviceId: 241
- name: 放送大学on
  type: BS
  channel: BS11_2
  serviceId: 232
- name: 放送大学ex
  type: BS
  channel: BS11_2
  serviceId: 231
- name: 放送大学ラジオ
  type: BS
  channel: BS11_2
  serviceId: 531
- name: BS日テレ
  type: BS
  channel: BS13_0
  serviceId: 143
- name: BS日テレ
  type: BS
  channel: BS13_0
  serviceId: 142
- name: BS日テレ
  type: BS
  channel: BS13_0
  serviceId: 141
- name: BSフジ・181
  type: BS
  channel: BS13_1
  serviceId: 181
- name: BSフジ・183
  type: BS
  channel: BS13_1
  serviceId: 183
- name: BSフジ・182
  type: BS
  channel: BS13_1
  serviceId: 182
- name: BSアニマックス
  type: BS
  channel: BS13_2
  serviceId: 236
- name: NHKBS1
  type: BS
  channel: BS15_0
  serviceId: 101
- name: NHKBS1
  type: BS
  channel: BS15_0
  serviceId: 102
- name: スターチャンネル3
  type: BS
  channel: BS15_1
  serviceId: 202
- name: スターチャンネル2
  type: BS
  channel: BS15_1
  serviceId: 201
- name: グリーンチャンネル
  type: BS
  channel: BS19_0
  serviceId: 234
- name: J SPORTS 1
  type: BS
  channel: BS19_1
  serviceId: 242
- name: J SPORTS 2
  type: BS
  channel: BS19_2
  serviceId: 243
- name: シネフィルWOWOW
  type: BS
  channel: BS21_0
  serviceId: 252
- name: J SPORTS 3
  type: BS
  channel: BS21_1
  serviceId: 244
- name: J SPORTS 4
  type: BS
  channel: BS21_2
  serviceId: 245
- name: BS釣りビジョン
  type: BS
  channel: BS23_0
  serviceId: 251
- name: 日本映画専門ch
  type: BS
  channel: BS23_1
  serviceId: 255
- name: ディーライフ
  type: BS
  channel: BS23_2
  serviceId: 258
- name: TBSチャンネル1
  type: CS
  channel: CS2
  serviceId: 296
- name: テレ朝チャンネル1
  type: CS
  channel: CS2
  serviceId: 298
- name: テレ朝チャンネル2
  type: CS
  channel: CS2
  serviceId: 299
- name: ディズニージュニア
  type: CS
  channel: CS2
  serviceId: 339
- name: エンタメ〜テレ
  type: CS
  channel: CS4
  serviceId: 301
- name: スカイA
  type: CS
  channel: CS4
  serviceId: 250
- name: MTV
  type: CS
  channel: CS4
  serviceId: 323
- name: 時代劇専門ch
  type: CS
  channel: CS4
  serviceId: 292
- name: 囲碁・将棋チャンネル
  type: CS
  channel: CS6
  serviceId: 363
- name: ディスカバリー
  type: CS
  channel: CS6
  serviceId: 340
- name: アニマルプラネット
  type: CS
  channel: CS6
  serviceId: 341
- name: カートゥーン
  type: CS
  channel: CS6
  serviceId: 331
- name: 歌謡ポップス
  type: CS
  channel: CS6
  serviceId: 329
- name: ミュージック・エア
  type: CS
  channel: CS6
  serviceId: 324
- name: CNNj
  type: CS
  channel: CS6
  serviceId: 354
- name: ホームドラマCH
  type: CS
  channel: CS6
  serviceId: 294
- name: 日テレNEWS24
  type: CS
  channel: CS8
  serviceId: 349
- name: 東映チャンネル
  type: CS
  channel: CS8
  serviceId: 218
- name: ショップチャンネル
  type: CS
  channel: CS8
  serviceId: 55
- name: Mnet
  type: CS
  channel: CS8
  serviceId: 318
- name: 衛星劇場
  type: CS
  channel: CS10
  serviceId: 219
- name: スポーツライブ+
  type: CS
  channel: CS10
  serviceId: 800
- name: KBS World
  type: CS
  channel: CS10
  serviceId: 317
- name: スカチャン1
  type: CS
  channel: CS10
  serviceId: 801
- name: GAORA
  type: CS
  channel: CS12
  serviceId: 254
- name: ナショジオ
  type: CS
  channel: CS12
  serviceId: 343
- name: エムオン!
  type: CS
  channel: CS12
  serviceId: 325
- name: キッズステーション
  type: CS
  channel: CS12
  serviceId: 330
- name: ファミリー劇場
  type: CS
  channel: CS14
  serviceId: 293
- name: スーパー!ドラマTV
  type: CS
  channel: CS14
  serviceId: 310
- name: ヒストリーチャンネル
  type: CS
  channel: CS14
  serviceId: 342
- name: ザ・シネマ
  type: CS
  channel: CS14
  serviceId: 227
- name: AT−X
  type: CS
  channel: CS16
  serviceId: 333
- name: AXN 海外ドラマ
  type: CS
  channel: CS16
  serviceId: 311
- name: AXNミステリー
  type: CS
  channel: CS16
  serviceId: 316
- name: スペシャプラス
  type: CS
  channel: CS16
  serviceId: 321
- name: BBCワールド
  type: CS
  channel: CS16
  serviceId: 353
- name: SKY STAGE
  type: CS
  channel: CS16
  serviceId: 290
- name: 銀河◆歴ドラ・サスペ
  type: CS
  channel: CS18
  serviceId: 305
- name: ムービープラス
  type: CS
  channel: CS18
  serviceId: 240
- name: 女性ch/LaLa
  type: CS
  channel: CS18
  serviceId: 314
- name: ゴルフネットワーク
  type: CS
  channel: CS18
  serviceId: 262
- name: フジテレビONE
  type: CS
  channel: CS20
  serviceId: 307
- name: フジテレビTWO
  type: CS
  channel: CS20
  serviceId: 308
- name: フジテレビNEXT
  type: CS
  channel: CS20
  serviceId: 309
- name: スペースシャワーTV
  type: CS
  channel: CS20
  serviceId: 322
- name: TBSチャンネル2
  type: CS
  channel: CS22
  serviceId: 297
- name: QVC
  type: CS
  channel: CS22
  serviceId: 161
- name: FOX
  type: CS
  channel: CS22
  serviceId: 312
- name: TBS NEWS
  type: CS
  channel: CS22
  serviceId: 351
- name: 映画・chNECO
  type: CS
  channel: CS24
  serviceId: 223
- name: MONDO TV
  type: CS
  channel: CS24
  serviceId: 295
- name: 日テレプラス
  type: CS
  channel: CS24
  serviceId: 300
- name: 日テレジータス
  type: CS
  channel: CS24
  serviceId: 257
- name: AT-X HD
  type: SKY
  channel: ATXHD
  serviceId: 33435
  satelite: JCSAT3A
  isDisabled: true
- name: AXN HD
  type: SKY
  channel: AXNHD
  serviceId: 33418
  satelite: JCSAT4A
  isDisabled: true
- name: BS SPTV
  type: SKY
  channel: CH585
  serviceId: 33353
  satelite: JCSAT3A
  isDisabled: true

コメント

タイトルとURLをコピーしました