Chinachuをインストール
録画ソフトにchinachuを使う。
chinachuはオープンソースなのでフリーで使えるよ!タダだよ、タダ!無料!
wiki通りにやれば簡単にインストールできた。
インストール
必要なパッケージをインストール。
sudo apt-get install build-essential curl git-core libssl-dev yasm libtool autoconf libboost-all-dev
実行ユーザーを作る。
sudo adduser chinachu
管理者権限を持ったユーザでchinachuをvideoグループに追加しておく。
sudo gpasswd -a chinachu video
作った実行ユーザでログイン。
su chinachu
Gitリポジトリからクローン、インストール。
git clone git://github.com/kanreisa/Chinachu.git ~/chinachu
cd ~/chinachu/
./chinachu installer
下記のメニューが出るので"Auto“を選択。
Chinachu Installer Menu:
[!] These are installed under all /home/chinachu/chinachu/...
[!] Recommend the Auto installation.
1) Auto (full) 5) Node.js Modules 9) libfdk-aac
2) Auto (fast) 6) epgdump 10) libogg
3) submodule 7) libx264 11) libvorbis
4) Node.js Environment 8) libvpx 12) ffmpeg
what do you install? >
9のlibfdk-aacで失敗した。
Can’t exec “aclocal”: No such file or directory でこけた。
どうやらautomakeが足りないらしいので管理者権限持ってるユーザでautomakeをインストール。
sudo apt-get install automake
再度インストーラを起動して9から別々にインストールしていく。
./chinachu installer
インストール完了!
設定ファイルをいじっていく。
cp config.sample.json config.json
vi config.json
どうせローカルからしかアクセスできないようにするのでパスとかはいらないようにした。
recordedFormatでカテゴリー別にフォルダ分けするように設定。
{
"recordedDir" : "録画ファイルを格納するディレクトリ",
"temporaryDir": "/tmp/",
"wuiUsers": [
],
"wuiAllowCountries": ["JP"],
"wuiPort" : 10772,
"wuiHost" : "0.0.0.0",
"wuiTlsKeyPath" : null,
"wuiTlsCertPath" : null,
"wuiOpenServer" : true,
"wuiOpenPort" : 20772,
"wuiXFF" : false,
"wuiPreviewer" : true,
"wuiStreamer" : true,
"wuiFiler" : true,
"wuiConfigurator": true,
"recordedFormat": "<category>/<title>/[<date:yymmdd-HHMM>]<fulltitle> - <subtitle>.m2ts",
"tuners": [
{
"name" : "FSUSB2",
"isScrambling": false,
"types" : [ "GR" ],
"command" : "recfsusb2n --b25 --sid hd <channel> - -"
}
],
"channels": [
{ "type": "GR", "channel": "37" },
{ "type": "GR", "channel": "38" },
{ "type": "GR", "channel": "39" },
{ "type": "GR", "channel": "40" },
{ "type": "GR", "channel": "41" },
{ "type": "GR", "channel": "42" },
{ "type": "GR", "channel": "43" },
{ "type": "GR", "channel": "44" },
{ "type": "GR", "channel": "45" },
{ "type": "GR", "channel": "46" }
]
}
空のルール設定ファイルを作成。
echo [] > rules.json
動作チェック。
./chinachu service wui execute
# 問題なく起動できたらCtrl+Cで終了
./chinachu update -f
# EPG取得テスト
システムへのLSB Init Script設定。
./chinachu service operator initscript > /tmp/chinachu-operator
./chinachu service wui initscript > /tmp/chinachu-wui
sudo chown root:root /tmp/chinachu-operator /tmp/chinachu-wui
sudo chmod +x /tmp/chinachu-operator /tmp/chinachu-wui
sudo mv /tmp/chinachu-operator /tmp/chinachu-wui /etc/init.d/
sudo insserv chinachu-operator
sudo insserv chinachu-wui
再起動しておく。
サービスを開始。
sudo service chinachu-operator start
sudo service chinachu-wui start
ブラウザで http://192.168.XXX.XXX:10772 にアクセス。
みれたー!
試しにコナンを録画中。
撮れてる撮れてる。
あとはCM自動カットなどできたらいいなー
追記
少し稼働していると以下のエラーでたまに録画失敗しているときがあった。
※エラー内容をメモするの忘れたのでうろ覚え
Error: spawn ENOMEM
at exports._errnoException (util.js:746:11)
at ChildProcess.spawn (child_process.js:1155:11)
~ 以下略 ~
Node.jsの子プロセスを作成するところで落ちているっぽい。
色々調べてるとメモリが足りないようで。
Raspberry Pi 2 Model Bのメモリは1GBだがGPU共有とのこと。
実際にメモリの割り当てを見ると、1/4はGPUに使われていた。
そこで、Raspberry Piには最初からswap領域が割り当てられてなかったので追加する。
dd if=/dev/zero of=/swapfile bs=1M count=1024
mkswap /swapfile
swapon /swapfile
起動時に自動でマウントするように/etc/fstabに追加する。
vi /etc/fstab
最終行に下記を追記。
/swapfile swap swap defaults 0 0
とりあえずこれでエラーは出なくなったので良しとしよう。