TareqAlqutami/rtmp-hls-server

How can I create multiple RTMP **push** link??

siavashfazli opened this issue · 2 comments

Hi dear!!
I have a video source and I need to share it with several RTMP links.
How can I config this?
ONE video source push to multiple RTMP links!!

Have you tried using FFmpeg. It is capable of doing that. You can see an example in the current config file where it is used to transcode and push a received rtmp into multiple RTMP streams. I am not sure what is your video source type but most probably ffmpeg will support it.

# for each received stream, transcode for adaptive streaming
# This single ffmpeg command takes the input and transforms
# the source into 4 different streams with different bitrates
# and qualities. 
exec_push  /usr/local/bin/ffmpeg -i rtmp://localhost:1935/$app/$name -async 1 -vsync -1
		-c:v libx264 -c:a aac -b:v 256k  -b:a 64k  -vf "scale=480:trunc(ow/a/2)*2"  -tune zerolatency -preset superfast -crf 23 -f flv rtmp://localhost:1935/show/$name_low
		-c:v libx264 -c:a aac -b:v 768k  -b:a 128k -vf "scale=720:trunc(ow/a/2)*2"  -tune zerolatency -preset superfast -crf 23 -f flv rtmp://localhost:1935/show/$name_mid
		-c:v libx264 -c:a aac -b:v 1024k -b:a 128k -vf "scale=960:trunc(ow/a/2)*2"  -tune zerolatency -preset superfast -crf 23 -f flv rtmp://localhost:1935/show/$name_high
		-c:v libx264 -c:a aac -b:v 1920k -b:a 128k -vf "scale=1280:trunc(ow/a/2)*2" -tune zerolatency -preset superfast -crf 23 -f flv rtmp://localhost:1935/show/$name_hd720
		-c copy -f flv rtmp://localhost:1935/show/$name_src;	

just add multiple push statements in the application config:

 application live {
      live on; # Allows live input
      drop_idle_publisher 10s; # Drop Publishing connections that havnt sent any stream data for over 10 seconds
      
      # Local push for built in players
      push rtmp://localhost:1935/show;
      
      # YouTube
      push rtmp://a.rtmp.youtube.com/live2/<stream_key>;
}