LoginSignup
4
10

More than 1 year has passed since last update.

Raspberry Pi に rtmp サーバーを立てる

Last updated at Posted at 2018-03-02

Raspberry Pi に rtmp ストリーミングサーバーを立てる方法です。
端末名は、violet.local とします。

ソフトのインストール

sudo apt install nginx-full
sudo apt install libnginx-mod-rtmp

バージョンの確認

$ nginx -v
nginx version: nginx/1.18.0

$ nginx -V
nginx version: nginx/1.18.0
built with OpenSSL 1.1.1n  15 Mar 2022
TLS SNI support enabled

Nginx を起動

sudo systemctl start nginx

ブラウザーで http://violet.local にアクセスすると、
/var/www/html/index.nginx-debian.html が表示される
image.png

停止

sudo systemctl stop nginx

状態を調べる

sudo systemctl status nginx

/etc/nginx/nginx.conf の最後に次の設定をつける

rtmp {
        server {
                listen 1935;
                chunk_size 4096;

                application live {
                play /var/www/nginx/html/video;
                        live on;
                        record off;
                }
        }
}

mp4 を保存するフォルダーを作成

sudo chmod 0777 /var/www/nginx/html
mkdir /var/www/nginx/html/video

/var/www/nginx/html/video にサンプルの *.mp4 を入れる

Nginx を 起動する

curl で確認

curl -o tmp01.mp4 rtmp://violet.local/live/sample.mp4

vlc でネットワーク越しに確認

vlc rtmp://violet.local/live/sample.mp4

次のバージョンで確認しました。

$ uname -a
Linux violet 5.15.32-v8+ #1538 SMP PREEMPT Thu Mar 31 19:40:39 BST 2022 aarch64 GNU/Linux
4
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
10