exec RTMP流到HLS Nginx服务器不起作用

时间:2019-02-26 17:11:11

标签: ffmpeg rtmp hls

我正在尝试在Nginx服务器中使用ffmpeg将RMTP流转换为HLS 这是我的基本nginx配置。 如果使用push rtmp:// localhost / show /而不是exec保存数据,但是exec却什么也没做。
我可以用ffplay看到视频流,
错误-> RTMP_ReadPacket,读取RTMP数据包头失败
rtmp:// localhost / live / key:处理输入时发现无效数据
为了测试它,我使用的是OBS和ffplay

#user  root;
worker_processes  auto;


events {
    worker_connections  1024;
}


# RTMP configuration
rtmp {
    server {
        listen 1935; # Listen on standard RTMP port
        chunk_size 4000; 

        # This application is to accept incoming stream
        application live {
            live on; # Allows live input

            # Once receive stream, transcode for adaptive streaming
            exec ffmpeg -i rtmp://localhost/$app/$name -async 1 -vsync -1 -c:v libx264 -c:a libvo_aacenc -b:v 256k -b:a 32k -vf "scale=480:trunc(ow/a/2)*2" -tune zerolatency -preset veryfast -crf 23 -f flv rtmp://localhost/show/$name_low 2>>/tmp/ffmpeg.error; 
        }

        # This application is for splitting the stream into HLS fragments
        application show {
            live on; # Allows live input from above
            hls on; # Enable HTTP Live Streaming

            hls_path /mnt/hls/;

            # Instruct clients to adjust resolution according to bandwidth
            hls_variant _low BANDWIDTH=288000; # Low bitrate, sub-SD resolution
        }
    }
}

0 个答案:

没有答案