centos7_srs4.10_webrtc_rtmp_rtsp

RTMP & RTSP




RTSP+RTP主要用于IPTV,原因是传输数据使用的是UDP,在网络环境比较稳定的情况下,传输效率是比较高的;

RTMP主要用于互联网音视频传输,它使用的是TCP传输,因为互联网环境相对较差,采用RTMP保证了视频的传输质量,但是其传输延迟相对较高,传输效率相对较低。

https://zhuanlan.zhihu.com/p/382713315

RTSP、RTMP区别

  1. RTSP实时流协议

RTSP可以对流媒体提供诸如播放、暂 停、快进等操作,它负责定义具体的控制消息、操作方法、状态码等,此外还描述了与RTP间的交互操作(RFC2326)。

  1. RTMP和延时

一般的直播应用,只要不是电话类对话的那种要求,RTMP延迟是可以接受的。在一般的视频会议应用中,RTMP延时也能接受,原因是别人在说话的时候我们一般在听.


安装教程

  • https://www.likecs.com/show-61334.html
  • https://blog.csdn.net/weixin_40359716/article/details/104645108
  • https://blog.csdn.net/lingdu_789/article/details/124297354 安装yasm
  • https://blog.csdn.net/qq_16504067/article/details/114524541 安装ffmpeg
  • https://cloud.tencent.com/developer/article/1408113 部分介绍
  • https://github.com/winlinvip/srs/tags SRS下载地址 4.0版本以上
  • https://blog.csdn.net/weixin_41910694/article/details/122704791 edge
  • https://blog.csdn.net/mangobot/article/details/121426189 疑似暂停

基于宝塔服务安装部分功能,包括nginx,ssh连接配置,文件上传下载服务.直接在宝塔服务面板进行操作即可.

方便文件上传下载,部分nginx和srs的配合,ssh终端自动连接的功能


1.0 虚拟机网络设置为NAT

nano /etc/sysconfig/network-scripts/ifcfg-ens33

parse : ONBOOT=yes


在虚拟机的环境中,重启网络即可,命令为
service NetworkManager stop
service network restart
service NetworkManager start


2.0 修改镜像源

  • 备份
    mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

  • 下载新的CentOS-Base.repo 到/etc/yum.repos.d/
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

  • 生成缓存
    yum makecache


3.0 开启端口

firewall-cmd --zone=public --add-port=8000/tcp --permanent && firewall-cmd --reload

4.0 防火墙

启动:systemctl start firewalld
停止:systemctl disable firewalld
禁用:systemctl stop firewalld


5.0 开关SRS

  • 编译:
    ./configure && make

  • 开启服务:
    ./objs/srs -c conf/srs.conf

  • 停止服务:
    ./scripts/stop.sh
    ./etc/init.d/srs stop

  • 热重启
    killall -1 srs

  • 编译时安装FFmpeg:
    ./configure --with-ffmpeg


6.0 安装 yasm

  • wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz
  • tar zxvf yasm-1.3.0.tar.gz
  • cd yasm-1.3.0
  • ./configure
  • make && make install

7.0 解压 tar.xz 文件

tar -xf archive.tar.xz


8.0 rtmp 文件推拉流

ffmpeg -re -i filePath_video_file -c copy -f flv -y rtmp://ipAddres/live/livestream
  1. VLC观看
    在这里插入图片描述
  2. cmd终端
ffpaly  rtmp://ipAddres/live/livestream

9.0 obs推流

  1. 推流设置

  2. 拉流

10.0 webRTC推流

  1. 推流
    在这里插入图片描述

这里需要注意,仅支持https. 推流的是摄像头实时视频。

  1. 拉流
    在这里插入图片描述

11.0 webRTC推流

  1. 视频推流
ffmpeg  -i 0512_1.mp4 -vcodec copy -acodec copy -y -f flv rtmp:82.156.3.9:1935/live/test_1

12.0 HLS协议文件

hls {
       # enabled         on;
       # hls_fragment    10;
       # hls_window      60;
       # hls_ts_file     [app]/[stream]/[2006][01][02]-[15][04][05]-[seq].ts; # ts文件在/objs/nginx/html下的路径
       # hls_path        ./objs/nginx/html;
       # hls_m3u8_file   [app]/[stream].m3u8;
       # hls_cleanup     off;
       # hls_dispose     86400;
       # hls_on_error    continue;
       # hls_storage     disk;
       # hls_wait_keyframe       on;
       # hls_acodec      aac;
       # hls_vcodec      h264;
       enabled         on;
       hls_fragment    5;
       hls_window      86400; #ts总时长1天
       hls_path        ./objs/nginx/html;  #m3u8和ts文件的相对路径
       hls_m3u8_file   [app]/[stream].m3u8; # m3u8文件在/objs/nginx/html下的路径
       hls_ts_file     [app]/[stream]/[2006][01][02]-[15][04][05]-[seq].ts; # ts文件在/objs/nginx/html下的路径
       hls_cleanup     off; #不清除过期的ts文件
       hls_dispose     86400; # 在没有流时,HLS清理的过期时间为1天
   }
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值