ブラウザを開かずにshowroomを視聴する


ブラウザを開かずにshowroom liveを視聴する方法はないかなぁ・・・と調べて見たら、livestreamを使い視聴するためのscriptを発見。fcicq/showroomlive.sh

ただ、これはそのままではshowroomの仕様変更に対応しておらず使えない。また、livestreamは現在メンテナンスされておらずstreamlinkを使え、と書いてある。

streamlinkはpythonインストールとか考えなくても使えるようなWindows用バイナリが用意されているため、簡単に実験ができそうだったので試してみた。

とりあえずstreamlinkをインストールして、showroom liveの配信やってるページに出てくる.m3u8ファイルを与えてみると・・・

C:\Program Files (x86)\Streamlink\bin>streamlink.exe https://edge-210-140-227-26.showroom-live.com/liveedge/52e66cae6b58a08641bd702e091c7f94fee147899da1a714c38312bab75ea7f0/chunklist_w791438536.m3u8
[cli][info] Found matching plugin hls for URL https://edge-210-140-227-26.showroom-live.com/liveedge/52e66cae6b58a08641bd702e091c7f94fee147899da1a714c38312bab75ea7f0/chunklist_w791438536.m3u8
Available streams: live (worst, best)

C:\Program Files (x86)\Streamlink\bin>

高画質(best)/低画質(worst)の選択を求められた。

C:\Program Files (x86)\Streamlink\bin>streamlink.exe https://edge-210-140-227-26.showroom-live.com/liveedge/52e66cae6b58a08641bd702e091c7f94fee147899da1a714c38312bab75ea7f0/chunklist_w791438536.m3u8 worst
[cli][info] Found matching plugin hls for URL https://edge-210-140-227-26.showroom-live.com/liveedge/52e66cae6b58a08641bd702e091c7f94fee147899da1a714c38312bab75ea7f0/chunklist_w791438536.m3u8
[cli][info] Available streams: live (worst, best)
[cli][info] Opening stream: live (hls)
error: The default player (VLC) does not seem to be installed. You must specify the path to a player executable with --player.
[cli][info] Closing currently open stream...

C:\Program Files (x86)\Streamlink\bin>

VLCを使って動画再生を開始しようとしたが、VLCがインストールされていないため失敗した。

そこでVLCをインストールしてから再度実行してみると、こんどはVLCアプリが起動して再生が始まった。

C:\Program Files (x86)\Streamlink\bin>streamlink.exe https://edge-210-140-227-26.showroom-live.com/liveedge/52e66cae6b58a08641bd702e091c7f94fee147899da1a714c38312bab75ea7f0/chunklist_w791438536.m3u8 worst
[cli][info] Found matching plugin hls for URL https://edge-210-140-227-26.showroom-live.com/liveedge/52e66cae6b58a08641bd702e091c7f94fee147899da1a714c38312bab75ea7f0/chunklist_w791438536.m3u8
[cli][info] Available streams: live (worst, best)
[cli][info] Opening stream: live (hls)
[cli][info] Starting player: "C:\Program Files\VideoLAN\VLC\vlc.exe"
[cli][info] Player closed
[cli][info] Stream ended
[cli][info] Closing currently open stream...

C:\Program Files (x86)\Streamlink\bin>

(上記のログはVLCの終了までを含む)

さらにいろいろ実験中、うっかりとstreamlinkに対してルームのURLそのものを渡してしまったところ、何事もないかの表示表示された。

C:\Program Files (x86)\Streamlink\bin>streamlink.exe https://www.showroom-live.com/sena-hiiragi
[cli][info] Found matching plugin showroom for URL https://www.showroom-live.com/sena-hiiragi
Available streams: 144p (worst), low, 360p, high (best)

C:\Program Files (x86)\Streamlink\bin>
C:\Program Files (x86)\Streamlink\bin>streamlink.exe https://www.showroom-live.com/sena-hiiragi best
[cli][info] Found matching plugin showroom for URL https://www.showroom-live.com/sena-hiiragi
[cli][info] Available streams: 144p (worst), low, 360p, high (best)
[cli][info] Opening stream: high (rtmp)
[cli][info] Starting player: "C:\Program Files\VideoLAN\VLC\vlc.exe"
[cli][info] Player closed
[cli][info] Stream ended
[cli][info] Closing currently open stream...

C:\Program Files (x86)\Streamlink\bin>

「Opening stream: high (rtmp)」となっているが、この形式はFlash Video形式となる。デフォルトでは「”rtmp,hls,hds,http,akamaihd,*”」という順序で優先順位を決めているので、MPEG4-TS形式で受信するには「–stream-types=hls」オプションをつけてhlsを指定する必要がある。

C:\Program Files (x86)\Streamlink\bin>streamlink.exe --stream-types=hls https://www.showroom-live.com/sena-hiiragi best
[cli][info] Found matching plugin showroom for URL https://www.showroom-live.com/sena-hiiragi
[cli][info] Available streams: 144p (worst), 360p (best)
[cli][info] Opening stream: 360p (hls)
[cli][info] Starting player: "C:\Program Files\VideoLAN\VLC\vlc.exe"
[cli][info] Player closed
[cli][info] Stream ended
[cli][info] Closing currently open stream...

C:\Program Files (x86)\Streamlink\bin>

よくみたら「streamlinkのpluginページ」にshowroomが対応していると掲載されていた。

他にabematv、 bilibili、 nhkworld、pixiv(sketch)が掲載されていて興味深い。

で・・・ここで調べたことを元に、showroom liveで目的とするルームの配信が始まったらVLCを起動して視聴開始するためのPowerShellスクリプトを実装してみた。

https://github.com/osakanataro/showroom-live

なぜPowerShellで組んだかといえば、WindowsとLinuxの両方で同じスクリプトを使いたかったからですね。

プラットフォームの違いを考慮しなければならない点がいくつかありましたが、まぁなんとかなりました。

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

このサイトはスパムを低減するために Akismet を使っています。コメントデータの処理方法の詳細はこちらをご覧ください