背景
現(xiàn)階段直播越來越流行,直播技術(shù)發(fā)展也越來越快。Webrtc、rtmp、rtsp是比較火熱的技術(shù),而且應(yīng)用也比較廣泛。本文通過實(shí)踐來展開介紹關(guān)于rtmp如何播放。
概要
本文重點(diǎn)介紹基于NGINX如何播放rtmp視頻流
正文
1、構(gòu)造rtsp視頻流
可以參考上一篇博文:【音視頻】基于webrtc協(xié)議瀏覽器播放rtsp
https://blog.csdn.net/HWTwilight/article/details/135653755?spm=1001.2014.3001.5501
那篇分享里面有如何推送出來rtsp視頻
2、運(yùn)行rtmp流媒體服務(wù)器
nginx-rtmp-win32-dev 作為rtmp服務(wù)器
1)安裝目錄:
2)配置文件:
worker_processes 1;
error_log logs/error.log info;
events {
worker_connections 1024;
}
rtmp {
server {
listen 1935;
application live {
live on;
}
application hls {
live on;
hls on;
hls_path temp/hls;
hls_fragment 8s;
}
}
}
http {
server {
listen 8080;
location / {
root html;
}
location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}
location /stat.xsl {
root html;
}
location /hls {
#server hls fragments
types{
application/vnd.apple.mpegurl m3u8;
video/mp2t ts;
}
alias temp/hls;
expires -1;
}
}
}
3)啟動命令:
4)運(yùn)行界面:
3、轉(zhuǎn)換rtmp視頻流
ffmpeg -i rtsp://localhost/test -vcodec copy -acodec copy -f flv rtmp://127.0.0.1:1935/live/play
4、播放rtmp視頻流
使用VLC media player方式
打開媒體菜單:
渲染打開網(wǎng)絡(luò)流串:文章來源:http://www.zghlxwxcb.cn/news/detail-803354.html
文章來源地址http://www.zghlxwxcb.cn/news/detail-803354.html
到了這里,關(guān)于【音視頻】基于NGINX如何播放rtmp視頻流的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!