Kurento -> ffmpeg -> nginx rtmp latency

3,000 views
Skip to first unread message

j....@howcloud.co.uk

unread,
May 24, 2015, 7:27:51 AM5/24/15
to kur...@googlegroups.com
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.

Sam Khan

unread,
May 24, 2015, 9:44:59 AM5/24/15
to kur...@googlegroups.com, j....@howcloud.co.uk
Hi,

we have a simpler app which has an issue that could be related to your issue

we are doing: WebRTC > KMS > AWS S3

when we run the app we can see the live stream in the browser but the file that gets created in S3 has the first few seconds of the stream chopped off because it takes some time to create the sdp session. so i suspect that you could be seeing a stream that actually started a few seconds later than your expectation. perhaps. 

best,
sam 

hank

unread,
Jun 6, 2016, 3:47:53 AM6/6/16
to kurento
Hi.

  Could you tell me how to do it ?
    WebRTC -> Kurento -> RTP -> ffmpeg -> rtmp -> nginx rtmp server

  I also do similar work, but don't konw how to do that !

  Thanks

在 2015年5月24日星期日 UTC+8下午7:27:51,j....@howcloud.co.uk写道:

Sanket Mehta

unread,
Aug 12, 2017, 2:47:09 AM8/12/17
to kurento, j....@howcloud.co.uk
Hello,

I am trying to access stream from kurento to ffmpeg but dont have luck. I am using following code to generate offer. Can anyone please help?


MediaPipeline pipeline = kurento.createMediaPipeline();
WebRtcEndpoint webRtcEndpoint = new WebRtcEndpoint.Builder(pipeline).build();
webRtcEndpoint
.connect(webRtcEndpoint);

RtpEndpoint rtpEndpoint = new RtpEndpoint.Builder(pipeline).build();

String rtcSdpOffer = "v=0\n" +
       
"o=- 0 0 IN IP4 127.0.0.1\n" +
       
"s=Kurento\n" +
       
"c=IN IP4 127.0.0.1\n" +
       
"t=0 0\n" +
       
"m=video 46784 RTP/AVP 100\n" +
   
"a=rtpmap:100 H264/90000\n" +
       
"a=recvonly";
String rtcSdpAnswer = rtpEndpoint.processOffer(rtcSdpOffer);

webRtcEndpoint
.connect(rtpEndpoint);

console
.log(rtcSdpAnswer);


In output of rtcEndPoint output i get following.

v=0
o
=- 3711506820 3711506820 IN IP4 192.168.0.199
s
=Kurento Media Server
c
=IN IP4 192.168.0.199
t
=0 0
m
=video 2730 RTP/AVP 100
a
=rtpmap:100 H264/90000
a
=sendonly
a
=ssrc:1614090344 cname:user1105350959@host-50c074d0

I saved that in file and opened with ffmpeg and also with vlc. But i cant get stream.

Thank you.


On Sunday, May 24, 2015 at 4:57:51 PM UTC+5:30, j....@howcloud.co.uk wrote:
Reply all
Reply to author
Forward
0 new messages