Install Nginx with RTMP module in Ubuntu 12.04 x64 LTS

# 安裝必要套件
apt-get install build-essential libpcre3 libpcre3-dev libssl-dev

# 下載 tar 安裝檔案
cd /tmp
wget http://nginx.org/download/nginx-1.7.3.tar.gz
wget https://github.com/arut/nginx-rtmp-module/archive/master.zip

# 安裝 nginx
tar -zxvf nginx-1.7.3.tar.gz 
unzip master.zip 
cd nginx-1.7.3/
./configure --with-http_ssl_module --with-http_xslt_module --add-module=../nginx-rtmp-module-master
make
make install

# 編輯 nginx 設定檔案
vim /usr/local/nginx/conf/nginx.conf
rtmp {
        server {
                listen 1935;
                chunk_size 4096;

                application live {
                        live on;
                        record off;
                }
        }
}

# 啟動 nginx service
/usr/local/nginx/sbin/nginx

此時可使用 OBS 傳送Stremaing進行測試
OBS設定 => 廣播
模式:直播串流
串流服務:Custom
伺服器:rtmp://[nginx 伺服器ip]/live
播放路徑:test

便可以透過VLC或是Flash player以下面連結進行播放
rtmp://[nginx 伺服器ip]/live

內嵌Flash Player的網頁範例如下




  
  Video.js RTMP Example - jsFiddle demo
  
  
   


  


This entry was posted in Nginx, RTMP, Ubuntu. Bookmark the permalink.