ubuntu搭建推流服務器Nginx+rtmp [論壇 - Ubuntu 哈啦]
正在瀏覽:
1 名遊客
回覆: ubuntu搭建推流服務器Nginx+rtmp |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員二級
![]() ![]() 註冊日期:
2017/7/1 0:41 所屬群組:
已註冊使用者 等級: 7
HP : 0 / 152
![]() |
大大#30已經可以用vlc已經可以播放了……謝謝大大
大大如果 $ sudo vi /usr/local/nginx/conf/nginx.conf 更改 rtmp { server { listen 1935; chunk_size 4096; application live { live on; record off; } application live2 { live on; record off; } # video on demand application vod { play /home/wjfadiwjf/user/Videos/hls/video; } application vod_http { play http://192.168.43.168/vod; } application hls { live on; hls on; hls_path /tmp/hls; } } } # HTTP can be used for accessing RTMP stats http { server { listen 8080; # This URL provides RTMP statistics in XML location /stat { rtmp_stat all; # Use this stylesheet to view XML as web page # in browser rtmp_stat_stylesheet stat.xsl; } location /stat.xsl { # XML stylesheet to view RTMP stats. # Copy stat.xsl wherever you want # and put the full directory path here root /path/to/stat.xsl/; } location /hls { # Serve HLS fragments types { application/vnd.apple.mpegurl m3u8; video/mp2t ts; } root /tmp; add_header Cache-Control no-cache; } location /dash { # Serve DASH fragments root /tmp; add_header Cache-Control no-cache; } } } 我要如何下指令才能使用 $ffmpeg -re -i /home/wjfadiwjf/user/Videos/hls/video/test2.mp4 -c copy -f flv rtmp://localhost:2016/hls_alic/film
2017/7/28 23:22
|
||||||||||
![]() |
回覆: ubuntu搭建推流服務器Nginx+rtmp |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員五級
![]() ![]() 註冊日期:
2012/4/22 10:50 所屬群組:
已註冊使用者 等級: 36
HP : 179 / 895
![]() |
jbyziag 寫到: 恭喜您已經跨過了一個門檻了。 目前我對這個議題沒有再去深究, 這部份就留給您再去研究琢磨, 研究每個設定指令,會達到什麼效果, 當您了解了,也許您會有靈感,可以融會貫通,組合成您自己想要的功能。 也或許其他人,對這部份有興趣一起研究的人,也可以加入一起討論。 ![]() * https://github.com/arut/nginx-rtmp-module / Wiki * http://nginx-rtmp.blogspot.tw/ * https://nginx.org/en/ * https://github.com/nginx/nginx jbyziag 寫到:
2017/7/29 12:34
|
||||||||||
![]() |
回覆: ubuntu搭建推流服務器Nginx+rtmp |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員二級
![]() ![]() 註冊日期:
2017/7/1 0:41 所屬群組:
已註冊使用者 等級: 7
HP : 0 / 152
![]() |
大大如果我更改
sudo vi /usr/local/nginx/conf/nginx.conf 共放四個影片.... 我如何下指令同時推四個流……… $ffmpeg -re -i /home/wjfadiwjf/user/Videos/hls/video/test.mp4 -c copy -f flv rtmp://localhost:2016/hls_alic/film 麻煩大大………謝謝
2017/7/29 13:30
|
||||||||||
![]() |
回覆: ubuntu搭建推流服務器Nginx+rtmp |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員五級
![]() ![]() 註冊日期:
2012/4/22 10:50 所屬群組:
已註冊使用者 等級: 36
HP : 179 / 895
![]() |
jbyziag 寫到: 您可以嘗試著自己動手做一些實驗,也許您會有一些新的發現 ================================================================================ 先執行
再執行下面指令觀看
================================================================================ 先執行
再執行下面指令觀看
================================================================================ 先執行
再執行下面指令觀看
================================================================================ 先執行
再執行下面指令觀看
================================================================================ 若要同時執行
更多請參考「鳥哥的 Linux 私房菜 / 第十六章、程序管理與 SELinux 初探 / 16.2.2 job control 的管理 / 直接將指令丟到背景中『執行』的 &」 ================================================================================ ## 額外議題 * 查詢「linux screen」 * 查詢「linux tmux」 * 查詢「linux byobu」 ================================================================================ 以上提供參考 報告完畢 ![]() ================================================================================ 後記 (2017-08-20) : 在「#62」有更多的補充說明。 ================================================================================
2017/7/29 16:13
|
||||||||||
![]() |
回覆: ubuntu搭建推流服務器Nginx+rtmp |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員二級
![]() ![]() 註冊日期:
2017/7/1 0:41 所屬群組:
已註冊使用者 等級: 7
HP : 0 / 152
![]() |
謝謝大大....已經可以使用了
這幾個星期謝謝大大教我... 可以麻煩大大,站內有別人有研究#31。可以介紹在那裡...因為大大介紹多是國外...很難像大大有耐心教我...
2017/7/29 18:38
|
||||||||||
![]() |
回覆: ubuntu搭建推流服務器Nginx+rtmp |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員二級
![]() ![]() 註冊日期:
2017/7/1 0:41 所屬群組:
已註冊使用者 等級: 7
HP : 0 / 152
![]() |
worker_processes 1;
events { worker_connections 1024; } rtmp { #RTMP服務 server { listen 1935; #//服務端口 chunk_size 4096; #//數據傳輸塊的大小 application live { #//第一直播流 live on; record off; } application live2 { #//第二直播流 live on; record off; } # video on demand application vod { play /var/flvs; #//影片存放位置 } application vod_http { play http://192.168.43.78/vod; } application hls { live on; hls on; hls_path /tmp/hls; } } } # HTTP can be used for accessing RTMP stats http { server { listen 8080; # This URL provides RTMP statistics in XML location /stat { rtmp_stat all; # Use this stylesheet to view XML as web page # in browser rtmp_stat_stylesheet stat.xsl; } location /stat.xsl { # XML stylesheet to view RTMP stats. # Copy stat.xsl wherever you want # and put the full directory path here root /path/to/stat.xsl/; } location /hls { # Serve HLS fragments types { application/vnd.apple.mpegurl m3u8; video/mp2t ts; } root /tmp; add_header Cache-Control no-cache; } location /dash { # Serve DASH fragments root /tmp; add_header Cache-Control no-cache; } } } 已經可以推琉到ubuntu裡面了 大大可以告訴我,我要用VLC如何寫 http://192.168.43.78:8080.......m3u8
2017/8/1 22:55
|
||||||||||
![]() |
回覆: 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 可是我在這資料夾看不到像大大這樣,/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_alic/bbb 可以看 可是我用 VLC http://192.168.43.78:8080/hls/bbb 不能看 這是那裹出問題.....
2017/8/5 17:48
|
||||||||||
![]() |
回覆: ubuntu搭建推流服務器Nginx+rtmp |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員五級
![]() ![]() 註冊日期:
2012/4/22 10:50 所屬群組:
已註冊使用者 等級: 36
HP : 179 / 895
![]() |
jbyziag 寫到: ============================================================ jbyziag 寫到: 跟您設定的「hls_path」有關 ============================================================ jbyziag 寫到: 跟您設定的「http document root path」有關, 以及跟您設定的「hls_path」有關, 您可以再研究一下這兩個設定,各自分別是做什麼用的? 您理解了,您才有機會可以融會貫通,舉一反三。 另外,透過「http」,也就是透過「hls」這個協定,是要播「m3u8」那個檔, 請參考下面的「回覆#39」和「回覆#40」。 ============================================================ 我用手機,還沒看17.docx,所以先簡略的回覆您, 您可以先回頭參考之前的回覆「回覆#28」,「回覆#22」「回覆#19」。 ============================================================
2017/8/5 19:56
|
||||||||||
![]() |
回覆: ubuntu搭建推流服務器Nginx+rtmp |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員五級
![]() ![]() 註冊日期:
2012/4/22 10:50 所屬群組:
已註冊使用者 等級: 36
HP : 179 / 895
![]() |
從您「回覆#37」提供的「17.docx」
截取您設定的「nginx.conf」 rtmp { server { listen 2016; #推流其二 application hls { live on; hls on; hls_path /home/wjf/hls/www; 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/5 22:56
|
||||||||||
![]() |
回覆: ubuntu搭建推流服務器Nginx+rtmp |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
會員五級
![]() ![]() 註冊日期:
2012/4/22 10:50 所屬群組:
已註冊使用者 等級: 36
HP : 179 / 895
![]() |
假設您安裝「nginx」到「/usr/local/nginx」這個路徑。
延續「回覆#39」,您可以修改成下面的設定來練習 ## nginx.conf rtmp { server { listen 2016; #推流其二 application hls { live on; hls on; hls_path /usr/local/nginx/html/hls; hls_fragment 5s; } } } 和 http { server { #listen 80; listen 8080; server_name localhost; location / { root html; index index.html index.htm; } } } ============================================================================================ 執行
則會陸續產生
============================================================================================ 透過「rtmp」這個協定來觀看
============================================================================================ 透過「hls」這個協定來觀看
============================================================================================ 這個範例的設定概念, 是跟我之前寫的「另一個範例」的設定概念是一樣的。 您要練習分辨的是
您可以對照「#39」和「#40」這兩個範例的設定。 還有「回覆#37」提到的參考回覆。
2017/8/5 23:14
|
||||||||||
![]() |
您可以查看帖子.
您不可發帖.
您不可回覆.
您不可編輯自己的帖子.
您不可刪除自己的帖子.
您不可發起投票調查.
您不可在投票調查中投票.
您不可上傳附件.
您不可不經審核直接發帖.