Giter VIP home page Giter VIP 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

dependabot[bot] avatar dwdcth avatar eduardotang avatar l0g1n avatar langhuihui avatar yangchao2015 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

plugin-rtmp's Issues

后续是否支持音频转码?

你好,请问现在是否支持推流 采用H264+MP3/g711a/g726/opus 等等,而拉流时在服务端转码为H264+AAC呢?

go 语言调用ffmpeg 转码性能怎么样呢?
如果不调用ffmpeg ,go语言是否有类似ffmpeg 的解码库?

谢谢

v4版本如何推流鉴权?

请问在自定义插件中的OnEvent方法接收哪个事件中处理?现在我在“SEpublish”事件中通过Stream.Close()的方法进行处理,因为obs有断线重连功能,就出现反复连接->断开,感觉这样不是很友好。

关于摄像头推流的问题

小白想请教一下,使用网络摄像头,搭建好流媒体服务器之后,要在摄像头的同一个网段配置一台电脑专门去推流吗,如果有多个摄像头的话是不是就需要多台电脑去推流了

控制台的记录过期时间的设置

/live/a 已存在(记为1),又收到/live/a(记为2)的推流请求,先触发一次读1,如果短时间内读不到1的数据,删除1,发布2(重新发布/live/a)(这个是群中大佬提的方案)

播放4k视频卡顿

测试环境

  • 系统: ubuntu 20.04
  • 内存:16G
  • CPU: 4.01 GHz 四核Intel Core i7
  • 网络: 127.0.0.1本地循环网络
  • 测试版本: engine/v2 v2.3.0 plugin-rtmp v1.2.5 默认配置

问题描述

推送一路rtmp,然后ffplay 播放rtmp,画面很卡顿。
测试视频HD.Club-4K-Chimei-inn-20mbps.mp4
下载: http://pan.baidu.com/s/1ntG1d0H 密码: r7ag

rtmp时戳计算bug

时戳处理有问题,播放一卡一卡的,totalDuration变量不应该是音视频共用的。
时戳是相对于chunkstreamid相同的chunk包的,这里音视频混用了同一个totalduration变量,计算出来的有问题。

这段代码已经默认时戳是相对时戳了,不够严谨,这个时戳可能是绝对时戳啊,这段计算totalduration,其实就是绝对时戳,
这部分逻辑应该放到解析协议中吧,这里并没有任何地方表明这个时戳一定是相对时戳。虽然大部分推流工具除了首包,后面都是相对时戳。

由于时戳问题,rtmp拉流会明显卡顿。

          case RTMP_MSG_AUDIO:
                // pkt := avformat.NewAVPacket(RTMP_MSG_AUDIO)
                if msg.Timestamp == 0xffffff {
                    totalDuration += msg.ExtendTimestamp
                } else {
                    totalDuration += msg.Timestamp // 绝对时间戳
                }
                stream.PushAudio(totalDuration, msg.Body)
            case RTMP_MSG_VIDEO:
                // pkt := avformat.NewAVPacket(RTMP_MSG_VIDEO)
                log.Println("huheng debug push video timestamp: ", msg.Timestamp)
                if msg.Timestamp == 0xffffff {
                    totalDuration += msg.ExtendTimestamp
                } else {
                    totalDuration += msg.Timestamp // 绝对时间戳
                }
                stream.PushVideo(totalDuration, msg.Body)

Implementing go-rtmfp in monibuca

Hi I was wondering if you could also create this plugin for monibuca: https://github.com/optman/go-rtmfp

Right now I have a project which is using rtmfp and I don't like the architecture of MonaServer and the code is really not easy to understand. I need that rtmfp protol to upgrade from MonaServer into something more powerful and fast such as monibuca.

Let me know

thanx

推流监权

请问推流时如何实现用户名密码认证

拉流时提示“illegal rtmp url”

如题,rtmp url 在vlc,IINA 中能播放
url如:rtmp://<host>:<port>/domain=31010600012000000000&resource=31010600011320001122-0&quality=2&src=1
使用api rtmp/api/pull urlencode 过编码 也是不行,同样错误(后台能输出能看到正确的url地址)

音视频编码:H264 - MPEG-4 AVC (part 10) (avc1) / MPEG AAC Audio (mp4a)

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.