Git Product home page Git Product logo

rtmpserverstudy's Introduction

rtmpServerStudy

just for study golang and AV knowledge

纯golang直播服务器: 修改自joy4

  • 安装和使用非常简单;

  • golang version >1.9

支持的传输协议

  • RTMP
  • AMF
  • HLS (h264 aac)
  • HTTP-FLV (h264,h265,aac)

支持的容器格式

  • FLV
  • TS

支持推流传输协议

  • tcp
  • quic
  • kcp

支持的编码格式

  • H264
  • H265 ()
  • AAC

从源码编译

  1. 下载源码 git clone https://github.com/KouChongYang/rtmpServerStudy
  2. cd rtmpServerStudy 目录
  3. cd main 目录下执行 go build

使用

  1. linux 运行
  2. 启动服务:执行 ./main -c config.yaml -p ./ 二进制文件启动 rtmp server 服务;
  3. 上行推流:通过 RTMP 协议把视频流推送到 rtmp://test.uplive.com:1935/live/test, 例如使用 ffmpeg -re -i 4b.flv -c copy -f flv rtmp://127.0.0.1:1935/123?vhost=test.uplive.com/live 推送; 或者绑定host test.uplive.com 127.0.0.1 直接通过以下命令推送ffmpeg -re -i 4b.flv -c copy -f flv rtmp://test.uplive.com/live/123 亦或直接通过obs推流
  4. 下行播放:支持以下三种播放协议,播放地址如下:
    • RTMP:rtmp://test.live.com:1935/live/123
    • FLV:http://test.live.com:8087/live/123.flv

配置文件说明

RtmpServer:
  ClusterCnf: ["127.0.0.1:1935","10.137.16.47:1935"] # 集群机器列表
  SelfIp: "127.0.0.1:1935" # 本机机器
  RtmpListen: [":1935","/tmp/rtmp.socket8"] # rtmp 监听列表
  HttpListen: [":8087","/tmp/http.socket6"] # http 监听列表
  QuicListen: ":443" #quic server监听端口
  KcpListen: ":9997" #kcp server监听端口

UserConf:
  PublishDomain:
    test.uplive.com: # 推流域名
      UniqueName: test #用户标识
      App:     #app
        live:
          GopCacheNum: 2 #gop 缓存个数(默认2个gop可以,达到快速首屏的效果)
          ExtTimeSend: 1
          RecodeFlv: 1 #flv 录制
          RecodeHls: 1 # hls 录制
          hlsFragment: "5s" #hls 录制间隔
          RecodeFlvPath: "/dev/shm/data/flv"
          RecodeHlsPath: "/data/hls"
          RecodePicture: 1
          TurnHost: ["test.uplive.com/test"] #转推地址
    PlayDomain:           #拉流域名
      test.live.com:
        UniqueName: test
        App:
            live:

性能比较

  1. nginx rtmp 性能比较

压测方法

  • 使用sb_rtmp_publish 压测7500路,500kb码率的流压测,压测报告如下:
  • gortmp 性能:

  • nginx rtmp 性能:

首屏比较

rtmpserverstudy's People

Contributors

kouseas avatar kouchongyang avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.