appleTV が動かない
AppleTV(第3世代)とAppleTV(第2世代)でミラーリングしていたけど、先日、ついに動かなくなった。
ミラーリングメニューがiOSから出たり出なかったり、ミラーリング選択をしても映ったり映らなかったり。つまりAppleTVを初期化してもまともに動かなくなった。後方互換性を切り捨てるAppleさんですが、やはりインフラとしては不安定すぎて困る。
Raspi でミラーリング
Raspi3でミラーリングすることにした。
FireTVやAndroidスマホでは、ミラーリングができるソフトウェアがちらほらみられるので、Raspiにもないかなと探してみた。
RPiplayがあった。
配布元。 https://github.com/FD-/RPiPlay
インストールとビルド
rm -rf RPiPlay.git git clone https://github.com/FD-/RPiPlay.git mv RPiPlay RPiPlay.git cd RPiPlay.git sudo apt install cmake libavahi-compat-libdnssd-dev libplist-dev libssl-dev mkdir build cd build cmake .. make -j sudo ln rpiplay /usr/local/bin/
apt にはないし、deb作成もないので、とにかく動くって感じだとおもう。OSアップデート追従しないので注意が必要
動作チェック
/usr/local/bin/rpiplay -n AirPiPlay -b auto -a hdmi -vr rpi -ar rpi -l
-l
オプション で低レイテンシに対応させないとサウンド(音声)が同期ズレを起こして使い物にならなかった。
ただ、-l
低レイテンシ対応させると、操作後のズレが気にはなるが、音が破壊されるよりはマシ。
-l
の有無は、ネットワーク環境と機器性能に依存すると思う。私の環境(Raspi3)では低レイテンシにしたほうが安定した。
コマンドオプションはこちら
RPiPlay 1.2: An open-source AirPlay mirroring server for Raspberry Pi Usage: /usr/local/bin/rpiplay [-n name] [-b (on|auto|off)] [-r (90|180|270)] [-l] [-a (hdmi|analog|off)] [-vr renderer] [-ar renderer] Options: -n name Specify the network name of the AirPlay server -b (on|auto|off) Show black background always, only during active connection, or never -r (90|180|270) Specify image rotation in multiples of 90 degrees -f (horiz|vert|both) Specify image flipping (horiz = horizontal, vert = vertical, both = both) -l Enable low-latency mode (disables render clock) -a (hdmi|analog|off) Set audio output device -vr renderer Set video renderer to use. Available renderers: rpi: Raspberry Pi OpenMAX accelerated H.264 renderer [Default] dummy: Dummy renderer; does not actually display video -ar renderer Set audio renderer to use. Available renderers: rpi: AAC renderer using fdk-aac for decoding and OpenMAX for rendering [Default] dummy: Dummy renderer; does not actually play audio -d Enable debug logging -v/-h Displays this help and version information
systemdでサービスにした
[Unit] Description=AirTunes ミラーリング receiver Documentation=https://github.com/FD-/RPiPlay After=sound.target Requires=avahi-daemon.service After=avahi-daemon.service [Service] Type=simple Restart=on-failure ExecStart=/usr/local/bin/rpiplay -n AirPiPlay -b auto -a hdmi -vr rpi -ar rpi -l #User=takuya #Group=takuya [Install] WantedBy=multi-user.target
Airplay1,2 のバージョン
Airplay2 は使えないので、アプリ内からのミラーリング指定・ボリュームからの出力指定ができない。基本的に「ミラーリング」だけである。
将来的に使えなくなるとは思うが、あと数年は行けるかなと思う。
https://github.com/FD-/RPiPlay#airplay-protocol-versions