nginx-rtmp-module
nginx-rtmp-module copied to clipboard
A/V gets desynced when distributing a live stream
I have the following setup:
- live enocoder running on Windows with Wirecast
- six nginx-rtmp-module servers
The live encoder publishes an audio/video stream to the first nginx-rtmp-module server, which then distributes the stream to the five other servers. Clients get the stream from one of those five servers.
This works very well. However, sometimes it happens that the live streams delivered to end users get out of sync. I have experienced this affecting either the connection from the live encoder to the first server, or the connections from the first server to the other five servers.
When this happens, the "A-V" value in the statistics output of the affected connection displays a negative value. I have seen values from -800 to -3500. However, the vaule in the "Dropped" column stays at zero.
I have seen this behaviour on a very current software version (nginx-rtmp-module 0.9.18 on nginx 1.4.0) as well as an older one (nginx-rtmp-module 0.9.11 on nginx 1.2.6). I have tried "push" and "pull" methods for the distribution between the servers, without a difference.
I have also tried to use an external program to distribute the stream:
ffmpeg -i rtmp://server_1/live/stream -acodec copy -vcodec copy -f flv rtmp://server_2/live/stream
which also showed identical beahviour.
I have tried various values for the "sync" parameter, without any apparent effect. Probably this is the case because there is no actual "drop".
I have also tried "interleave on", but immediately turned it off again, because this caused audio "crackling" noises when accessing the stream via HLS.
Has anyone else seen this behaviour?
Is there anything I can do?
Kind regards,
Andreas Trottmann