chinachuで全番組録画サーバーを作る

chinachuで全番組録画サーバーを作る

Ubuntu20.04とPX-MLT5PEとchinachuで録画サーバーを作る
PX-MLT5PE 2台を一つの(9ピン)USBコネクタで接続する
を組み合わせ全録鯖を作る

諸々終わるとデバイスが生えてくる

$ ls -l /dev/pxmlt5video*
crw-rw-r-- 1 root video 240, 0 Jun 26 00:41 /dev/pxmlt5video0
crw-rw-r-- 1 root video 240, 1 Jun 26 00:41 /dev/pxmlt5video1
crw-rw-r-- 1 root video 240, 2 Jun 26 00:41 /dev/pxmlt5video2
crw-rw-r-- 1 root video 240, 3 Jun 26 00:41 /dev/pxmlt5video3
crw-rw-r-- 1 root video 240, 4 Jun 26 00:41 /dev/pxmlt5video4
crw-rw-r-- 1 root video 240, 5 Jun 26 00:41 /dev/pxmlt5video5
crw-rw-r-- 1 root video 240, 6 Jun 26 00:41 /dev/pxmlt5video6
crw-rw-r-- 1 root video 240, 7 Jun 26 00:41 /dev/pxmlt5video7
crw-rw-r-- 1 root video 240, 8 Jun 26 00:41 /dev/pxmlt5video8
crw-rw-r-- 1 root video 240, 9 Jun 26 00:41 /dev/pxmlt5video9

chinachuのWEB UIには見ない(録画しない)チャンネルが生えてくるのでこれをconfig.jsonのexcludeServicesを書き換えて消す

不要なチャンネルIDはmirakurunのAPIを叩いて取得する。

$ curl -s "http://localhost:40772/api/services" | jq . 
[
  {
    "id": 3273601024,
    "serviceId": 1024,
    "networkId": 32736,
    "name": "NHK総合1・東京",
    "type": 1,
    "logoId": 0,
    "remoteControlKeyId": 1,
    "channel": {
      "type": "GR",
      "channel": "27"
    },
    "hasLogoData": true
  },
(...snip....)
  {
    "id": 3239723656,
    "serviceId": 23656,
    "networkId": 32397,
    "name": "J:COMテレビ",
    "type": 1,
    "logoId": 0,
    "remoteControlKeyId": 10,
    "channel": {
      "type": "GR",
      "channel": "13"
    },
    "hasLogoData": true
  },
  {
    "id": 3239723657,
    "serviceId": 23657,
    "networkId": 32397,
    "name": "J:COMテレビ",
    "type": 1,
    "logoId": 0,
    "remoteControlKeyId": 10,
    "channel": {
      "type": "GR",
      "channel": "13"
    },
    "hasLogoData": true
  },
  {
    "id": 3233527768,
    "serviceId": 27768,
    "networkId": 32335,
    "name": "J:COMチャンネル",
    "type": 1,
    "logoId": 10,
    "remoteControlKeyId": 11,
    "channel": {
      "type": "GR",
      "channel": "37"
    },
    "hasLogoData": true
  },
  {
    "id": 3233527769,
    "serviceId": 27769,
    "networkId": 32335,
    "name": "J:COMチャンネル",
    "type": 1,
    "logoId": 10,
    "remoteControlKeyId": 11,
    "channel": {
      "type": "GR",
      "channel": "37"
    },
    "hasLogoData": true
  },
  {
    "id": 3233527770,
    "serviceId": 27770,
    "networkId": 32335,
    "name": "J:COMチャンネル",
    "type": 1,
    "logoId": 10,
    "remoteControlKeyId": 11,
    "channel": {
      "type": "GR",
      "channel": "37"
    },
    "hasLogoData": true
  }
]

もっと見やすくするとこんな感じ

$ curl -s "http://localhost:40772/api/services" | jq ".[] | {name: .name, id: .id}"
{
  "name": "NHK総合1・東京",
  "id": 3273601024
}
(...snip....)
{
  "name": "J:COMテレビ",
  "id": 3239723656
}
{
  "name": "J:COMテレビ",
  "id": 3239723657
}
{
  "name": "J:COMチャンネル",
  "id": 3233527768
}
{
  "name": "J:COMチャンネル",
  "id": 3233527769
}
{
  "name": "J:COMチャンネル",
  "id": 3233527770
}

こんな感じにconfig.jsonのexcludeServices部分を書き足す

  "excludeServices": [
    3273701416,
    3232728088,
    3273901183,
    3274201456,
    3239123992,
    3239123993,
    3273601408,
    3273601025,
    3273701034,
    3232727705,
    3239723656,
    3239723657,
    3233527768,
    3233527769,
    3233527770,
    3239123610
  ],

pm2をリスタートさせる

$ sudo pm2 restart all

減った

GR(地上波)全部録画するのでチェックして作成

全部録画出来る

マルチチャンネルはexcludeServicesで弾かないと行けない(対象CHだけでは不十分)のがポイント

PX-MLT5PE 2台を一つの(9ピン)USBコネクタで接続する

PX-MLT5PEを2台PCに繋げたいんですが、マザーボード側に9ピンのコネクター1つしかついてないのでコネクタを弄って2つつけられるようにします。

9ピンの構造としてUSB2.0*2が生えるイメージなので、もう一本同じ様に配線するだけ

付属のコネクタ*2 を用意

一つ細いマイナスドライバーなどで爪を持ち上げ中のピンを外す

もう一個のコネクタの方に同じ様に挿す

出来上がり

あとは通常と同様にケーブルをカードとマザーボードに挿してドライバーを入れるだけ

$ ls -l /dev/pxmlt5video*
crw-rw-r-- 1 root video 240, 0 Jun 26 00:41 /dev/pxmlt5video0
crw-rw-r-- 1 root video 240, 1 Jun 26 00:41 /dev/pxmlt5video1
crw-rw-r-- 1 root video 240, 2 Jun 26 00:41 /dev/pxmlt5video2
crw-rw-r-- 1 root video 240, 3 Jun 26 00:41 /dev/pxmlt5video3
crw-rw-r-- 1 root video 240, 4 Jun 26 00:41 /dev/pxmlt5video4
crw-rw-r-- 1 root video 240, 5 Jun 26 00:41 /dev/pxmlt5video5
crw-rw-r-- 1 root video 240, 6 Jun 26 00:41 /dev/pxmlt5video6
crw-rw-r-- 1 root video 240, 7 Jun 26 00:41 /dev/pxmlt5video7
crw-rw-r-- 1 root video 240, 8 Jun 26 00:41 /dev/pxmlt5video8
crw-rw-r-- 1 root video 240, 9 Jun 26 00:41 /dev/pxmlt5video9

Ubuntu20.04とPX-MLT5PEとchinachuで録画サーバーを作る

環境

$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.1 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.1 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
$ uname -r
5.4.0-58-generic

必要に応じてadduserでユーザーを作っておきsudoできるようにしておく

$ sudo adduser rec
$ sudo visudo 

#タイムゾーンの設定
$ timedatectl
               Local time: Tue 2020-12-29 08:29:51 UTC
           Universal time: Tue 2020-12-29 08:29:51 UTC
                 RTC time: Tue 2020-12-29 08:29:51    
                Time zone: Etc/UTC (UTC, +0000)       
System clock synchronized: yes                        
              NTP service: active                     
          RTC in local TZ: no   
$ sudo timedatectl set-timezone Asia/Tokyo
$ timedatectl
               Local time: Tue 2020-12-29 17:30:48 JST
           Universal time: Tue 2020-12-29 08:30:48 UTC
                 RTC time: Tue 2020-12-29 08:30:48    
                Time zone: Asia/Tokyo (JST, +0900)    
System clock synchronized: yes                        
              NTP service: active                     
          RTC in local TZ: no 

PX-MLT5PEドライバーのインストール
https://github.com/nns779/px4_drv を見ながら粛々と入れる

$ sudo apt install -y unzip gcc make
$ mkdir src
$ cd src/
$ git clone https://github.com/nns779/px4_drv.git
$ cd px4_drv/fwtool/
$ make
$ wget http://plex-net.co.jp/plex/pxw3u4/pxw3u4_BDA_ver1x64.zip -O pxw3u4_BDA_ver1x64.zip
$ unzip -oj pxw3u4_BDA_ver1x64.zip pxw3u4_BDA_ver1x64/PXW3U4.sys
$ ./fwtool PXW3U4.sys it930x-firmware.bin
$ mkdir -p /lib/firmware
$ sudo cp it930x-firmware.bin /lib/firmware/
$ cd ../
##### DKMSを使用しない場合
$ cd driver
$ make
$ sudo make install
#####
$ lsmod | grep -e ^px4_drv
$ ls /dev/pxmlt5video*
/dev/pxmlt5video0  /dev/pxmlt5video1  /dev/pxmlt5video2  /dev/pxmlt5video3  /dev/pxmlt5video4

ubuntuは自動的にカーネルがアップデートされるので、ドライバーが消えるのでDKMSでインストールしたほうが良いかもしれない。
(もしくはアップデートを自動で止める)

$ sudo cp -a ./ /usr/src/px4_drv-0.2.1
$ sudo dkms add px4_drv/0.2.1
$ sudo dkms install px4_drv/0.2.1
$ lsmod | grep -e ^px4_drv
px4_drv               143360  0
$ ls -l /dev/pxmlt5video*
crw-rw-r-- 1 root video 239, 0 Aug 23 22:37 /dev/pxmlt5video0
crw-rw-r-- 1 root video 239, 1 Aug 23 22:37 /dev/pxmlt5video1
crw-rw-r-- 1 root video 239, 2 Aug 23 22:37 /dev/pxmlt5video2
crw-rw-r-- 1 root video 239, 3 Aug 23 22:37 /dev/pxmlt5video3
crw-rw-r-- 1 root video 239, 4 Aug 23 22:37 /dev/pxmlt5video4
crw-rw-r-- 1 root video 239, 5 Aug 23 22:37 /dev/pxmlt5video5
crw-rw-r-- 1 root video 239, 6 Aug 23 22:37 /dev/pxmlt5video6
crw-rw-r-- 1 root video 239, 7 Aug 23 22:37 /dev/pxmlt5video7
crw-rw-r-- 1 root video 239, 8 Aug 23 22:37 /dev/pxmlt5video8
crw-rw-r-- 1 root video 239, 9 Aug 23 22:37 /dev/pxmlt5video9

カードリーダードライバのインストール
#好みのやり方で

arib25ライブラリのインストール

$ sudo apt install -y cmake  build-essential libpcsclite-dev

$ cd ~/src/
$ git clone https://github.com/stz2012/libarib25.git
$ cd libarib25/
$ cmake .
$ make
$ sudo make install
$ 

recpt1のインストール

$ cd ~/src/
$ wget http://plex-net.co.jp/download/linux/Linux_Driver.zip
$ unzip Linux_Driver.zip
$ cd Linux_Driver/MyRecpt1/MyRecpt1/recpt1
$ sed -i".org" 's/-DTV/video/g' pt1_dev.h
$ sh ./autogen.sh 
$ sh ./configure --enable-b25
$ make clean
$ make
$ sudo make install

録画の確認
エラーが出たら上の手順をやり直す

$ recpt1 --device /dev/pxmlt5video1 --b25 --strip --sid hd 27 10 test.ts
using device: /dev/pxmlt5video1
using B25...
enable B25 strip
device = /dev/pxmlt5video1
C/N = 22.501011dB
(PID:4648)(CH:T27) Recording...
Available sid = 1024 1025 1408 65520 
Chosen sid    = 1024
Available PMT = 0x1f0 0x3f0 0x1fc8 0x1cf0 
(PID:4648)(CH:T27) Recorded 10sec

–deviceでデバイスを指定しないとエラーになる。

$ recpt1 --b25 --strip --sid hd 27 10 test.ts
using B25...
enable B25 strip
(tune) Cannot tune to the specified channel

Mirakurunのインストール
この辺を見ながらインストール

$ sudo apt install -y pkg-config
$ curl -sL https://deb.nodesource.com/setup_14.x | sudo -E bash -
$ sudo apt-get install -y nodejs
$ sudo npm install pm2 -g
$ sudo npm install mirakurun -g --unsafe-perm
$ sudo npm install rivarun -g
$ sudo npm install arib-b25-stream-test -g --unsafe
$ sudo mirakurun config tuners # 下のテキストっぽく修正
$ sudo mirakurun restart

中身はこんな感じ

- name: PX-MLT5PE0
  types:
    - GR
  command: /usr/local/bin/recpt1 --device /dev/pxmlt5video0 <channel> - -
  decoder: arib-b25-stream-test
  isDisabled: false

- name: PX-MLT5PE1
  types:
    - GR
  command: /usr/local/bin/recpt1 --device /dev/pxmlt5video1 <channel> - -
  decoder: arib-b25-stream-test
  isDisabled: false

- name: PX-MLT5PE2
  types:
    - GR
  command: /usr/local/bin/recpt1 --device /dev/pxmlt5video2 <channel> - -
  decoder: arib-b25-stream-test
  isDisabled: false

- name: PX-MLT5PE3
  types:
    - GR
  command: /usr/local/bin/recpt1 --device /dev/pxmlt5video3 <channel> - -
  decoder: arib-b25-stream-test
  isDisabled: false

- name: PX-MLT5PE4
  types:
    - GR
  command: /usr/local/bin/recpt1 --device /dev/pxmlt5video4 <channel> - -
  decoder: arib-b25-stream-test
  isDisabled: false

チャンネルが取得できる事を確認

$ curl -X PUT "http://localhost:40772/api/config/channels/scan"
channel scanning... (type: "GR")
(略)
-> total 11 channels found and 34 channels stored.

channel scan has completed and saved successfully.
**RESTART REQUIRED** to apply changes

この辺を見ながらChinachuインストール

$ sudo apt install -y python2
$ git clone git://github.com/Chinachu/Chinachu.git ~/chinachu
$ cd ~/chinachu/
$ EPYTHON=python2 ./chinachu installer
$ cp config.sample.json config.json
$ vim config.json #公式を見ながら修正
$ echo [] > rules.json
$ ./chinachu service wui execute
$ ./chinachu update
$ sudo pm2 start processes.json
$ sudo pm2 save
$ sudo pm2 startup

ubuntu20にはpython2系が入っていないのでそのまま./chinachu installer するとエラーになる

Installing Node Modules using NPM...

> mirakurun@2.15.2 preinstall /home/rec/chinachu/node_modules/mirakurun
> node bin/preinstall.js

Note: add `-g` to install Mirakurun as Server!

> diskusage@1.1.3 install /home/rec/chinachu/node_modules/diskusage
> node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (/home/rec/chinachu/.nave/installed/10.16.3/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/home/rec/chinachu/.nave/installed/10.16.3/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:406:16)
gyp ERR! stack     at F (/home/rec/chinachu/.nave/installed/10.16.3/lib/node_modules/npm/node_modules/which/which.js:68:16)
gyp ERR! stack     at E (/home/rec/chinachu/.nave/installed/10.16.3/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack     at /home/rec/chinachu/.nave/installed/10.16.3/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack     at /home/rec/chinachu/.nave/installed/10.16.3/lib/node_modules/npm/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /home/rec/chinachu/.nave/installed/10.16.3/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:153:21)
gyp ERR! System Linux 5.4.0-58-generic
gyp ERR! command "/home/rec/chinachu/.nave/installed/10.16.3/bin/node" "/home/rec/chinachu/.nave/installed/10.16.3/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/rec/chinachu/node_modules/diskusage
gyp ERR! node -v v10.16.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! diskusage@1.1.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the diskusage@1.1.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/rec/.npm/_logs/2020-12-20T13_59_12_766Z-debug.log

> diskusage@1.1.3 install /home/rec/chinachu/node_modules/diskusage
> node-gyp rebuild

gyp ERR! configure error 
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (/home/rec/chinachu/.nave/installed/10.16.3/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (/home/rec/chinachu/.nave/installed/10.16.3/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:406:16)
gyp ERR! stack     at F (/home/rec/chinachu/.nave/installed/10.16.3/lib/node_modules/npm/node_modules/which/which.js:68:16)
gyp ERR! stack     at E (/home/rec/chinachu/.nave/installed/10.16.3/lib/node_modules/npm/node_modules/which/which.js:80:29)
gyp ERR! stack     at /home/rec/chinachu/.nave/installed/10.16.3/lib/node_modules/npm/node_modules/which/which.js:89:16
gyp ERR! stack     at /home/rec/chinachu/.nave/installed/10.16.3/lib/node_modules/npm/node_modules/isexe/index.js:42:5
gyp ERR! stack     at /home/rec/chinachu/.nave/installed/10.16.3/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:153:21)
gyp ERR! System Linux 5.4.0-58-generic
gyp ERR! command "/home/rec/chinachu/.nave/installed/10.16.3/bin/node" "/home/rec/chinachu/.nave/installed/10.16.3/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/rec/chinachu/node_modules/diskusage
gyp ERR! node -v v10.16.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! diskusage@1.1.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the diskusage@1.1.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/rec/.npm/_logs/2020-12-20T13_59_16_061Z-debug.log
done.

					

pm2でchinachuがerroredになる時の対処法

症状:centos7でchinachu 0.10.0-gamma.0 をインストールした際に errored になり、起動できない
原因:chinachuをインストールする際にnaveもインストールするが、ハッシュ値比較に利用するコマンドがないためインストールに失敗し実行できない。
解決方法:nave.shの中身を書き換える(コマンドを変える)

lqqqqqqqqqqqqqqqqqqqwqqqqwqqqqqqqqqqqqqqqqwqqqqqqwqqqqqqwqqqqqqqqqwqqqqqqqqqwqqqqqqqqwqqqqqwqqqqqqqqqqqqwqqqqqqwqqqqqqqqqqk
x App name          x id x version        x mode x pid  x status  x restart x uptime x cpu x mem        x user x watching x
tqqqqqqqqqqqqqqqqqqqnqqqqnqqqqqqqqqqqqqqqqnqqqqqqnqqqqqqnqqqqqqqqqnqqqqqqqqqnqqqqqqqqnqqqqqnqqqqqqqqqqqqnqqqqqqnqqqqqqqqqqu
x chinachu-operator x 2  x 0.10.0-gamma.0 x fork x N/A  x errored x 0       x 0      x 0%  x 0 B        x root x disabled x
x chinachu-wui      x 1  x 0.10.0-gamma.0 x fork x N/A  x errored x 0       x 0      x 0%  x 0 B        x root x disabled x
x mirakurun-server  x 0  x 2.11.0         x fork x 5892 x online  x 1       x 27m    x 0%  x 148.9 MB   x root x disabled x
mqqqqqqqqqqqqqqqqqqqvqqqqvqqqqqqqqqqqqqqqqvqqqqqqvqqqqqqvqqqqqqqqqvqqqqqqqqqvqqqqqqqqvqqqqqvqqqqqqqqqqqqvqqqqqqvqqqqqqqqqqj
$pm2 log 
 一部抜粋
PM2   | Stopping app:mirakurun-server id:0
PM2   | App [chinachu-wui:1] starting in -fork mode-
PM2   | App [chinachu-wui:1] online
PM2   | Error: spawn .nave/node ENOENT
PM2   |     at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
PM2   |     at onErrorNT (internal/child_process.js:362:16)
PM2   |     at _combinedTickCallback (internal/process/next_tick.js:139:11)
PM2   |     at process._tickDomainCallback (internal/process/next_tick.js:219:9)
PM2   | App [chinachu-operator:2] starting in -fork mode-
PM2   | App [chinachu-operator:2] online
PM2   | Error: spawn .nave/node ENOENT
PM2   |     at Process.ChildProcess._handle.onexit (internal/child_process.js:190:19)
PM2   |     at onErrorNT (internal/child_process.js:362:16)
PM2   |     at _combinedTickCallback (internal/process/next_tick.js:139:11)
PM2   |     at process._tickDomainCallback (internal/process/next_tick.js:219:9)
PM2   | App [mirakurun-server:0] exited with code [0] via signal [SIGINT]
PM2   | pid=22521 msg=process killed
PM2   | App [mirakurun-server:0] starting in -fork mode-
PM2   | App [mirakurun-server:0] online

3) Node.js Environment の部分で
nave.shが実行出来てないのが原因
nave.sh: line 237: shasum: command not found

nave-2.3.0/nave.sh
removed directory: ‘/home/rec/chinachu/.nave/nave-2.3.0’
######################################################################## 100.0%
/home/rec/chinachu/.nave/nave.sh: line 237: shasum: command not found
shasum mismatch, expect 6c35b85a7cd4188ab7578354277b2b2ca43eacc864a2a16b3669753ec2369d52, got 6c35b85a7cd4188ab7578354277b2b2ca43eacc864a2a16b3669753ec2369d52
$vim chinachu/.nave/nave.sh

#shasum というコマンドはcentosにない
237   local actualshasum=$(sha256sum "$cache/$dir/$base" | awk '{print $1}')
238   if ! [ "$shasum" = "$actualshasum" ]; then

chinachuのソースをいじる
ダウンロードし解凍後
144行目に shasum -a 256 を sha256sum 置換するコマンドを入れる

sed -i -e "s/shasum -a 256/sha256sum/" $NAVE_DIR/nave.sh

#alias sha256sum=’shasum -a 256’でもいいかもしれない…

最終的に下記のようなコードになる

$vim chinachu

140   echo "Installing Node using Nave..."
141   wget -O - https://github.com/isaacs/nave/archive/v2.3.0.tar.gz | tar zxvf - -C $NAVE_DIR nave-2.3.0/nave.sh
142   mv $NAVE_DIR/nave-2.3.0/nave.sh $NAVE_DIR/
143   rm -rfv $NAVE_DIR/nave-2.3.0
144   sed -i -e "s/shasum -a 256/sha256sum/" $NAVE_DIR/nave.sh
145   ${NAVE_DIR}/nave.sh install $NODE_VER
146   rm -fv ${NAVE_DIR}/node
147   ln -sv $NODE_PATH ${NAVE_DIR}/node
148   ln -sv $NPM_PATH ${NAVE_DIR}/npm
$ echo "1" | ./chinachu installer

インストールできる。

CentOS7にPX-Q3PE4のドライバーを入れる

こんなエラーが出る

[root@localhost CentOS7-1804_64bit_kernel3.10.0-862]# insmod tty_Virtual.ko
insmod: ERROR: could not insert module tty_Virtual.ko: File exists
[root@localhost CentOS7-1804_64bit_kernel3.10.0-862]# insmod usb-px4.ko
insmod: ERROR: could not insert module usb-px4.ko: File exists

原因はOSとドライバーのバージョンが違うため
OS側が3.10.0-693に対して、
ドライバー側が3.10.0-862なのが原因

[root@localhost CentOS7-1804_64bit_kernel3.10.0-862]# modinfo tty_Virtual.ko | grep vermagic
vermagic:       3.10.0-862.3.3.el7.x86_64 SMP mod_unload modversions

[root@localhost CentOS7-1804_64bit_kernel3.10.0-862]# uname -r
3.10.0-693.el7.x86_64

OS側と同じバージョンのドライバーを入れる。
公式ページ(http://www.plex-net.co.jp/download/)
ここからダウンロード

# wget http://plex-net.co.jp/plex/linux/CentOS7-1708_64bit_kernel3.10.0-693.zip
# unzip CentOS7-1708_64bit_kernel3.10.0-693.zip
[root@localhost CentOS7-1708_64bit_kernel3.10.0-693]# ll
total 7952
-rw-r--r--. 1 root root  300208 Dec 22  2017 tty_Virtual.ko
-rw-r--r--. 1 root root 7838824 Dec 22  2017 usb-px4.ko
[root@localhost CentOS7-1708_64bit_kernel3.10.0-693]# insmod tty_Virtual.ko
[root@localhost CentOS7-1708_64bit_kernel3.10.0-693]# insmod usb-px4.ko
[root@localhost CentOS7-1708_64bit_kernel3.10.0-693]# lsmod | grep px4
usb_px4               446056  0
tty_Virtual            22223  1 usb_px4
[root@localhost CentOS7-1708_64bit_kernel3.10.0-693]# ls /dev/px4*
/dev/px4-DTV0  /dev/px4-DTV2  /dev/px4-DTV4  /dev/px4-DTV6
/dev/px4-DTV1  /dev/px4-DTV3  /dev/px4-DTV5  /dev/px4-DTV7

めでたしめでたし

cninachu γから録画したものだけが画像が乱れる

結果論から言うとHDDを替えたら治った。
原因は不明

再発した

とりあえず、書き出しだけ

cninachu γのWEB UIから録画したものだけ画像が乱れる
rec

こんな感じ、ノイズが酷い後音も飛ぶ

recpt1 --strip -b25 27 10 test.ts
rivarun --b25 --sid 1056 --ch GR/21 15 test.ts
rivarun --b25 --mirakurun localhost:40772 --sid 1024 --ch GR/27 15 test2.ts

上記コマンドは綺麗に再生出来た

切り分けの方法が分からぬ

「disk io が足りてないのかも」と言われたのでそのうち確認してみる

構成
FUJITSU Server PRIMERGY TX1310 M1
PT3*2
350GB HDD
3T HDD




					

cninachu γでTOKYO MXや千葉テレビが受信できない

未解決
ケーブル変えたら治った
テスト用に使ったケーブル(10mくらい)が原因

ビフォー

[root@10 ~]# checksignal --device /dev/pt3video7 16
device = /dev/pt3video7
C/N = 9.582304dB

アフター

[root@10 ~]# checksignal --device /dev/pt3video2 16
device = /dev/pt3video2
C/N = 33.454903dB^C

Mirakurunのインストール手順(Ubuntu・Debian・CentOS)


ここにも同じような人が居た

[root@10 ~]#  npm list --depth=0 -g
/usr/lib
tqq arib-b25-stream-test@0.2.9
tqq mirakurun@2.5.7
tqq npm@3.10.10
tqq pm2@2.8.0
mqq rivarun@1.2.0
[root@10 ~]# rivarun --list | sed 's/},/},\n/g'
status: 200
headers: {"server":"Mirakurun/2.5.7","content-type":"application/json; charset=utf-8","date":"Tue, 05 Dec 2017 16:44:43 GMT","connection":"close","content-length":"2763"}
[{"type":"GR","channel":"27","name":"NHK総合・東京","services":[{"id":3273601024,"serviceId":1024,"networkId":32736,"name":"NHK総合1・東京"},
{"id":3273601025,"serviceId":1025,"networkId":32736,"name":"NHK総合2・東京"},
{"id":3273601408,"serviceId":1408,"networkId":32736,"name":"NHK携帯G・東京"}]},
{"type":"GR","channel":"26","name":"NHK Eテレ東京","services":[{"id":3273701032,"serviceId":1032,"networkId":32737,"name":"NHKEテレ1東京"},
{"id":3273701033,"serviceId":1033,"networkId":32737,"name":"NHKEテレ2東京"},
{"id":3273701034,"serviceId":1034,"networkId":32737,"name":"NHKEテレ3東京"},
{"id":3273701416,"serviceId":1416,"networkId":32737,"name":"NHK携帯2"}]},
{"type":"GR","channel":"25","name":"日本テレビ","services":[{"id":3273801040,"serviceId":1040,"networkId":32738,"name":"日テレ1"},
{"id":3273801041,"serviceId":1041,"networkId":32738,"name":"日テレ2"},
{"id":3273801424,"serviceId":1424,"networkId":32738,"name":"日本テレビ"}]},
{"type":"GR","channel":"24","name":"テレビ朝日","services":[{"id":3274101064,"serviceId":1064,"networkId":32741,"name":"テレビ朝日"},
{"id":3274101065,"serviceId":1065,"networkId":32741,"name":"テレビ朝日"},
{"id":3274101066,"serviceId":1066,"networkId":32741,"name":"テレビ朝日"},
{"id":3274101448,"serviceId":1448,"networkId":32741,"name":"テレビ朝日"}]},
{"type":"GR","channel":"22","name":"TBS","services":[{"id":3273901048,"serviceId":1048,"networkId":32739,"name":"TBS1"},
{"id":3273901049,"serviceId":1049,"networkId":32739,"name":"TBS2"},
{"id":3273901432,"serviceId":1432,"networkId":32739,"name":"TBS"},
{"id":3273901183,"serviceId":1183,"networkId":32739,"name":"Gガイド"}]},
{"type":"GR","channel":"23","name":"テレビ東京","services":[{"id":3274201072,"serviceId":1072,"networkId":32742,"name":"テレビ東京1"},
{"id":3274201073,"serviceId":1073,"networkId":32742,"name":"テレビ東京2"},
{"id":3274201074,"serviceId":1074,"networkId":32742,"name":"テレビ東京3"},
{"id":3274201456,"serviceId":1456,"networkId":32742,"name":"テレビ東京携帯"}]},
{"type":"GR","channel":"21","name":"フジテレビジョン","services":[{"id":3274001056,"serviceId":1056,"networkId":32740,"name":"フジテレビ"},
{"id":3274001057,"serviceId":1057,"networkId":32740,"name":"フジテレビ"},
{"id":3274001058,"serviceId":1058,"networkId":32740,"name":"フジテレビ"},
{"id":3274001440,"serviceId":1440,"networkId":32740,"name":"フジテレビ"}]},
{"type":"GR","channel":"16","name":"TOKYO MX","services":[]},
{"type":"GR","channel":"28","name":"放送大学","services":[]},
{"type":"GR","channel":"30","name":"千葉テレビ","services":[]}]
[root@10 ~]# rivarun --list | sed 's/},/},\n/g'  | grep -v serviceId
status: 200
headers: {"server":"Mirakurun/2.5.7","content-type":"application/json; charset=utf-8","date":"Tue, 05 Dec 2017 16:45:28 GMT","connection":"close","content-length":"2763"}
{"type":"GR","channel":"16","name":"TOKYO MX","services":[]},
{"type":"GR","channel":"28","name":"放送大学","services":[]},
{"type":"GR","channel":"30","name":"千葉テレビ","services":[]}]

TOKYO MXの受信感度がかなり悪い。何でだろう

0|mirakuru | 2017-12-06T22:36:24.125+09:00 info: ChannelItem#'放送大学' service scan has started
0|mirakuru | 2017-12-06T22:36:24.126+09:00 info: TSFilter has created (serviceId=null, eventId=null)
0|mirakuru | 2017-12-06T22:36:24.137+09:00 info: TunerDevice#4 process has spawned by command `recpt1 --device /dev/pt3video6 28 - -` (pid=11704)
0|mirakuru | 2017-12-06T22:36:24.137+09:00 info: TunerDevice#4 streaming to user `Mirakurun:getServices()` (priority=-1)
0|mirakuru | 2017-12-06T22:36:24.139+09:00 info: TunerDevice#4 > using device: /dev/pt3video6
0|mirakuru | pid = 11704
0|mirakuru | 2017-12-06T22:36:24.969+09:00 info: TunerDevice#4 > device = /dev/pt3video6
0|mirakuru | 2017-12-06T22:36:24.971+09:00 info: TunerDevice#4 > C/N = -nandB
0|mirakuru | 2017-12-06T22:36:24.972+09:00 info: TunerDevice#4 > Recording...
0|mirakuru | 2017-12-06T22:36:44.138+09:00 info: TSFilter has closed (serviceId=null, eventId=null)
0|mirakuru | 2017-12-06T22:36:44.138+09:00 info: TunerDevice#4 end streaming to user `Mirakurun:getServices()` (priority=-1)
0|mirakuru | 2017-12-06T22:36:44.138+09:00 warn: ChannelItem#'放送大学' service scan has failed [Error: stream has closed before get network]
0|mirakuru | 2017-12-06T22:36:44.138+09:00 info: ChannelItem#'TOKYO MX' service scan has started
0|mirakuru | 2017-12-06T22:36:44.139+09:00 info: TSFilter has created (serviceId=null, eventId=null)
0|mirakuru | 2017-12-06T22:36:44.150+09:00 info: TunerDevice#5 process has spawned by command `recpt1 --device /dev/pt3video7 16 - -` (pid=11712)
0|mirakuru | 2017-12-06T22:36:44.150+09:00 info: TunerDevice#5 streaming to user `Mirakurun:getServices()` (priority=-1)
0|mirakuru | 2017-12-06T22:36:44.152+09:00 info: TunerDevice#5 > using device: /dev/pt3video7
0|mirakuru | 2017-12-06T22:36:44.152+09:00 info: TunerDevice#5 > pid = 11712
0|mirakuru | 2017-12-06T22:36:45.027+09:00 info: TunerDevice#5 > device = /dev/pt3video7
0|mirakuru | 2017-12-06T22:36:45.029+09:00 info: TunerDevice#5 > C/N = 10.088181dB
0|mirakuru | 2017-12-06T22:36:45.030+09:00 info: TunerDevice#5 > Recording...
0|mirakuru | 2017-12-06T22:36:47.138+09:00 info: TunerDevice#4 > SIGTERM received. cleaning up...
0|mirakuru | 2017-12-06T22:36:47.138+09:00 info: TunerDevice#4 > Recorded 23sec
0|mirakuru | 2017-12-06T22:36:47.820+09:00 info: TunerDevice#4 process has closed with exit code=0 by signal `null` (pid=11704)
0|mirakuru | 2017-12-06T22:37:04.150+09:00 info: TSFilter has closed (serviceId=null, eventId=null)
0|mirakuru | 2017-12-06T22:37:04.151+09:00 info: TunerDevice#5 end streaming to user `Mirakurun:getServices()` (priority=-1)
0|mirakuru | 2017-12-06T22:37:04.152+09:00 warn: ChannelItem#'TOKYO MX' service scan has failed [Error: stream has closed before get network]
^C
[root@10 ~]# recpt1 --strip -b25 16 10 test.ts
enable B25 strip
using B25...
recpt1: invalid option -- '2'
recpt1: invalid option -- '5'
pid = 11726
C/N = 9.632417dB
Recording...
b25->put failed
b25_decode failed (code=-4). fall back to encrypted recording.
Recorded 11sec

[root@10 ~]# checksignal --device /dev/pt3video7 16
device = /dev/pt3video7
C/N = 9.582304dB

CentOS7にPT3とSoftCasとその他もろもろ入れるメモ

Fujitsu PRIMERGY TX1310M1 が安く手に入ったので録画サーバーをリプレースしたのでその時のメモ
基本的にはここ参考に録画サーバ構築の前準備(CentOS 7編)、Chinachu・epgrec UNA対応 | 自分に負けないラボラトリー

入れたてのCentOS7でmakeが通らないのでメモ
yumで色々入れとけばmakeは通る。
不要な物もあるかも

yum -y install git kernel-devel-`uname -r` git unzip bzip2 wget gcc gcc-c++ kernel-devel vim wget unzip bzip2 make autogen automake kernel-devel patch perl-ExtUtils-MakeMaker libtool openssl-devel libboost-all-dev boost-devel cmake pcsc-lite pcsc-lite-devel  pcsc-lite-libs

PT3ドライバ、arib25ライブラリ、recpt1コマンドを参考に

SoftCasはLinuxでSoftCasは使用できるのか? ~CentOS 7編~ | 俺的備忘録 〜なんかいろいろ〜を参考に

下記コマンドを入力するが

# wget http://www.wazoku.net/softcas.zip
# unzip softcas.zip
# cd softcas
# wget -O winscard.cpp https://pastebin.com/raw/5144Ah9g
# wget -O Makefile https://pastebin.com/raw/FQdSixkB

makeするとKeys.hがないと言われる

# make
g++  -g -fPIC -O2 -I /usr/include/PCSC  -c -o winscard.o winscard.cpp
winscard.cpp:12:18: fatal error: Keys.h: No such file or directory
 #include "Keys.h"
                  ^
compilation terminated.
make: *** [winscard.o] Error 1

配布ファイルが変更されていて一発でmakeが通らなくなっている。
自分は心が折れて昔の録画サーバーからソースコードを取ってきた。

ソースコードの一文をググるとこの辺がヒットするので参考になるかも

下のファイルが有ればコンパイル出来る

-rw-r--r--. 1 root root 13209 Dec  3 21:40 Crypto.cpp
-rw-r--r--. 1 root root   296 Dec  3 21:40 Crypto.h
-rw-r--r--. 1 root root 34136 Dec  3 21:40 Crypto.o
-rw-r--r--. 1 root root  1917 Dec  3 21:40 Decoder-ECM.cpp
-rw-r--r--. 1 root root  8504 Dec  3 21:41 Decoder-ECM.o
-rw-r--r--. 1 root root   331 Dec  3 21:40 Decoder.h
-rw-r--r--. 1 root root   410 Dec  3 21:40 Global.h
-rw-r--r--. 1 root root  1831 Dec  3 21:40 Keys.cpp
-rw-r--r--. 1 root root  1084 Dec  3 21:40 Keyset.cpp
-rw-r--r--. 1 root root   484 Dec  3 21:40 Keyset.h
-rw-r--r--. 1 root root 14600 Dec  3 21:40 Keyset.o
-rw-r--r--. 1 root root   444 Dec  3 21:40 Keys.h
-rw-r--r--. 1 root root  7248 Dec  3 21:40 Keys.o
-rwxr-xr-x. 1 root root 57728 Dec  3 21:41 libpcsclite.so.1.0.0
-rw-r--r--. 1 root root   364 Dec  3 21:40 Makefile
-rw-r--r--. 1 root root  1235 Dec  3 21:40 softcas.sln
-rw-r--r--. 1 root root  7262 Dec  3 21:40 softcas.vcxproj
-rw-r--r--. 1 root root  1429 Dec  3 21:40 softcas.vcxproj.filters
drwxr-xr-x. 2 root root    26 Dec  3 21:40 Win32
-rw-r--r--. 1 root root  3517 Dec  3 21:40 winscard.cpp
-rw-r--r--. 1 root root 14400 Dec  3 21:40 winscard.o
drwxr-xr-x. 2 root root    26 Dec  3 21:40 x64

物が揃えば下記コマンドで出来る

# make
# cp libpcsclite.so.1.0.0 /usr/lib64/

#ubuntuは

# make
# cp libpcsclite.so.1.0.0 /lib/x86_64-linux-gnu/