ubuntu搭建推流服務器Nginx+rtmp [論壇 - Ubuntu 哈啦]
正在瀏覽:
1 名遊客
回覆: ubuntu搭建推流服務器Nginx+rtmp |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員五級
![]() ![]() 註冊日期:
2012/4/22 10:50 所屬群組:
已註冊使用者 等級: 35
HP : 172 / 861
![]() |
更多範例,供您對照練習
## nginx.conf rtmp { server { listen 2016; #推流其二 application hls { live on; hls on; hls_path /home/wjf/hls/www/hls; hls_fragment 5s; } } } 和 http { server { #listen 80; listen 8080; server_name localhost; location / { #root html; root /home/wjf/hls/www; index index.html index.htm; } } } ============================================================================================ 執行
則會陸續產生
============================================================================================ 透過「rtmp」這個協定來觀看
============================================================================================ 透過「hls」這個協定來觀看
============================================================================================
2017/8/6 2:26
|
||||||||||
![]() |
回覆: ubuntu搭建推流服務器Nginx+rtmp |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員五級
![]() ![]() 註冊日期:
2012/4/22 10:50 所屬群組:
已註冊使用者 等級: 35
HP : 172 / 861
![]() |
更多範例,供您對照練習
## nginx.conf rtmp { server { listen 2016; #推流其二 application ccc { live on; hls on; hls_path /home/wjf/hls/www/aaa; hls_fragment 5s; } } } 和 http { server { #listen 80; listen 8080; server_name localhost; location / { #root html; root /home/wjf/hls/www; index index.html index.htm; } } } ============================================================================================ 執行
則會陸續產生
============================================================================================ 透過「rtmp」這個協定來觀看
============================================================================================ 透過「hls」這個協定來觀看
============================================================================================
2017/8/6 2:37
|
||||||||||
![]() |
回覆: ubuntu搭建推流服務器Nginx+rtmp |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員五級
![]() ![]() 註冊日期:
2012/4/22 10:50 所屬群組:
已註冊使用者 等級: 35
HP : 172 / 861
![]() |
更多範例,供您對照練習
## nginx.conf rtmp { server { listen 2016; #推流其二 application ccc { live on; hls on; hls_path /home/wjf/hls/tmp; hls_fragment 5s; } } } 和 http { server { #listen 80; listen 8080; server_name localhost; location / { #root html; root /home/wjf/hls/www; index index.html index.htm; } location /aaa { alias /home/wjf/hls/tmp; } } } ============================================================================================ 執行
則會陸續產生
============================================================================================ 透過「rtmp」這個協定來觀看
============================================================================================ 透過「hls」這個協定來觀看
============================================================================================ ## 相關文件 ### Nginx Documentation * Beginner’s Guide ### Nginx Directives * location * root * alias ### Nginx RTMP Documentation * Getting started with nginx rtmp ### Nginx RTMP Directives * hls_path ============================================================================================
2017/8/6 20:11
|
||||||||||
![]() |
回覆: ubuntu搭建推流服務器Nginx+rtmp |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員二級
![]() ![]() 註冊日期:
2017/7/1 0:41 所屬群組:
已註冊使用者 等級: 7
HP : 0 / 152
![]() |
大大幫我看一下問題出在那裏…
$ mkdir nginx-src $ cd nginx-src $ git clone https://github.com/nginx/nginx.git $ git clone https://github.com/arut/nginx-rtmp-module.git $ wget -c https://ftp.pcre.org/pub/pcre/pcre-8.39.tar.gz $ tar -xzvf pcre-8.39.tar.gz $ cd nginx $ git checkout release-1.9.9 ‧ ‧ ‧ ‧ ‧ ‧ 可是我在這資料夾看不到像大大這樣,/home/wjf/hls/www/一直增加 /home/wjf/hls/www/bbb-0.ts /home/wjf/hls/www/bbb-1.ts /home/wjf/hls/www/bbb-2.ts /home/wjf/hls/www/bbb-3.ts /home/wjf/hls/www/bbb-4.ts /home/wjf/hls/www/bbb-5.ts ... /home/wjf/hls/www/bbb.m3u8 可是我用 VLC rtmp://192.168.43.78:2016/hls/bbb 可以觀看 可是我用 VLC http://192.168.43.78:8080/hls/bbb 不能觀看 這我重新安裝新Ubuntu 16.04 LTS伺服器版本 設定的「http document root path」有關, 以及跟您設定的「hls_path」有關,不知在那裹……大大可以告知我嗎? 這是那裹出問題..... 附件: ![]() ![]() ![]()
2017/8/6 22:04
|
||||||||||
![]() |
回覆: ubuntu搭建推流服務器Nginx+rtmp |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員五級
![]() ![]() 註冊日期:
2012/4/22 10:50 所屬群組:
已註冊使用者 等級: 35
HP : 172 / 861
![]() |
jbyziag 寫到: ================================================================================ 首先,我在「#39」, 有針對您「#37」提到的問題,給您相關的關鍵部份了, 您可以再回頭研究「#39」。 ================================================================================ 除了「#39」這個範例, 另外還有 *「#40」, *「#41」, *「#42」, *「#43」, 這幾個範例供您學習對照用。 ================================================================================ 待續...
2017/8/7 10:02
|
||||||||||
![]() |
回覆: ubuntu搭建推流服務器Nginx+rtmp |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員五級
![]() ![]() 註冊日期:
2012/4/22 10:50 所屬群組:
已註冊使用者 等級: 35
HP : 172 / 861
![]() |
jbyziag 寫到:samwhelp 寫到: 上面我提到的「設定」,指的是「nginx.conf」, 您安裝「nginx」在「/usr/local/nginx」, 所以您可以在「/usr/local/nginx/conf/nginx.conf」找到「nginx.conf」。 ================================================================================ 關於 jbyziag 寫到:samwhelp 寫到: 您可以參考「#39」,其中有一段如下 -------------------------------------------------------------------------------- 從您「回覆#37」提供的「17.docx」 截取您設定的「nginx.conf」 rtmp { server { listen 2016; #推流其二 application hls { live on; hls on; hls_path /home/wjf/hls/www; hls_fragment 5s; } } } -------------------------------------------------------------------------------- 請注意上面有一行「hls_path /home/wjf/hls/www;」, ================================================================================ 我原本在「#43」下方有列關鍵的「Nginx RTMP Directives」, 我在剛剛上面的設定,每個「Directive」都加上連結了,您就可以直接連過去,對照著看, ## Nginx RTMP Directives * application * live * hls * hls_path * hls_fragment ================================================================================ ## 相關文件 * Getting started with nginx rtmp ================================================================================ ## 相關文章 * 查詢「hls」,可以找到一篇「直播協議 hls 筆記」 ================================================================================ 待續...
2017/8/7 10:05
|
||||||||||
![]() |
回覆: ubuntu搭建推流服務器Nginx+rtmp |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員五級
![]() ![]() 註冊日期:
2012/4/22 10:50 所屬群組:
已註冊使用者 等級: 35
HP : 172 / 861
![]() |
關於
jbyziag 寫到:samwhelp 寫到: 您可以參考「#39」, -------------------------------------------------------------------------------- http { server { #listen 80; listen 8080; server_name localhost; location / { #root html; root /home/wjf/hls/www; index index.html index.htm; } } } -------------------------------------------------------------------------------- 請注意,上面有一段如下 location / { #root html; root /home/wjf/hls/www; index index.html index.htm; } ================================================================================ 我原本在「#43」下方有列關鍵的「Nginx Directives」, 我在剛剛上面的設定,每個「Directive」都加上連結了,您就可以直接連過去,對照著看, ## Nginx Directive * http * server * listen * server_name * location * root * index ================================================================================ ## 相關文件 * Nginx Documentation / Beginner’s Guide / Serving Static Content ================================================================================ ## 相關回覆 * 回覆#19 ================================================================================ ## 相關範例 * concept-document-root-php * concept-document-root-nginx ================================================================================ 待續...
2017/8/7 10:15
|
||||||||||
![]() |
回覆: ubuntu搭建推流服務器Nginx+rtmp |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員五級
![]() ![]() 註冊日期:
2012/4/22 10:50 所屬群組:
已註冊使用者 等級: 35
HP : 172 / 861
![]() |
關於
jbyziag 寫到: 請對照「#39」, 我有列觀看的範例如下 -------------------------------------------------------------------------------- 透過「rtmp」這個協定來觀看
透過「hls」這個協定來觀看
-------------------------------------------------------------------------------- 您可以比對如下, 您下的指令
我列的指令
首先第一個不一樣的, 您的是「bbb」,我的是「bbb.m3u8」, ================================================================================ 接下來,我認為您要著重學習的基礎概念, 就是『您需要瞭解「 http://192.168.43.78:8080/bbb.m3u8 」,代表什麼意義』, 這樣您才不會陷入五里雲霧之中,摸不著頭緒。 從您的提供的設定 http { server { #listen 80; listen 8080; server_name localhost; location / { #root html; root /home/wjf/hls/www; index index.html index.htm; } } } -------------------------------------------------------------------------------- 請注意,上面有一段如下 location / { #root html; root /home/wjf/hls/www; index index.html index.htm; } 可以看到您設定的「DocumentRoot Path」是「/home/wjf/hls/www」這個路徑。 所以「http://192.168.43.78:8080/bbb.m3u8」這個網址, 對照到您的檔案系統,指的就是「/home/wjf/hls/www/bbb.m3u8」這個路徑, 以此類推, 您原本提到的「http://192.168.43.78:8080/hls/bbb」這個網址, 對照到您的檔案系統,指的就是「/home/wjf/hls/www/hls/bbb」這個路徑, 以下舉更多的例子 網址:「http://192.168.43.78:8080/about.html」 路徑:「/home/wjf/hls/www/about.html」 網址:「http://192.168.43.78:8080/blog/article.html」 路徑:「/home/wjf/hls/www/blog/article.html」 這個概念,可以參考我在「#19」提到的「範例」。 或是也可以參考「Nginx Documentation / Beginner’s Guide / Serving Static Content」。 還有也可以參考「location」和「root」以及「alias」這幾個「Niginx Directive」。 ================================================================================ 待續...
2017/8/7 10:22
|
||||||||||
![]() |
回覆: ubuntu搭建推流服務器Nginx+rtmp |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員五級
![]() ![]() 註冊日期:
2012/4/22 10:50 所屬群組:
已註冊使用者 等級: 35
HP : 172 / 861
![]() |
關於
jbyziag 寫到: 我在您「回覆#37」提供的「17.docx」 看到您的「Filezilla」, 在「/home/wjf/hls/www/」, 有跑出來「bbb-0.ts」,「bbb-1.ts」,「bbb.m3u8」。 ================================================================================ 不過在您「回覆#44」提供的「19.docx」。 從您的「Filezilla」來看, 在「/home/wjf/hls/www/」, 是沒有看到「bbb-0.ts」,「bbb-1.ts」,「bbb.m3u8」。 您可以「重新整理」,再確認看看,檔案是否有跑出來,因為檔案是陸續產生的。 ================================================================================ 您也可以執行下面的指令來觀看,不見得要使用「Filezilla」。
================================================================================ 您可以再對照「#39」,您再研究看看。 當您設定的「nginx.conf」,其中有下面這一段 rtmp { server { listen 2016; #推流其二 application hls { live on; hls on; hls_path /home/wjf/hls/www; hls_fragment 5s; } } } ============================================================================================ 執行
則會陸續產生下面列的檔案
================================================================================ 以上釐清 報告完畢 ![]()
2017/8/7 10:28
|
||||||||||
![]() |
回覆: ubuntu搭建推流服務器Nginx+rtmp |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員二級
![]() ![]() 註冊日期:
2017/7/1 0:41 所屬群組:
已註冊使用者 等級: 7
HP : 0 / 152
![]() |
大大,剛才有注意看了。是我下錯指令了………謝謝
$ ffmpeg -re -i /home/wjf/hls/video/test.mp4 -c copy -f flv rtmp://192.168.43.78:2016/hls/bbb 大大我還有些問題,我現在多是在同一個系服器上使用。我可以把流推到別台伺服器上嗎?如內網192.168.43.20:2016/hls/bbb或外網45.76.186.39:2016/hls/bbb呢?
2017/8/7 21:52
|
||||||||||
![]() |
您可以查看帖子.
您不可發帖.
您不可回覆.
您不可編輯自己的帖子.
您不可刪除自己的帖子.
您不可發起投票調查.
您不可在投票調查中投票.
您不可上傳附件.
您不可不經審核直接發帖.