Nginx rtmp-module でpull設定してみる。
pull は引っ張る。push が押し出す(相手側に送り付ける)に対して、受け側が引っ張り出す事に起因した映像配信になる。
https://github.com/arut/nginx-rtmp-module/wiki/Directives#pull
Creates pull relay. Stream is pulled from remote machine and becomes available locally. It only happens when at least one player is playing the stream locally.
リモートマシンからアクセス要求がきてから、映像配信が始まる。
構築は結構簡単。
A:エンコーダ(Bにpushする)
B:映像配信サーバ nginx01(通常通りの設定)
C:映像配信サーバ nginx02(Bからpullする)
pull で、映像配信しているrtmp urlを記載するのみで。
pull rtmp://nginx01/live/test
で、ストリーム名のtest 部分はそのまま引き継がれる。application名のlive 部分は任意に決める事ができる。
rtmp { server { listen 1935; access_log logs/rtmp_access.log; publish_notify on; drop_idle_publisher 5s; buflen 30s; application live { live on; pull rtmp://サーバIPアドレス/live/test; } } }