网页显示直播(监控)视频 【ubuntu服务器 (nginx+rtmp+jwplayer) 树莓派(ffmpeg推流)】

阿里云服务器(ubuntu)搭建nginx-rtmp服务器

https://blog.csdn.net/weixin_40490238/article/details/82260728

此文章中不再采用windows的obs进行推流,而是采用树莓派的ffmpeg进行推流

因此,树莓派需要安装 ffmpeg

https://blog.csdn.net/weixin_40490238/article/details/82181518

在树莓派中的 ffmpeg 推流命令(-t 10可以删除,则一直不断的进行推流)

ffmpeg -ss 0 -t 10 -i /dev/video0 -f flv rtmp://(ip):(端口)/(nginx服务器应用)/(自定义应用)

当配置完成后,网页放入nginx服务器的html文件夹中即可访问

我的文件目录为:/usr/local/nginx/html/

jwplayer的demo.html

 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">  
<head>  
<meta http-equiv="content-type" content="text/html; charset=utf-8" />  
<title>live-player</title>  
<style type="text/css">  
</style>  
</head>  
<body>  
<script type='text/javascript' src='jwplayer.js'></script>  
<center>
<b>RTMP直播系统</b>  
<div id='mediaspace'>This text will be replaced</div>  
<script type='text/javascript'>  
   var server = window.location.hostname;  
   // mylive 对应nginx.conf配置项application的名字  
   // live_stream 对应Adobe Flash Stream Media Live Encoder配置的stream名称  
   var live_url = 'rtmp://' + server + '/hls' + '/live_stream';  
  jwplayer('mediaspace').setup({  
    'flashplayer': 'jwplayer.flash.swf',  
    'file': live_url,  
    'controlbar': 'bottom',  
    'width': '760',  
    'height': '428',  
    //autostart: true,  //如果打开此标志,在打开网页时会自动播放直播流  
  });  
</script>  
</body>  
</html>  

demo下载链接:https://download.csdn.net/download/weixin_40490238/10662355

猜你喜欢

转载自blog.csdn.net/weixin_40490238/article/details/82663519