環境
$ 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.
ピンバック: chinachuで全番組録画サーバーを作る | セッキーが作ったページ