首页 > 解决方案 > 无法在 nginx rtmp 模块上运行 exec

问题描述

我正在使用:arut/nginx-rtmp-server作为 docker 容器。

我使用 HLS 设置了 RTMP 服务器,并且能够通过 HTTP 从 RTMP 流式传输,没有任何问题。但现在我想添加 HLS 变体(用于差异质量 1080p、720p、480 等)。所以我继续将以下代码添加到我的实时应用程序(OBS 的端点)中:

            exec ffmpeg -i rtmp://localhost/$app/$name  -async 1 -vsync -1
        -c:v libx264 -acodec copy -b:v 256k -vf "scale=480:trunc(ow/a/2)*2" -tune zerolatency -preset veryfast -crf 23 -g 60 -hls_list_size 0 -f flv rtmp://localhost/hls/$name_low
        -c:v libx264 -acodec copy -b:v 768k -vf "scale=720:trunc(ow/a/2)*2" -tune zerolatency -preset veryfast -crf 23 -g 60 -hls_list_size 0 -f flv rtmp://localhost/hls/$name_mid
        -c:v libx264 -acodec copy -b:v 1024k -vf "scale=960:trunc(ow/a/2)*2" -tune zerolatency -preset veryfast -crf 23 -g 60 -hls_list_size 0 -f flv rtmp://localhost/hls/$name_high
        -c:v libx264 -acodec copy -b:v 1920k -vf "scale=1280:trunc(ow/a/2)*2" -tune zerolatency -preset veryfast -crf 23 -g 60 -hls_list_size 0 -f flv rtmp://localhost/hls/$name_higher
        -c copy -f flv rtmp://localhost/hls/$name_src;

我确实有一个 hls 应用程序并且运行push rtmp://localhost/hls;正常。

我尝试使用 exec/exec_push/exec_static 因此我认为问题出在 exec 上,因为我添加了几个 bash 脚本来测试它是否确实是 exec 指令的问题,我的脚本都没有运行(但它们确实从我的 shell 运行)

我还user root; 按照另一篇文章中的建议添加到了我的 nginx.conf 的顶部,但这没有用。

我在运行带有 WSL 的 Windows 10 的本地计算机上对此进行了测试,我还尝试在运行 Ubuntu 的私有 VPS 上运行它,但它在那里也不起作用。

标签: dockernginxrtmpnginx-config

解决方案


推荐阅读