winshining / nginx-http-flv-module

A media streaming server based on nginx-rtmp-module. In addtion to the features nginx-rtmp-module provides, HTTP-FLV, GOP cache, VHosts (one IP for multi domain names) and JSON style statistics are supported now.
BSD 2-Clause "Simplified" License
2.75k stars 571 forks source link

rtmp拉流 後推流到指定rtmp 伺服器 #202

Closed djdjdjek closed 3 years ago

djdjdjek commented 3 years ago

各位好 我嘗試了些方式,但是我似乎無法在rtmp module 裡面 pull 一個rtmp 流publish 出去。 我設定過可以listen 1935 port 當被推流進來時publish 到多個下級server 是正常的

請問這是軟體限制嗎?

winshining commented 3 years ago

你好,软件没有限制。 你的问题描述不清楚,我只能猜测分为两种情况:

  1. nginx-http-flv-module -- pull --> A -- publish --> B

1m

注意黄色方框里的 url,rtmp 和 http-flv 都没有问题。 红色方框里:ffmpeg -- publish (1935) --> nginx-http-flv-module -- pull (1935) --> ffmpeg -- publish (1995) --> nginx-http-flv-module -- publish (1995) --> ffplay

  1. A -- pull -> nginx-http-flv-module -- publish --> B

2m

注意黄色方框里的 url,rtmp 和 http-flv 也都没有问题。 红色方框里:ffmpeg -- publish (1935) --> nginx-http-flv-module -- pull (1935) --> nginx-http-flv-module -- publish (1995) --> ffplay

配置如下:

    server {
        listen 1935;
        application myapp {
            live on;
        }
    }

    server {
        listen 1995;
        application myapp {
            pull rtmp://localhost/$app/$name;
            live on;
        }
    }
djdjdjek commented 3 years ago

你好 感謝作者迅速的回應

我想要的設定更類似您第二種情況,但是我有個rtmp 來源,並且不希望經由ffmpeg 轉發(根據我測試這至少會多3秒延遲)。 詳細配置如下

”rtmp source“ <=pull= “第一台nginx-http-flv-module” =publish=> “第二台nginx-http-flv-module”

我無法設定出 “第一台nginx-http-flv-module” 所需要的配置,只要pull, 就無法publish,不知道有沒有別的方式達成這個功能

djdjdjek commented 3 years ago

類似這種配置,測試是無效的 application live { live on; pull rtmp://source domain/live/720p; push rtmp://next layer nginx server domain:1935/live/; }

winshining commented 3 years ago

也没问题,见下面的截图,黄色方框里表示 rtmp 和 http-flv 都可以正常播放,红色方框里是配置(抹去了一部分 ip 地址),白色方框里是 tcp 连接情况(也抹去了一部分 ip 地址)。 1m