Git Product home page Git Product logo

plugin-rtmp's Introduction

RTMP插件

rtmp插件提供rtmp协议的推拉流能力,以及向远程服务器推拉rtmp协议的能力。

仓库地址

https://github.com/Monibuca/plugin-rtmp

引入

import _ "m7s.live/plugin/rtmp/v4"

推拉地址形式

rtmp://localhost/live/test
  • localhost是m7s的服务器域名或者IP地址,默认端口1935可以不写,否则需要写
  • live代表appName
  • test代表streamName
  • m7s中live/test将作为streamPath为流的唯一标识

例如通过ffmpeg向m7s进行推流

ffmpeg -i [视频源] -c:v h264 -c:a aac -f flv rtmp://localhost/live/test

会在m7s内部形成一个名为live/test的流

如果m7s中已经存在live/test流的话就可以用rtmp协议进行播放

ffplay -i rtmp://localhost/live/test

配置

rtmp:
    publish: # 参考全局配置格式
    subscribe: # 参考全局配置格式
    tcp:
        listenaddr: :1935
        listenaddrtls: ""  # 用于RTMPS协议
        certfile: ""
        keyfile: ""
        listennum: 0
        nodelay: false
    pull: # 格式参考文档 https://m7s.live/guide/config.html#%E6%8F%92%E4%BB%B6%E9%85%8D%E7%BD%AE
    push: # 格式参考文档 https://m7s.live/guide/config.html#%E6%8F%92%E4%BB%B6%E9%85%8D%E7%BD%AE
    chunksize: 65536 # rtmp chunk size
    keepalive: false #保持rtmp连接,默认随着stream的close而主动断开

:::tip 配置覆盖 publish subscribe 两项中未配置部分将使用全局配置 :::

API

rtmp/api/list

获取所有rtmp流

rtmp/api/pull?target=[RTMP地址]&streamPath=[流标识]&save=[0|1|2]

从远程拉取rtmp到m7s中

  • save含义:0、不保存;1、保存到pullonstart;2、保存到pullonsub
  • RTMP地址需要进行urlencode 防止其中的特殊字符影响解析

rtmp/api/push?target=[RTMP地址]&streamPath=[流标识]

将本地的流推送到远端

plugin-rtmp's People

Contributors

langhuihui avatar dwdcth avatar dependabot[bot] avatar eduardotang avatar yangchao2015 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.