- Raspberry Pi 4 Model B
- PLEX PX-Q1UD
- B-CAS Card
- B-CAS CARD Reader
- micro SD
- Geekworm Raspberry Pi(冷却用アーマーケース)
Raspberry Pi OS Lite(32-bit)
sudo iwconfig wlan0 txpower off
編集
pi@raspberrypi:~ $ sudo vi /etc/dhcpcd.conf
環境に合わせて設定
interface eth0
static ip_address=192.168.0.37/24
static routers=192.168.0.1
static domain_name_servers=8.8.8.8
再起動
sudo reboot
pi@raspberrypi:~ $ touch /boot/ssh
以降はssh接続で
pi@raspberrypi:~ $ sudo timedatectl set-timezone 'Asia/Tokyo'
pi@raspberrypi:~ $ sudo apt update && sudo apt upgrade -y && sudo apt install locales-all
pi@raspberrypi:~ $ sudo localectl set-locale 'LANG=ja_JP.UTF-8'
pi@raspberrypi:~ $ export LC_ALL=en_US.UTF-8
pi@raspberrypi:~ $ sudo swapoff --all
pi@raspberrypi:~ $ sudo systemctl stop dphys-swapfile.service
pi@raspberrypi:~ $ sudo systemctl disable dphys-swapfile.service
pi@raspberrypi:~ $ systemctl status dphys-swapfile.service
PLEX PX-Q1UDのドライバーインストール
pi@raspberrypi:~ $ wget http://plex-net.co.jp/plex/px-s1ud/PX-S1UD_driver_Ver.1.0.1.zip
pi@raspberrypi:~ $ unzip PX-S1UD_driver_Ver.1.0.1.zip
pi@raspberrypi:~ $ sudo cp PX-S1UD_driver_Ver.1.0.1/x64/amd64/isdbt_rio.inp /lib/firmware
再起動して dmesg を実行すると PX-S1UD Digital TV Tuner が 4 つ見える
pi@raspberrypi:~ $ sudo reboot
pi@raspberrypi:~ $ dmesg | grep PX-S1UD
[ 3.016040] usb 1-1.4.1: Product: PX-S1UD Digital TV Tuner
[ 3.246042] usb 1-1.4.2: Product: PX-S1UD Digital TV Tuner
[ 3.476047] usb 1-1.4.3: Product: PX-S1UD Digital TV Tuner
[ 3.715967] usb 1-1.4.4: Product: PX-S1UD Digital TV Tuner
pi@raspberrypi:~ $ sudo apt install build-essential pcscd libpcsclite-dev libccid pcsc-tools
B-CAS カードを読み取れているかを確認する.
pi@raspberrypi:~ $ sudo pcsc_scan
Japanese Chijou Digital B-CAS Card (pay TV) みたいなのが出てれば OK.
pi@raspberrypi:~ $ sudo apt install dvb-tools
pi@raspberrypi:~ $ cd /usr/local
pi@raspberrypi:~ $ sudo mkdir conf
pi@raspberrypi:~ $ cd conf
pi@raspberrypi:~ $ sudo curl -O https://raw.githubusercontent.com/Chinachu/dvbconf-for-isdb/master/conf/dvbv5_channels_isdbt.conf
pi@raspberrypi:~ $ sudo apt-get install -y nodejs npm && \
npm install npm n -g && \
n stable
pi@raspberrypi:~ $ sudo reboot
pi@raspberrypi:~ $ sudo npm install pm2 -g
pi@raspberrypi:~ $ sudo npm install mirakurun -g --unsafe-perm --production
pi@raspberrypi:~ $ sudo npm install arib-b25-stream-test -g --unsafe
pi@raspberrypi:~ $ sudo mirakurun init
pi@raspberrypi:~ $ sudo mirakurun config tuners
末尾に以下を追加
- name: PX-S1UD
types:
- GR
command: /usr/bin/dvbv5-zap -a 0 -c /usr/local/conf/dvbv5_channels_isdbt.conf -r -P <channel>
dvbDevicePath: /dev/dvb/adapter0/dvr0
decoder: arib-b25-stream-test
isDisabled: false
pi@raspberrypi:~ $ sudo mirakurun restart
pi@raspberrypi:~ $ curl -X PUT "http://localhost:40772/api/config/channels/scan"
pi@raspberrypi:~ $ curl http://localhost:40772/api/channels
地上波 - NHK総合
http://mirakurun:40772/api/channels/GR/27/services/1024/stream/
地上波 - NHK Eテレ
http://mirakurun:40772/api/channels/GR/26/services/1032/stream/
地上波 - 日本テレビ
http://mirakurun:40772/api/channels/GR/25/services/1040/stream/
地上波 - テレビ朝日
http://mirakurun:40772/api/channels/GR/24/services/1064/stream/
地上波 - TBS
http://mirakurun:40772/api/channels/GR/22/services/1048/stream/
地上波 - テレビ東京
http://mirakurun:40772/api/channels/GR/23/services/1072/stream/
地上波 - フジテレビ
http://mirakurun:40772/api/channels/GR/21/services/1056/stream/
VLCでプレイリスト表示出来る
#EXTM3U
#EXTINF:-1, 地上波 - NHK総合
http://mirakurun:40772/api/channels/GR/27/services/1024/stream/
#EXTINF:-1, 地上波 - NHK Eテレ
http://mirakurun:40772/api/channels/GR/26/services/1033/stream/
#EXTINF:-1, 地上波 - 日本テレビ
http://mirakurun:40772/api/channels/GR/25/services/1041/stream/
#EXTINF:-1, 地上波 - テレビ朝日
http://mirakurun:40772/api/channels/GR/24/services/1064/stream/
#EXTINF:-1, 地上波 - TBS
http://mirakurun:40772/api/channels/GR/22/services/1048/stream/
#EXTINF:-1, 地上波 - テレビ東京
http://mirakurun:40772/api/channels/GR/23/services/1072/stream/
#EXTINF:-1, 地上波 - フジテレビ
http://mirakurun:40772/api/channels/GR/21/services/1056/stream/
- パーティションテーブルはGPT
- partedコマンドでフォーマットできる(MBRもいける)
- ファイルシステムはext4
差し込んだHDDのパスを確認
pi@raspberrypi:~ $ sudo fdisk -l
Disk /dev/sda: 119.24 GiB, 128035676160 bytes, 250069680 sectors
Disk model: PX-128M3P
pi@raspberrypi:~ $ sudo parted /dev/sda
注意点: /dev/sdaはパーティションテーブル /dev/sda1,/dev/sda2はパーティション
(parted) mklabel gpt
(parted) p
Model: PLEXTOR PX-128M3P (scsi)
Disk /dev/sda: 128GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 128GB 128GB ext4 primary
(parted) rm 1
(parted) quit
pi@raspberrypi:~ $ sudo parted -a optimal /dev/sda mkpart primary ext4 0% 100%
パーティションが作成されたことを確認
pi@raspberrypi:~ $ sudo fdisk -l
pi@raspberrypi:~ $ sudo mkfs -t ext4 -L DATA-ext4 /dev/sda1
pi@raspberrypi:~ $ sudo mkdir /mnt/data
pi@raspberrypi:~ $ sudo mount /dev/sda1 /mnt/data
pi@raspberrypi:~ $ sudo blkid
/dev/sda1: LABEL="DATA-ext4" UUID="01a4cd5d-618b-4dc4-a645-1e4aa12cca5b" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="primary" PARTUUID="37096080-0e06-4a7a-b1c8-54012cdab042"
pi@raspberrypi:~ $ sudo vi /etc/fstab
UUID="r50e4-e715-4de2-b5c9-371b50" /mnt/data ext4 defaults,nofail 0 0
pi@raspberrypi:~ $ sudo reboot
pi@raspberrypi:~ $ sudo apt -y install ffmpeg
ffmpeg -y \
-hide_banner \
-fflags +discardcorrupt \
-i "test.m2ts" \
-sn \
-c:v h264_v4l2m2m \
-b:v 4M \
-num_capture_buffers 64 \
-vf yadif=0:-1:1,scale=-1:720 \
-vsync 1 -qmin 10 -qmax 51 -qdiff 8 -i_qfactor 1.40 -qcomp 0.6 \
-c:a copy \
-bsf:a aac_adtstoasc \
-f mp4 \
https://github.com/l3tnun/EPGStation/blob/master/doc/linux-setup.md
pi@raspberrypi:~ $ git clone https://github.com/l3tnun/EPGStation.git
pi@raspberrypi:~ $ cd EPGStation
pi@raspberrypi:~ $ npm run all-install
pi@raspberrypi:~ $ sudo npm run build
pi@raspberrypi:~ $ cp config/config.yml.template config/config.yml
pi@raspberrypi:~ $ cp config/operatorLogConfig.sample.yml config/operatorLogConfig.yml
pi@raspberrypi:~ $ cp config/epgUpdaterLogConfig.sample.yml config/epgUpdaterLogConfig.yml
pi@raspberrypi:~ $ cp config/serviceLogConfig.sample.yml config/serviceLogConfig.yml
pi@raspberrypi:~ $ cp config/enc.js.template config/enc.js
pi@raspberrypi:~ $ vi config/config.yml
recorded:
- name: recorded
path: '/mnt/data/recorded'
~~
ffmpeg: /usr/bin/ffmpeg
libx264 を h264_v4l2m2m に置換
pi@raspberrypi:~ $ config/config.yml
libx264 を h264_v4l2m2m に置換と追加
pi@raspberrypi:~ $ vi config/enc.js
// コーデックを変更
//const codec = 'libx264';
const codec = 'h264_v4l2m2m';
// その他設定
Array.prototype.push.apply(args,[
'-preset', preset,
'-aspect', '16:9',
'-c:v', codec,
'-crf', crf,
'-b:v', '3M', // ビットレートの指定が必要らしいので追加。
'-f', 'mp4',
'-c:a', 'aac',
'-ar', '48000',
'-ab', audioBitrate,
'-ac', '2',
output
]);
sudo pm2 startup -u pi --hp ~pi
pm2 start dist/server/index.js --name "epgstation"
pm2 save
pi@raspberrypi:~ $ pm2 status
┌────┬────────────────────┬──────────┬──────┬───────────┬──────────┬──────────┐
│ id │ name │ mode │ ↺ │ status │ cpu │ memory │
├────┼────────────────────┼──────────┼──────┼───────────┼──────────┼──────────┤
│ 0 │ epgstation │ fork │ 0 │ online │ 0% │ 84.8mb │
└────┴────────────────────┴──────────┴──────┴───────────┴──────────┴──────────┘