如何使用nginx将rtmp流转换为HEVC DASH / HLS?

时间:2019-07-16 13:42:40

标签: nginx ffmpeg video-streaming rtmp hevc

exec_push /usr/bin/ffmpeg -re -i rtmp://localhost:1935/$app/$name -ar 44100 -vcodec libx264 -g 25 -f flv rtmp://localhost/live/$name_hi

我可以在Nginxg服务器上广播h264视频。但是当我想用h265而不是h264时它不起作用。我发现这是因为rtmp不支持h265。如果可能的话,有没有办法使用rtmp做到这一点? 如果不是,则可以使用其他方法在nginx中代替rtmp来流h265视频。

rtmp {
    server {
            listen 1935;
            chunk_size 4096;

            application src {
                live on;
                exec_push /usr/bin/ffmpeg -re -i rtmp://localhost:1935/$app/$name -ar 44100 -vcodec libx264 -g 25 -f flv rtmp://localhost/live/$name_hi;
            }

            application live {
                    live on;
                    hls on;
                    hls_path /usr/share/nginx/hls; #file path for save
                    hls_fragment 1;
                    hls_playlist_length 10; 
                    hls_cleanup on;
                    dash on;
                    dash_path /usr/share/nginx/dash; #Sets MPEG-DASH playlist and fragment directory. If the directory does not exists it will be created.
                    dash_fragment 1; #Sets MPEG-DASH fragment length. Defaults to 5 seconds.
                    dash_playlist_length 10; #Sets MPEG-DASH playlist length. Defaults to 30 seconds.

                    dash_cleanup on; `
                   } 
}

0 个答案:

没有答案
相关问题