简体   繁体   中英

Nginx RTMP module to generate HLS

I'm streaming an audio stream with opus codec from Kurento via ffmpeg to nginx-rtmp-module. I'm using the below command to stream to nginx-rtmp:

ffmpeg -protocol_whitelist file,udp,rtp  -i test-audio.sdp  
-c:a libopus  -f opus rtmp://<server_ip>/live/<stream_name>

I see no error on the ffmpeg side. But there's no m3u8 file being generated. But I noticed the following in the nginx log:

2020/11/23 23:19:31 [info] 95#0: *8 connect: app='live' args='' flashver='FMLE/3.0 (compatible; Lavf57.83' swf_url='' tc_url='rtmp://192.168.4.28:1935/live' page_url='' acodecs=0 vcodecs=0 object_encoding=0, client: 172.17.0.1, server: 0.0.0.0:1935

Noticed the acodes=0 . Does this mean that it doesn't like opus codec?

Below is my nginx.conf:

rtmp {
    server {
        listen 1935;
        chunk_size 4096;
        application hopefm {
            live on;
            interleave on;

            hls on;
            hls_path /mnt/hls;
            hls_fragment 3;
            hls_playlist_length 60;
        }
    }
}

Thanks for any help.

Found out why it is not working. The correct command should be

ffmpeg -protocol_whitelist file,udp,rtp  -i test-audio.sdp  
-c:a aac  -f flv rtmp://<server_ip>/live/<stream_name>

I was missing the -f flv and also flash doesn't like opus either, I needed to specify aac instead.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM