实现结果

推流的实现:使用OBS Studio进行推流

拉流播放的实现:使用VLC进行拉流地址播放

直播服务器实现:centos系统下的nginx+RTMP模块

实现步骤:

第1步:nginx相关依赖包的安装

nginx相关依赖包的安装:

yum install -y perl-ExtUtils-Embed readline-devel zlib-devel pam-devel libxml2-devel libxslt-devel openldap-devel python-devel gcc-c++ openssl-devel cmakepcre-develnanowget gcc gcc-c++ ncurses-devel perl

其他需要用到的依赖包:

yum -y install git

yum -y install nano

yum -y install wget

第2步:nginx-rtmp-module

nginx-rtmp-module,官方github地址

// 通过git clone 的方式下载到服务器上

[root~]# git clone https://github.com/arut/nginx-rtmp-module.git

第3步:安装Nginx服务器

1.下载Nginx解压,并安装rtmp和openssl的模块

PS:add-module=/data/bak/nginx-rtmp-module 中的/data/bak是自己的下载的相关模块的存放路径

[root~]# wget http://nginx.org/download/nginx-1.10.3.tar.gz

[root~]# tar -zxvf nginx-1.10.3.tar.gz

[root~]# cd nginx-1.10.3

//添加rtmp和openssl支持

[root~]# ./configure --add-module=/data/bak/nginx-rtmp-module --with-http_ssl_module

[root~]# make && make install

第4步:查看安装模块信息:

[root@localhost nginx-1.10.3]# ln -s /usr/local/nginx/sbin/nginx /usr/bin/nginx

[root@localhost nginx-1.10.3]# nginx -V

nginx version: nginx/1.10.3

built by gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)

built with OpenSSL 1.0.2k-fips 26 Jan 2017

TLS SNI support enabled

configure arguments: --add-module=/data/bak/nginx-rtmp-module --with-http_ssl_module

第5步:启动nginx,查看启动的情况

[root@localhost nginx-1.10.3]# nginx -s stop

[root@localhost nginx-1.10.3]# nginx

[root@localhost nginx-1.10.3]# curl http://192.168.74.128/

Welcome to nginx!

body {

width: 35em;

margin: 0 auto;

font-family: Tahoma, Verdana, Arial, sans-serif;

}

Welcome to nginx!

If you see this page, the nginx web server is successfully installed and

working. Further configuration is required.

For online documentation and support please refer to

nginx.org.

Commercial support is available at

nginx.com.

Thank you for using nginx.

[root@localhost nginx-1.10.3]#

第6步:配置相关的模块信息修改nginx.conf

PS:注意是在http{}外进行添加:

rtmp {

server {

listen 1935;

application rtmplive {

live on;

record off;

}

application vod {

play /opt/video/vod;

}

}

}

完成的配置文件如下:

==

#user nobody;

worker_processes 1;

#error_log logs/error.log;

#error_log logs/error.log notice;

#error_log logs/error.log info;

#pid logs/nginx.pid;

events {

worker_connections 1024;

}

http {

include mime.types;

default_type application/octet-stream;

#log_format main '$remote_addr - $remote_user [$time_local] "$request" '

# '$status $body_bytes_sent "$http_referer" '

# '"$http_user_agent" "$http_x_forwarded_for"';

#access_log logs/access.log main;

sendfile on;

#tcp_nopush on;

#keepalive_timeout 0;

keepalive_timeout 65;

#gzip on;

server {

listen 80;

server_name localhost;

#charset koi8-r;

#access_log logs/host.access.log main;

location /stat { #第1处添加的location字段。

rtmp_stat all;

rtmp_stat_stylesheet stat.xsl;

}

location /stat.xsl { #第2处添加的location字段。

root /usr/local/nginx/nginx-rtmp-module/;

}

location / {

root html;

index index.html index.htm;

}

#error_page 404 /404.html;

# redirect server error pages to the static page /50x.html

#

error_page 500 502 503 504 /50x.html;

location = /50x.html {

root html;

}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80

#

#location ~ \.php$ {

# proxy_pass http://127.0.0.1;

#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

#

#location ~ \.php$ {

# root html;

# fastcgi_pass 127.0.0.1:9000;

# fastcgi_index index.php;

# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;

# include fastcgi_params;

#}

# deny access to .htaccess files, if Apache's document root

# concurs with nginx's one

#

#location ~ /\.ht {

# deny all;

#}

}

# another virtual host using mix of IP-, name-, and port-based configuration

#

#server {

# listen 8000;

# listen somename:8080;

# server_name somename alias another.alias;

# location / {

# root html;

# index index.html index.htm;

# }

#}

# HTTPS server

#

#server {

# listen 443 ssl;

# server_name localhost;

# ssl_certificate cert.pem;

# ssl_certificate_key cert.key;

# ssl_session_cache shared:SSL:1m;

# ssl_session_timeout 5m;

# ssl_ciphers HIGH:!aNULL:!MD5;

# ssl_prefer_server_ciphers on;

# location / {

# root html;

# index index.html index.htm;

# }

#}

}

rtmp {

server {

listen 1935;

application rtmplive {

live on;

record off;

}

application vod {

play /opt/video/vod;

}

}

}

第7步:关闭防火墙,为方便测试

ps:一般线上环境是不会直接关闭防火墙,而是开放对应的端口。写对应的规则!

systemctl stop firewalld

[root@localhost nginx-1.10.3]# nginx -s reload

[root@localhost nginx-1.10.3]# curl http://192.168.74.128/stat

1.10.3

1.1.4

gcc 4.8.5 20150623 (Red Hat 4.8.5-16) (GCC)

Feb 26 2018 21:48:59

29574

608

0

0

0

0

0

rtmplive

0

vod

0

PS:说明启动成功

rtmplive

0

vod

第9步:使用OBS Studio进行推流

b4ee6956d1ea

image.png

点击来源:

直播来源:

b4ee6956d1ea

image.png

b4ee6956d1ea

image.png

点击确定:

b4ee6956d1ea

image.png

b4ee6956d1ea

image.png

点击开始推送:

b4ee6956d1ea

image.png

说明连接服务器成功:

b4ee6956d1ea

image.png

如果关闭了nginx,则会提示:

b4ee6956d1ea

image.png

第10步:使用VLC播放器进行播放拉流地址

b4ee6956d1ea

image.png

最终结果:

b4ee6956d1ea

image.png

ffmpeg -re -i "D:\download\film\aqgy\02.mp4" -vcodec libx264 -vprofile baseline -acodec aac

-ar 44100 -strict -2 -ac 1 -f flv -s 1280x720 -q 10 rtmp://192.168.74.128:1935/

myapp/test1

环信直播php怎么生成推流地址,使用Nginx实现简单的RTMP推流直播笔记相关推荐

  1. 抓rtmp推流地址_在浏览器中实现RTMP推流

    什么是RTMP RTMP(Real-Time Messaging Protocol) 是为了能在基于Adobe Flash平台的技术间实现音频.视频及数据的高性能传输而设计的,包括Adobe Flas ...

  2. 抖音直播如何获取推流地址?不到1000粉也能直播啦。还能加热。2020年12月29日

    抖音直播自从出了自己的pc客户端(直播伴侣)后,直播推流地址已不再对外暴漏. 正常情况下,粉丝大于1000,才可使用抖音官方的推流工具(直播伴侣).但对于粉丝数不够1000,也想用第三方推流工具(如o ...

  3. obs多推流地址_如何用一台笔记本实现直播推流功能

    第一步:准备工作 1. 背景 利用最基础的设备搭建直播系统,供老师通过自己的办公电脑或者家用电脑来进行远程教学工作.选用目前最热门的直播软件之一的OBS studio,它是一款视频直播录制软件,为用户 ...

  4. 环信ease-sdk-3.3.4_r1 集成用户头像 昵称功能的简单处理方法

    环信服务器并不保存用户的头像用户名,但实际开发需要设置用户昵称头像.下面提供一个简单的办法设置用户的头像昵称,这里的头像昵称从自己的服务器获取的并且保存到本地. 1.服务端的设计 服务端设计比较简单, ...

  5. 使用nginx的第三方模块rtmp搭建直播服务器

    一.前言 本文主要介绍如何基于nginx的第三方模块rtmp搭建一个流媒体服务器,实现直播的简单推拉流. 二.环境准备 1.系统版本 Ubuntu 18.04.1 2.Nginx版本 nginx/1. ...

  6. obs-studio-node简单搭建rtmp推流软件demo

    基于nodejs封装的obs-studio-node可以实现通过js调用api来进行rtmp推流,由于没有文档,网上资料比较少,特此发布一个简单的demo,供大家讨论学习. 支持window和mac双 ...

  7. 手机信号推流到rtmp服务器,大概是最简单的 rtmp 推流服务器搭建方法

    一开始想到要弄一个简单的 rtmp 服务器是为了给同学上课投射屏幕用.因为我用的是 Linux ,没法用国产的那些课室软件给他们投放屏幕,于是只好出此下策了. 我使用的系统是 CentOS 7 和 U ...

  8. 大概是最简单的 rtmp 推流服务器搭建方法

    转载自:点击跳转原文 我使用的centos,按照下面方法一遍过 一开始想到要弄一个简单的 rtmp 服务器是为了给同学上课投射屏幕用.因为我用的是 Linux ,没法用国产的那些课室软件给他们投放屏幕 ...

  9. 【流媒体服务】本地视频推流、转码、拉流、直播综合应用(五):【1】VLC+FFMPEG+Nginx实现RTSP到RTMP网页直播

    文章目录 前言 一.前几章节回顾 二.操作步骤 1.准备本地视频 2.VLC:获取RTSP视频流 3.FFMPEG:转码推流服务准备 4.Nginx:网站服务准备 5.FFMPEG推流:rtsp转rt ...

最新文章

  1. 为什么多线程可以利用到多核?
  2. java中上传文件有哪些框架,Spring MVC系列教材 (八)- SPRING MVC 上传文件
  3. EOS 核心功能 (2) nodeos
  4. join 高性能_内置的数据无法实现高性能
  5. POJ - 2778 DNA Sequence(AC自动机+矩阵快速幂)
  6. HTTP和HTTPS的主要区别(面试常考)——计算机网络
  7. String常用方法大全(深入源码层面分析)
  8. scrapy初始化selenium,防止网站反爬虫策略监测自动化控件
  9. 【java】 获取计算机信息及Java信息
  10. 如何为IE9平台预览版穿上外衣?
  11. ajax 实时进度_三分钟搭建websocket实时在线聊天,项目经理也不敢这么写
  12. python异常处理知识点_一文掌握 Python 异常处理的所有知识点
  13. Eclipse基础--安装eclipse及语言包
  14. 数值分析--python--LU分解法
  15. 老龙头公司不完全名单
  16. 王垠:编程宗派之我见
  17. 上海理工大学854C语言真题,2018年上海理工大学医疗器械与食品院854C程序设计考研核心题库...
  18. OSPF之链路状态数据库LSDB
  19. 如何在阿里云上搭建个人网站(学习记录)
  20. Android studio入门到精通实例实验

热门文章

  1. 云办公系统 skyeye v3.1.5 发布
  2. h5 调起相机_H5移动端调用相机或相册
  3. Java中常用的网站
  4. backgroundWorker学习
  5. 第三方投票自动化投票脚本软件代码
  6. 三种加密方式: sha1加密、MD5加密、Base64加密 (附H5源码和js源码)
  7. Android(或者Java)通过HttpUrlConnection向SpringMVC请求数据(数据绑定)
  8. Bitlocker使用及原理
  9. BZOJ 3443: 装备合成
  10. Ajax的异步同步原理以及js几种方式的实现