尝试为不同质量的多流设置 NGINX

问题描述

我从她那里读了很多教程和一些代码,但对我来说它并没有真正奏效。

我想以 4K 格式在 Facebook 和 Youtube 中进行流式传输,然后将其降采样以 twitch 到全高清。

我让它开始工作,我可以使用相同的来源流式传输到 Youtube 和 Twitch ......但现在我没有任何东西可以运行......

Facebook 本身想要 rmpts,但我没有开始工作。

我的操作系统是 Ubuntu 20.4,它是一个带有 8 GB 内存的 4 核。所以它应该可以处理它。

我的配置如下:

#user  nobody;
worker_processes  1;

error_log  logs/error.log  debug;
error_log  logs/error.log  notice;
error_log  logs/error.log  info;
pid        logs/Nginx.pid;


events {
    worker_connections  1024;
}

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

    sendfile            on;
    keepalive_timeout   65;

    server {
        listen          8080;
        server_name     localhost;

        # rtmp stat
        location /stat {
            rtmp_stat all;
            rtmp_stat_stylesheet stat.xsl;
        }
        location /stat.xsl {
            # you can move stat.xsl to a different location
           root html;
        }

        # rtmp control
        location /control {
            rtmp_control all;
        }

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }
}

rtmp {
    server {
        listen 1935;
        chunk_size 8192;

        application live {
            live on;
            record off;

           # allow publish {{ my_ip_address }};
           # deny publish all;

                push rtmp://localhost/youtube/${name};
                push rtmp://localhost/twitch/${name};
                }
  application youtube {
            live on;
            record off;

            allow publish 127.0.0.1;
            deny publish all;

            push rtmp://a.rtmp.youtube.com/live2/xxx;
        }

        application twitch {
            live on;
            record off;

            allow publish 127.0.0.1;
            deny publish all;
                exec ffmpeg -i rtmp://localhost/twitch/$name
                -c:v libx264
                -c:a copy
                -preset veryfast
                -profile:v high
                -level 4.2
                -x264-params "nal-hrd=cbr" "opencl=true"
                -b:v 6000K
                -minrate 6000K
                -maxrate 6000K
                -keyint 2
                -s 1920x1080
                push rtmp://live-cdg.twitch.tv/app/xxxxxxx;
        }
    }
}

我做错了什么,它可以运行? 知道你有一个适用于我的项目和 Facebook RTMPS 的解决方案或教程吗? 感谢帮助!

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)