I'm working on hacking together a fairly simple media processing pipeline which takes WebRTC and eventually streams rtmp out the other end. The process looks like this at the moment:
WebRTC -> Kurento -> RTP -> ffmpeg -> rtmp -> nginx rtmp server
It works! The only problem is latency - there's a 3 second or more 'lag' between 'reality' and the stream when I receive it. I wondered if anyone else is doing something similar and could share some tips?
From my debugging I don't actually think the issue is Kurento. If I record the rtp stream that kurento spits out then the lag experienced is < 1 second. Which is perfectly acceptable. The latency seems to be introduced when I push the feed from ffmpeg to my rtmp server (not even during the transcoding process).
The command I am using on ffmpeg is:
ffmpeg -fflags +genpts -analyzeduration 2148M -probesize 2148M -i test.sdp -c:v libx264 -x264opts keyint=5:min-keyint=1 -c:a aac -strict -2 -f flv rtmp://localhost/testing/test
I have actually gone into quite a bit of detail around my tests/deductions on the ffmpeg forum (
http://ffmpeg.gusari.org/viewtopic.php?f=11&t=2127) but I was hoping there would be other users on here who have achieved or are trying to achieve similar and could share their experience with me on getting as 'real time' an rtmp stream out what started as a Kurento WebRTC endpoint.