gpt4 book ai didi

nginx - 如何从 NGINX RTMP 模块向 Janus 发送 RTP 流?

转载 作者:行者123 更新时间:2023-12-04 22:46:54 28 4
gpt4 key购买 nike

这是我在这里的第一篇文章,尽管这个平台已经帮助了我很多。
所以,我正在尝试创建一个流并将其显示在浏览器中。我已经使用 rtmp 模块配置了 NGINX,并且我的流与 HLS 配合得很好(延迟在 5 到 10 秒之间)。
现在我想设置一个低延迟流,这就是为什么我安装了 janus-gateway webRTC 服务器,它允许输入 RTP 流并在输出中提供 webRTC 流。
这是我想遵循的架构:
OBS -> RTMP -> Nginx-rtmp-module -> ffmpeg -> RTP -> Janus -> webRTC -> 浏览器
但我对这部分有疑问:“nginx-rtmp-module -> ffmpeg -> janus”
事实上,我的 janus 的服务器正在运行,并且演示流在 localhost 中运行良好,但是当我尝试提供 RTP 流时,Janus 没有检测到演示中的流(它显示“没有可用的远程视频”)。
任何人都可以帮助我,好吗?
资源:

  • 我的 janus.plugin.streaming.jcfg 配置:
  • rtp-sample: {
    type = "rtp"
    id = 1
    description = "Opus/VP8 live stream coming from external source"
    metadata = "You can use this metadata section to put any info you want!"
    audio = true
    video = true
    audioport = 5002
    audiopt = 111
    audiortpmap = "opus/48000/2"
    videoport = 5004
    videopt = 100
    videortpmap = "VP8/90000"
    secret = "adminpwd"
    }

  • 我的 nginx.conf 应用程序:
  • application test {

    deny play all;

    live on;
    on_publish http://localhost/test/backend/sec/live_auth.php;

    exec ffmpeg -i rtmp://localhost/test/$name -an -c:v copy -flags global_header -bsf dump_extra -f rtp rtp://localhost:5004;

    }

    如果您需要更多帮助我,请不要犹豫!提前谢谢你,对不起我的英语不好:)

    最佳答案

    我终于用以下命令解决了这个问题:

    sudo ffmpeg -y -i "rtmp://127.0.0.1/app/stream" -c:v libx264 -profile:v main -s 1920x1080 -an -preset ultrafast -tune zerolatency -g 50 -f rtp rtp://127.0.0.1:5004
    不幸的是,当我使用 -c:v copy 时,它不起作用。它仅在使用 libx264 编码时才有效,这会增加延迟,我得到了 3 到 4 秒的延迟。
    然而,当我安装 Janus 时,我的目标是比使用 HLS 做得更好,HLS 协议(protocol)的延迟达到 2.5 秒。
    所以 Janus 没有满足我的需要。此外,我被警告说它不是流服务器。经过一番研究,我在 Github 上发现了 Oven Media Engine 项目,这是一个延迟小于 1 秒的流服务器。该文档在专用站点上是完整的,并且适用于该服务器的播放器(Oven Media Player)在 MIT 许可下可用。服务器在 GPLv2 许可下。
    这是我的架构的当前架构:
    OBS -> Nginx(允许使用 on_publish 进行流式传输,因为 OME 还不允许。然后将流推送到 OME 服务器)-> OME -> 以不同的比特率和分辨率进行转码(可选)-> OME -> Edge OME(可选)-> 播放器。
    如果您有任何问题,请不要犹豫,支持非常友好!
    希望能帮助到你

    关于nginx - 如何从 NGINX RTMP 模块向 Janus 发送 RTP 流?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62711875/

    28 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com