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.71k stars 567 forks source link

[bug] with stat info with multi config files #240

Closed masternet0 closed 1 year ago

masternet0 commented 1 year ago

Hello, There a bug in stat json info not show all users info when use multi vhost files for rtmp, its just show one user data only is last one

For example: if you have multi rtmp vhost files like /etc/nginx/conf/user1.conf /etc/nginx/conf/user2.conf /etc/nginx/conf/user3.conf

The stat url show only the data for user3 Need fix this to show all data for all config files

Thank you Regards

winshining commented 1 year ago

My config files:

user1.conf:

server {
    listen 1935;
    server_name localhost;

    application myapp {
        live on;
    }
}

user2.conf:

server {
    listen 1935;
    server_name localtest; # actually 127.0.0.1

    application myapp {
        live on;
    }
}

nginx.conf:

rtmp {
    ...;

    include user1.conf;
    include user2.conf;
}

They have the same port (1935) but different server names (localhost & localtest).

publish:

ffmpeg -re -i workspace/nginx/media/xxx.mp4 -c copy -f flv rtmp://localhost/myapp/mystream
ffmpeg -re -i workspace/nginx/media/xxx.mp4 -c copy -f flv rtmp://localtest/myapp/mystream

play:

ffplay rtmp://localhost/maypp/mystream
ffplay rtmp://localtest/myapp/mystream

The following is screenshot:

stat

It's OK.

Please make sure browser cache is cleared or provide more information.

masternet0 commented 1 year ago

Thank you for your response may be because you used same port my case each user use its own port

winshining commented 1 year ago

In fact, if different ports are configured, server_name are useless. It's OK still: stat2

winshining commented 1 year ago

If you reproduce the bug, please let me know, I will reopen this issue. Thanks in advance. Note: vhost functions improperly in multi-processes mode.

masternet0 commented 1 year ago

@winshining Thank you for your response and i find the reason for this it was with rtmp {} and i fixed the main configuration but there one question about the bits/s for video and audio I didnt see it in the json format, I see it only in xsl sheet format how can i got this values in json format ?

2023-05-22_12-55-44

winshining commented 1 year ago

@masternet0 Hello, you can see bw_audio and bw_video in the following screenshot: stat_json