TV-Tuner-Serverの作成 その2

Mirakurunのインストールを行います。

Node.jsのインストール

$ curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
$ sudo apt-get install nodejs
$ node -v
v10.18.0

Mirakurunのインストール

インストール

Mirakurunと必要なパッケージをインストールします。

$ sudo npm install pm2 -g
sudo npm install mirakurun -g --production
sudo mirakurun init # to install as service
sudo mirakurun restart # when updated
$ sudo npm install rivarun -g
$ sudo npm install arib-b25-stream-test -g --unsafe
$ sudo pm2 status
┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐
│ id │ name               │ mode     │ ↺   │ status    │ cpu      │ memory   │
├────┼────────────────────┼──────────┼──────┼───────────┼──────────┼──────────┤
│ 1  │ mirakurun-server   │ fork     │ 1    │ online    │ 16.4%    │ 535.3mb  │
└────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘

設定

サーバ機能設定

$ sudo EDITOR=nano mirakurun config server

下記が設定内容です。デフォルトのままで良いと思います。

# logLevel: <number>
logLevel: 2

# path: <string>
path: /var/run/mirakurun.sock

# port: <number>
# You can change this if port conflicted.
# Don't expose this port on the internet, not even with NAPT.
# Use this in LAN or VPN.
# `~` to disable TCP port listening.
port: 40772

maxBufferBytesBeforeReady: 3145728 # integer (bytes)
eventEndTimeout: 1000 # integer (ms)

highWaterMark: 134217728

チューナー設定

$ sudo EDITOR=nano mirakurun config tuners
- name: PT3-S1
types:
- BS
- CS
command: recpt1 --device /dev/pt3video0 --lnb 15 <channel> - -
decoder: arib-b25-stream-test
isDisabled: false

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

- name: PX4-S1
types:
- BS
- CS
command: recpt1_px4 --device /dev/px4video0 --lnb 15 <channel> - -
decoder: arib-b25-stream-test
isDisabled: false

- name: PX4-S2
types:
- BS
- CS
command: recpt1_px4 --device /dev/px4video1 --lnb 15 <channel> - -
decoder: arib-b25-stream-test
isDisabled: false

- name: PX4-S3
types:
- BS
- CS
command: recpt1_px4 --device /dev/px4video4 --lnb 15 <channel> - -
decoder: arib-b25-stream-test
isDisabled: false

- name: PX4-S4
types:
- BS
- CS
command: recpt1_px4 --device /dev/px4video5 --lnb 15 <channel> - -
decoder: arib-b25-stream-test
isDisabled: false

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

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

- name: PX4-T1
types:
- GR
command: recpt1_px4 --device /dev/px4video2 <channel> - -
decoder: arib-b25-stream-test
isDisabled: false

- name: PX4-T2
types:
- GR
command: recpt1_px4 --device /dev/px4video3 <channel> - -
decoder: arib-b25-stream-test
isDisabled: false

- name: PX4-T3
types:
- GR
command: recpt1_px4 --device /dev/px4video6 <channel> - -
decoder: arib-b25-stream-test
isDisabled: false

- name: PX4-T4
types:
- GR
command: recpt1_px4 --device /dev/px4video7 <channel> - -
decoder: arib-b25-stream-test
isDisabled: false

設定が全て完了したらMirakurunを再起動します。

$ sudo mirakurun restart

チャンネル設定

Mirakurunは、下記コマンドで地デジのみチャンネルスキャンできるようになっています。

$ curl -X PUT "http://localhost:40772/api/config/channels/scan"

地デジのみのため、BS・CSに対応している「自分に負けないラボラトリー」さんの「Mirakurunのチャンネル設定更新スクリプト」を使用してチャンネルスキャンを行います。

epgdumpインストール

$ git clone https://github.com/stz2012/epgdump
$ cd epgdump
$ make
$ sudo make install

チャンネル設定更新スクリプトのインストール

$ wget https://www.jifu-labo.net/files/mcconfig.pl.gz
$ gzip -d mcconfig.pl.gz
$ sudo install -m 755 mcconfig.pl /usr/local/bin/
$ sudo apt-get -y install libxml-libxml-perl libyaml-perl

スクリプトの実行

$ sudo mirakurun stop
$ sudo mcconfig.pl -f

スクリプトの実行が完了したら、最後に設定内容を確認し、Mirakurunを起動して終了です。

$ sudo EDITOR=nano mirakurun config channels
$ sudo mirakurun start

Mirakurunのチャンネル情報が更新されます。チャンネル設定した局の情報が受信できているかをrivarunコマンドで確認します。

$ rivarun --list | sed 's/},/},\n/g'

受信が出来ていない場合、このrivarunコマンドの応答が返って来ません。更にチャンネル情報の更新が完了しているか確認します。

$ rivarun --list | sed 's/},/},\n/g' | grep -v serviceId

ログローテーション設定

$ sudo pm2 install pm2-logrotate<

設定ファイルを作成

$ sudo nano /etc/logrotate.d/mirakurun
/usr/local/var/log/mirakurun.stdout.log
/usr/local/var/log/mirakurun.stderr.log
/{
daily
compress
rotate 7
missingok
notifempty
}

毎日ログを圧縮して1週間分保存する設定です。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です