Skip to content

rtmp 推流使用不同的域名,但app和Stream一致时,通过配置两个sever,每个 server下配置不同的server_name、serverid和hls_path,当对两个域名同时推rtmp流时发现只能推一个域名的流,另一个会提示"Server error: Already publishing",不知道是配置的原因还是RTMP模块本身就不支持这种方式? #1

@wangjjxuer

Description

@wangjjxuer

rtmp.conf:

rtmp {
fast_reload on;

 server{
     listen        1935 so_keepalive=on;
     serverid server1;
     server_name push.b.com;
	 
     rtmp_auto_pull on;
     rtmp_auto_pull_port unix:/home/orsjitp/nginx/sbin/rtmp;
     max_connections 10240;
     timeout       60s;
     ping          3m;
     ping_timeout  30s;
     max_streams   32; 
     ack_window 5000000;
     chunk_size 4096;
     max_message 10M;
     buflen  1000ms;

    application *{
         hevc_codecid  12;
         hls_fragment_slicing plain;
         hls_continuous on;
         live on;
         hls on;
         hls_path /dev/shm/rtmp/b;
         hls_fragment 10s;
         hls_playlist_length 60s;
         hls_nested on;
         allow publish all;
         allow play all;
         exec_options off;
         meta   on;
         interleave on;             
         wait_key    on;
         wait_video  on;
         publish_notify  on;
         drop_idle_publisher 10s;
         sync  10ms;
         play_restart off;
         idle_streams on;
    }
}

 server{
     listen        1935 so_keepalive=on;
     serverid server2;
     server_name push.m.com;

     rtmp_auto_pull on;
     rtmp_auto_pull_port unix:/home/orsjitp/nginx/sbin/rtmp;
     max_connections 10240;
     timeout       60s;
     ping          3m;
     ping_timeout  30s;
     max_streams   32; 
     ack_window 5000000;
     chunk_size 4096;
     max_message 10M;
     buflen  1000ms;

    application *{
         hevc_codecid  12;
         hls_fragment_slicing plain;
         hls_continuous on;
         live on;
         hls on;
         hls_path /dev/shm/rtmp/m;
         hls_fragment 10s;
         hls_playlist_length 60s;
         hls_nested on;
         allow publish all;
         allow play all;
         exec_options off;
         meta   on;
         interleave on;             
         wait_key    on;
         wait_video  on;
         publish_notify  on;
         drop_idle_publisher 10s;
         sync  10ms;
         play_restart off;
         idle_streams on;
    }
}

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions