NOALBS / nginx-obs-automatic-low-bitrate-switching

Simple app to automatically switch scenes in OBS based on the current bitrate fetched from the NGINX stats page.
http://noalbs.com
MIT License
358 stars 77 forks source link

Error while parsing NGINX stats duplicate field server #90

Closed Blackwolf8202 closed 2 years ago

Blackwolf8202 commented 2 years ago

←[2m2022-01-30T18:47:34.627956Z←[0m ←[31mERROR←[0m ←[1mNOALBS←[0m←[1m{←[0m←[3muser←[0m←[2m=←[0mblackwolf8202←[1m}←[0m←[2m:←[0m←[1mSwitcher←[0m←[2m:←[0m ←[2mnoalbs::stream_servers::nginx←[0m←[2m:←[0m Error parsing stats (http://localhost/stat) duplicate field server ←[2m2022-01-30T18:47:35.931927Z←[0m ←[31mERROR←[0m ←[1mNOALBS←[0m←[1m{←[0m←[3muser←[0m←[2m=←[0mblackwolf8202←[1m}←[0m←[2m:←[0m←[1mSwitcher←[0m←[2m:←[0m ←[2mnoalbs::stream_servers::nginx←[0m←[2m:←[0m Error parsing stats (http://localhost/stat) duplicate field server ←[2m2022-01-30T18:47:37.234032Z←[0m ←[31mERROR←[0m ←[1mNOALBS←[0m←[1m{←[0m←[3muser←[0m←[2m=←[0mblackwolf8202←[1m}←[0m←[2m:←[0m←[1mSwitcher←[0m←[2m:←[0m ←[2mnoalbs::stream_servers::nginx←[0m←[2m:←[0m Error parsing stats (http://localhost/stat) duplicate field server ←[2m2022-01-30T18:47:38.537166Z←[0m ←[31mERROR←[0m ←[1mNOALBS←[0m←[1m{←[0m←[3muser←[0m←[2m=←[0mblackwolf8202←[1m}←[0m←[2m:←[0m←[1mSwitcher←[0m←[2m:←[0m ←[2mnoalbs::stream_servers::nginx←[0m←[2m:←[0m Error parsing stats (http://localhost/stat) duplicate field server ←[2m2022-01-30T18:47:39.840335Z←[0m ←[31mERROR←[0m ←[1mNOALBS←[0m←[1m{←[0m←[3muser←[0m←[2m=←[0mblackwolf8202←[1m}←[0m←[2m:←[0m←[1mSwitcher←[0m←[2m:←[0m ←[2mnoalbs::stream_servers::nginx←[0m←[2m:←[0m Error parsing stats (http://localhost/stat) duplicate field server ←[2m2022-01-30T18:47:41.143940Z←[0m ←[31mERROR←[0m ←[1mNOALBS←[0m←[1m{←[0m←[3muser←[0m←[2m=←[0mblackwolf8202←[1m}←[0m←[2m:←[0m←[1mSwitcher←[0m←[2m:←[0m ←[2mnoalbs::stream_servers::nginx←[0m←[2m:←[0m Error parsing stats (http://localhost/stat) duplicate field server ←[2m2022-01-30T18:47:42.446707Z←[0m ←[31mERROR←[0m ←[1mNOALBS←[0m←[1m{←[0m←[3muser←[0m←[2m=←[0mblackwolf8202←[1m}←[0m←[2m:←[0m←[1mSwitcher←[0m←[2m:←[0m ←[2mnoalbs::stream_servers::nginx←[0m←[2m:←[0m Error parsing stats (http://localhost/stat) duplicate field server

b3ck commented 2 years ago

please paste config.json, with sensitive bits hidden or replaced.

thank you. -b3ck

Blackwolf8202 commented 2 years ago

please paste config.json, with sensitive bits hidden or replaced.

{ "user": { "id": null, "name": "myname", "passwordHash": null }, "switcher": { "bitrateSwitcherEnabled": true, "onlySwitchWhenStreaming": true, "instantlySwitchOnRecover": true, "autoSwitchNotification": false, "retryAttempts": 5, "triggers": { "low": 800, "rtt": 6000, "offline": null }, "switchingScenes": { "normal": "LIVE", "low": "LOW", "offline": "BRB" }, "streamServers": [ { "streamServer": { "type": "Nginx", "statsUrl": "http://localhost/stat", "application": "publish", "key": "live" }, "name": "RTMP", "priority": 0, "overrideScenes": null, "dependsOn": null } ] }, "software": { "type": "Obs", "host": "localhost", "password": "mypassword", "port": 4444 }, "chat": { "platform": "Twitch", "username": "myname", "admins": [ "myname", "mybot", "myanhoteradmins" ], "language": "EN", "prefix": "!", "enablePublicCommands": true, "enableModCommands": true, "enableAutoStopStreamOnHostOrRaid": true, "commands": { "Trigger": { "permission": "Mod", "alias": null }, "Bitrate": { "permission": "Public", "alias": [ "b" ] }, "Switch": { "permission": "Mod", "alias": [ "ss" ] }, "Fix": { "permission": "Mod", "alias": [ "f" ] }, "Obsinfo": { "permission": "Mod", "alias": null }, "Sourceinfo": { "permission": "Mod", "alias": null }, "Refresh": { "permission": "Mod", "alias": [ "r" ] } } }, "optionalScenes": { "starting": null, "ending": null, "privacy": null }, "optionalOptions": { "twitchTranscodingCheck": false, "twitchTranscodingRetries": 5, "twitchTranscodingDelaySeconds": 15 } }

715209 commented 2 years ago

Hi Blackwolf8202,

This error is caused by having multiple RTMP servers in your NGINX config. Do you really need multiple RTMP servers? You could for example add another application field instead.

Blackwolf8202 commented 2 years ago

Hi Blackwolf8202,

This error is caused by having multiple RTMP servers in your NGINX config. Do you really need multiple RTMP servers? You could for example add another application field instead.

Hi =)

I use a second camera, namely I need another server. So in other words it is not possible to add? Because it has worked with 1.9.5. Can send over the config so you can see what it looks like, I got help with setting it up together with 1.9.5

Blackwolf8202 commented 2 years ago

So he has built it up and this was then 1.9.5 version

user www-data;

worker_processes 1;

pid /run/nginx.pid;

include /etc/nginx/modules-enabled/*.conf;

events { worker_connections 768;

multi_accept on;

}

http { include mime.types; default_type application/octet-stream; ignore_invalid_headers on;

server {
    listen      80;
    server_name localhost;

    # This URL provides RTMP statistics in XML
    location /stat {
        if ($request_method = "GET") {
            add_header "Access-Control-Allow-Origin"  *;
        }

        rtmp_stat all;

        # Use this stylesheet to view XML as web page
        # in browser
        rtmp_stat_stylesheet /stat.xsl;
    }

    location /stat.xsl {
        # XML stylesheet to view RTMP stats.
        # Copy stat.xsl wherever you want
        # and put the full directory path here
        # root /path/to/stat.xsl/;
        root "C:/nginx";

    }

    location /control {
        rtmp_control all;
    }
}

}

rtmp { server { listen 1935; ping 30s; notify_method get; chunk_size 8192; ack_window 8192; buflen 5s;

chunk_size 8192; // default

    # Stream to "rtmp://localhost/publish/live".
    application publish {
        live on;
        wait_video on;
        wait_key on;
        sync 300ms;
        exec_options on;
        publish_notify on;
        play_restart on;
        drop_idle_publisher 6s;
        idle_streams off;
    }
}
server {
    listen 1936;
    ping 30s;
    notify_method get;
    chunk_size 4096;
    ack_window 8192;
    buflen 5s;
    # chunk_size 8192; // default

    # Stream to "rtmp://localhost:1936/camera2/live".
    application camera2 {
        live on;
        wait_video on;
        wait_key on;
        sync 300ms;
        exec_options on;
        publish_notify on;
        play_restart on;
        drop_idle_publisher 6s;
        idle_streams off;
    }
        }
server {
    listen 1937;
    ping 30s;
    notify_method get;
    chunk_size 4096;
    ack_window 8192;
    buflen 5s;
    # chunk_size 8192; // default

    # Stream to "rtmp://localhost:1937/camera3/live".
    application camera3 {
        live on;
        wait_video on;
        wait_key on;
        sync 300ms;
        exec_options on;
        publish_notify on;
        play_restart on;
        drop_idle_publisher 6s;
        idle_streams off;
    }
}

}

b3ck commented 2 years ago

You only need one RTMP server and one APPLICATION, then you can use any key you want and have multiple feeds;

ex; if your application is publish you can stream to publish/camera1 , publish/camera2 , publish/camera2 all on port 1935.

Just make sure to pull it into OBS correctly.

Blackwolf8202 commented 2 years ago

okay thanks b3ck

You only need one RTMP server and one APPLICATION, then you can use any key you want and have multiple feeds;

ex; if your application is publish you can stream to publish/camera1 , publish/camera2 , publish/camera2 all on port 1935.

Just make sure to pull it into OBS correctly.

okay thanks b3ck <3 =)