illuspas / Node-Media-Server

A Node.js implementation of RTMP/HTTP-FLV/WS-FLV/HLS/DASH/MP4 Media Server
https://www.npmjs.com/package/node-media-server
MIT License
6k stars 1.53k forks source link

Question : RTMP still on going when source is stop #55

Open ariemeow opened 6 years ago

ariemeow commented 6 years ago

Hi,

I wanna ask about something. Is it an issue from NMS or ffmpeg i used.

I have 3 servers, lets say :

I push my live stream to Server A, Server B pulling it for transcode it and push the multiple bitrates result to Server A. and then, Server C is pulling multiple bitrates stream from Server A.

When i stop the stream, the main stream is "donePublish"-ing, but the transcoded stream is not finish yet. Is it a cache? or anything else? I've set cache config to false, but it still like that.

If it's not an issue from NMS, it's ok. So i can trace from my FFMPEG.

Thanks!

illuspas commented 6 years ago

I did a local simulation. When a stream is push to A server. I manually open ffmpeg for multiple resolution transcoding.

ffmpeg -i rtmp://192.168.0.10/live/s -s 640x480 -c:v libx264 -tune zerolatency -c:a copy -f flv rtmp://192.168.0.10/live/s_480 -s 320x240 -c:v libx264 -tune zerolatency -c:a copy -f flv rtmp://192.168.0.10/live/s_240

I manually stopped the push on A, ffmpeg ends automatically. What kind of transcode command do you use?

ariemeow commented 6 years ago

something like this

ffmpeg -i [rtmp_input_from_server_A] \ -s 1920x1080 -c:v libx264 -c:a copy -b:v 5000k -preset medium -vprofile main -r 25 -f flv [rtmp_output_to_server_A_with_bitrates_on_streamname] and other qualities on same command but different bitrates and resolutions.

I've got that command from ffmpeg forum, is that command wrong?