LoginSignup
4
5

More than 3 years have passed since last update.

Raspberry Piを地デジ 2番組同時録画にする

Posted at

年末年始特番録画のために、ラズパイを使ったダブルチューナーの自分環境のインストールメモです。

スクリーンショット 2019-12-28 8.53.56.png

EPGstationセットアップ

  • Raspberry Pi 4 Model B 4GB
  • PLEX USB接続ドングル型地上デジタルTVチューナー PX-S1UD V2.0 x 2
  • SCM ICカードリーダー/ライター B-CAS・住基カード対応 SCR3310/v2.0
  • Rasbpian Buster Lite 2019-09-26版
  • microSD 8GB
  • 外付けUSB接続HDD 2TB

raspi-configでタイムゾーン設定

$ sudo raspi-config
# 4 Localisation Options -> I2 Change Timezone -> Asia -> Tokyoを選択

マウントポイントを作成

sudo mkdir /mnt/hdd1

ブロックデバイスの情報を表示する

$ sudo blkid /dev/sda1
/dev/sda1: UUID="a9b46e7d-ce76-4690-8c1b-31a622c48095" TYPE="ext4" PARTUUID="69999b62-86a9-4a7a-b6a7-83356ef2b1ab"
  • UUIDはHDD個体番号で異なる。

バックアップする

cd /etc
sudo cp fstab fstab.bak

fstabを編集しマウント設定を追加

$ sudo nano fstab
# デバイス名 マウントポイント ファイルシステム オプション dump指定 fsck指定
UUID=a9b46e7d-ce76-4690-8c1b-31a622c48095 /mnt/hdd1 ext4 nofail 0 0

再起動

sudo reboot

カードリーダー関連のインストール

$ sudo apt update
$ sudo apt -y install pcscd libpcsclite-dev pcsc-tools
$ pcsc_scan
Japanese Chijou Digital B-CAS Card (pay TV)
表示が出たら Ctrl + C で終了

チューナードンクル(PX-S1UD)のファームインストール

$ wget http://plex-net.co.jp/plex/px-s1ud/PX-S1UD_driver_Ver.1.0.1.zip
$ unzip PX-S1UD_driver_Ver.1.0.1.zip
$ sudo cp PX-S1UD_driver_Ver.1.0.1/x64/amd64/isdbt_rio.inp /lib/firmware/

Node.jsのインストール

$ curl -sL http://deb.nodesource.com/setup_8.x | sudo bash -
$ sudo apt install -y nodejs
$ node -v
v10.15.2

Node.js 8.9.4へバージョンダウン

$ sudo apt -y install npm
$ sudo npm install -g n
$ sudo n 8.9.4

nodeのpath設定

$ nano ~/.profile
pi@raspberrypi:~ $ source ~/.profile
pi@raspberrypi:~ $ node -v
v8.9.4

pm2のインストール

$ sudo npm install pm2 -g

Mirakurunのインストール

$ sudo npm install mirakurun -g --unsafe --production

dvb-toolsのインストール

$ sudo apt install -y dvb-tools

日本用周波数設定

$ sudo apt install -y git
$ cd /usr/local
$ sudo git clone https://github.com/Chinachu/dvbconf-for-isdb.git
$ cd ~

チューナーの設定

$ sudo npm install arib-b25-stream-test -g --unsafe
$ sudo nano /usr/local/etc/mirakurun/tuners.yml

- name: PX-S1UD #1
  types:
    - GR
  command: dvbv5-zap -a 0 -c /usr/local/dvbconf-for-isdb/conf/dvbv5_channels_isdbt.conf -r -P <channel>
  dvbDevicePath: /dev/dvb/adapter0/dvr0
  decoder: arib-b25-stream-test
  isDisabled: false

- name: PX-S1UD #2
  types:
    - GR
  command: dvbv5-zap -a 1 -c /usr/local/dvbconf-for-isdb/conf/dvbv5_channels_isdbt.conf -r -P <channel>
  dvbDevicePath: /dev/dvb/adapter1/dvr0
  decoder: arib-b25-stream-test
  isDisabled: false

mirakurunの再起動

$ sudo mirakurun restart

チャンネルスキャンは10分ほどかかり、Mirakurunの再起動

$ curl -X PUT "http://localhost:40772/api/config/channels/scan"
channel scanning... (type: "GR")

channel: "13" ...
-> no signal. [Error: stream has closed before get network] 
省略

$ sudo mirakurun restart

sudo mirakurun log serverにて、エラーログを確認する。

SQLite3とFFmpegの導入

$ sudo apt install -y sqlite3
$ sudo apt install -y ffmpeg

EPGStationの導入

$ git clone https://github.com/l3tnun/EPGStation.git
$ cd EPGStation
$ sudo npm i npm@latest -g
$ sudo npm install --unsafe-perm=true --allow-root
$ sudo npm run build

設定ファイルのコピー

$ sudo cp config/config.sample.json config/config.json
$ sudo cp config/operatorLogConfig.sample.json config/operatorLogConfig.json
$ sudo cp config/serviceLogConfig.sample.json config/serviceLogConfig.json

config.jsonの編集

$ sudo nano config/config.json

ffmpeg/ffprobeの場所書き換え

$ sudo nano config/config.json

"ffmpeg": "/usr/bin/ffmpeg",
"ffprobe": "/usr/bin/ffprobe",
"recorded": "/mnt/hdd1/ts",
"recordedTmp": "/mnt/hdd1/ts",

EPGStationの自動起動

$ sudo pm2 startup
$ sudo pm2 start dist/server/index.js --name "epgstation"
$ sudo pm2 save

ブラウザーから確認

ハマった点

  • Node.jsをバージョンダウンしないとビルドエラーになる。
4
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
5