RTSP to WebRtc

1,364 views
Skip to first unread message

robert.corolea...@gmail.com

unread,
Nov 9, 2015, 4:33:50 AM11/9/15
to kurento
Hello.
 First of all I want to apologize for opening the same question then deleting it. I wanted to delete a public IP I posted by mistake but I could not edit my question nor delete it all together.
   I have a simple setup where I use a PlayerEndpoint to get a RTSP stream from an IP camera and then stream it through an WebRtcEndpoint to a browser client. My problem is that I cannot seem to get any data on the client. On the browser side I only get a empty dark video and nothing else. I've looked around at other posts that had similar setup but I can't get mine to work. All I did was: create pipeline->create player endpoint with appropriate RTSP uri->play the player endpoint->create webrtc endpoint->sdp and ice->connect player to webrtc.

My code:
pipeline.create('PlayerEndpoint', {uri: rtsp_uri},  function(error, playerEndpoint) {
                   
if (error) {
                       
return callback(error);
                   
}

                    playerEndpoint
.on('EndOfStream', function() {
                        console
.log('END OF STREAM');
                        pipeline
.release();
                   
});

                    playerEndpoint
.play(function(error){
                       
if(error){
                            console
.log(error);
                           
return;
                       
}

                        console
.log("Playing");
                           pipeline
.create('WebRtcEndpoint', function(error, webRtcEndpoint) {
                           
if (error) {
                               
return callback(error);
                           
}

                            setTimeout
(function(){
                               
while(viewerCandidates.length > 0){
                                   
var curCandidate = viewerCandidates.shift();
                                    webRtcEndpoint
.addIceCandidate(curCandidate);
                                    console
.log('viewer got ICE');
                               
}
                           
}, 2000);

                            webRtcEndpoint
.on('OnIceCandidate', function(event) {
                               
var candidate = kurento.register.complexTypes.IceCandidate(event.candidate);
                                ws
.send(JSON.stringify({
                                    action
: 'iceCandidate',
                                    candidate
: candidate
                               
}));
                           
});

                            webRtcEndpoint
.processOffer(sdpOffer, function(error, sdpAnswer) {
                               
if (error) {
                                   
return callback(error);
                               
}

                                playerEndpoint
.connect(webRtcEndpoint, function(error) {
                                   
if (error) {
                                       
return callback(error);
                                   
}

                                    console
.log('Connected viewer to RTSP!');
                                    viewer
= newViewer;
                                    callback
(null, sdpAnswer);                                
                               
});

                                webRtcEndpoint
.gatherCandidates(function(error) {
                                   
if (error) {
                                       
return callback(error);
                                   
}
                               
});
                           
});
                       
});
                   
});
               
});
I would like to mention that the IP camera streams in h.264 format.
Thank you in advance.

robert.corolea...@gmail.com

unread,
Nov 9, 2015, 5:22:12 AM11/9/15
to kurento, robert.corolea...@gmail.com
Update:
It seems that if I change the video codec of the IP camera from h.264 to MJPEG it works. So does that mean KMS can't convert from h.264 to vp8?

Ivan Gracia

unread,
Nov 9, 2015, 8:43:31 AM11/9/15
to Kurento Public, robert.corolea...@gmail.com
It can and does. Transocidifications are working for sure. We are transcoding from VP8 to h.264 by connecting a WebRTC endpoint to an RTP endpoint in a couple of setups. This could be related to the h.264 codec and configuration that you have in your machine, something related with the profile. Could you check which codec you are using, in case you are using something different than the one that comes installed?

It could be very helpful if you could provide us with a GStreamer dot with your faulty transcodification. This can be achieved by invoking the method getGStreamerDot on the pipeline. This will return a string, that you can save in a file and attach to an email.

Cheers,

Ivan Gracia



On Mon, Nov 9, 2015 at 11:22 AM, <robert.corolea...@gmail.com> wrote:
Update:
It seems that if I change the video codec of the IP camera from h.264 to MJPEG it works. So does that mean KMS can't convert from h.264 to vp8?

--
You received this message because you are subscribed to the Google Groups "kurento" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kurento+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

robert.corolea...@gmail.com

unread,
Nov 23, 2015, 2:28:43 AM11/23/15
to kurento, robert.corolea...@gmail.com
Hi Ivan.
   I tried what you've told me but I get this: "Object #<MediaPipeline> has no method 'getGStreamerDot'".
 The thing is I used the VP8 to H.264 (WebRtc to RTP) transcoding in another project too and it worked, but I can't seem to make it work the other way around. When I change to codec of the IP camera to MJPEG or MPEG4 it works, but not on H.264.

robert.corolea...@gmail.com

unread,
Nov 23, 2015, 2:34:35 AM11/23/15
to kurento, robert.corolea...@gmail.com
UPDATE: It seems the methos is "getGstreamerDot" with lowercase S. My bad!
it outputed this:

{ _id: 32,
  _state: undefined,
  _result: undefined,
  _subscribers: [] }

Ivan Gracia

unread,
Nov 24, 2015, 5:47:27 AM11/24/15
to Kurento Public, robert.corolea...@gmail.com

Sorry, I got that typo in the name :-) Is that the only thing you get invoking getGstreamerDot on the pipeline? How are you invoking that? You should do something like this

object.getGstreamerDot(function(error, dot) {
});

Ivan Gracia



--

robert.corolea...@gmail.com

unread,
Nov 24, 2015, 10:43:42 AM11/24/15
to kurento, robert.corolea...@gmail.com
Sorry, I was using the method sync mode.
Here is what I get:

digraph pipeline {
  rankdir
=LR;
  fontname
="sans";
  fontsize
="10";
  labelloc
=t;
  nodesep
=.1;
  ranksep
=.2;
  label
="<GstPipeline>\npipeline68\n[>]";
  node
[style="filled,rounded", shape=box, fontsize="9", fontname="sans", margin="0.0,0.0"];
  edge
[labelfontsize="6", fontsize="9", fontname="monospace"];

  legend
[
    pos
="0,0!",
    margin
="0.05,0.05",
    style
="filled",
    label
="Legend\lElement-States: [~] void-pending, [0] null, [-] ready, [=] paused, [>] playing\lPad-Activation: [-] none, [>] push, [<] pull\lPad-Flags: [b]locked, [f]lushing, [b]locking; upper-case is set\lPad-Task: [T] has started task, [t] has paused task\l",
 
];
}



Ivan Gracia

unread,
Nov 25, 2015, 9:45:23 AM11/25/15
to Kurento Public, robert.corolea...@gmail.com
That's an empty dot. Were you running the application? You need to generate that file when the application is running, and when you see the problem.

Ivan Gracia



robert.corolea...@gmail.com

unread,
Nov 26, 2015, 4:04:31 AM11/26/15
to kurento, robert.corolea...@gmail.com
Oh sorry. I did not know that. I got the info again with the application running and a player endpoint that gets the stream from an ip camera (rtsp uri) and is connected to an WebRtc endpoint. As always the video is black on the client with webrtc(unless the ip camera sends MPEG4 or MJPEG). I attached the file.
log-211b4aa0-941c-11e5-a767-95ec2409e8cd.txt

Ivan Gracia

unread,
Nov 26, 2015, 4:24:27 AM11/26/15
to Kurento Public, robert.corolea...@gmail.com
Cool, thanks! 

One more thing, what version of KMS are you using? Did you check with the latest release?

Ivan Gracia



On Thu, Nov 26, 2015 at 10:04 AM, <robert.corolea...@gmail.com> wrote:
Oh sorry. I did not know that. I got the info again with the application running and a player endpoint that gets the stream from an ip camera (rtsp uri) and is connected to an WebRtc endpoint. As always the video is black on the client with webrtc(unless the ip camera sends MPEG4 or MJPEG). I attached the file.

--

robert.corolea...@gmail.com

unread,
Nov 26, 2015, 6:19:38 AM11/26/15
to kurento, robert.corolea...@gmail.com
I have KMS 6. I think I have the latest release because I installed it on this server around 1 week ago with the instructions from here. I think the kurento-client node js api may be a bit older but I'm not sure. I changed allot of servers since I've been using Kurento and I zip the whole folder with modules and all then put it on the new server.

Ivan Gracia

unread,
Nov 26, 2015, 6:34:50 AM11/26/15
to Kurento Public, robert.corolea...@gmail.com

Ok. I have some checks for you then

  • Do a sudo apt-get update && sudo apt-get upgrade
  • Post the output of dpkg -l | egrep -i "kurento|gstreamer|nice"
  • Check your setup with this project. We’ve done that, and got your h264 camera stream ok
  • If that works, check with your project.

Let us know what are the results of this.

Also, I'd suggest you manage kurento-client libraries as dependencies, and don't go copying those around as you won't be updated, and can have incompatibilities.

Ivan Gracia



On Thu, Nov 26, 2015 at 12:19 PM, <robert.corolea...@gmail.com> wrote:
I have KMS 6. I think I have the latest release because I installed it on this server around 1 week ago with the instructions from here. I think the kurento-client node js api may be a bit older but I'm not sure. I changed allot of servers since I've been using Kurento and I zip the whole folder with modules and all then put it on the new server.

--

robert.corolea...@gmail.com

unread,
Nov 26, 2015, 7:04:42 AM11/26/15
to kurento, robert.corolea...@gmail.com
Thank you. I will try the new project and come back with results.
Here is the output:

ii  gstreamer1.5-libav:amd64             1.5.2.1~20150901123759.34.g07a7b16.trusty  amd64        libav plugin for GStreamer
ii  gstreamer1
.5-nice:amd64              0.1.7.1~20151125151103.10.ge060eb5.trusty  amd64        ICE library (GStreamer plugin)
ii  gstreamer1
.5-plugins-bad:amd64       1.7.0.1~20151125150916.398.g6825611.trusty amd64        GStreamer plugins from the "bad" set
ii  gstreamer1
.5-plugins-base:amd64      1.7.0.1~20151125150805.140.g2b445d5.trusty amd64        GStreamer plugins from the "base" set
ii  gstreamer1
.5-plugins-good:amd64      1.7.0.1~20151125150841.141.g0708286.trusty amd64        GStreamer plugins from the "good" set
ii  gstreamer1
.5-plugins-ugly:amd64      1.7.0.1~20151126085656.24.g9ec26a4.trusty  amd64        GStreamer plugins from the "ugly" set
ii  gstreamer1
.5-pulseaudio:amd64        1.7.0.1~20151125150841.141.g0708286.trusty amd64        GStreamer plugin for PulseAudio
ii  gstreamer1
.5-x:amd64                 1.7.0.1~20151125150805.140.g2b445d5.trusty amd64        GStreamer plugins for X11 and Pango
ii  kms
-core-6.0                         6.2.0.trusty                               amd64        Kurento core module
ii  kms
-elements-6.0                     6.2.0.trusty                               amd64        Kurento elements module
ii  kms
-filters-6.0                      6.2.0.trusty                               amd64        Kurento filters module
ii  kms
-jsonrpc-1.0                      1.0.1.trusty                               amd64        Kurento jsonrpc library
ii  kmsjsoncpp                          
1.6.3~20151125151041.38.g263929e.trusty    amd64        Kurento jsoncpp library
ii  kurento
-media-server-6.0             6.1.1.trusty                               amd64        Kurento Media Server
ii  libgstreamer
-plugins-bad1.5-0:amd64  1.7.0.1~20151125150916.398.g6825611.trusty amd64        GStreamer development files for libraries from the "bad" set
ii  libgstreamer
-plugins-base1.5-0:amd64 1.7.0.1~20151125150805.140.g2b445d5.trusty amd64        GStreamer libraries from the "base" set
ii  libgstreamer1
.5-0:amd64              1.7.0.1~20151125150753.298.g6d22bfb.trusty amd64        Core GStreamer libraries and elements
ii  libnice10
:amd64                      0.1.7.1~20151125151103.10.ge060eb5.trusty  amd64        ICE library (shared library)
ii  openwebrtc
-gst-plugins               0.10.0~20151125150950.100.g61cc54b.trusty  amd64        OpenWebRTC specific GStreamer plugins


Ivan Gracia

unread,
Nov 26, 2015, 7:20:09 AM11/26/15
to Kurento Public, robert.corolea...@gmail.com
ii  kms-filters-6.0                      6.2.0.trusty                               amd64        Kurento filters module

ii  kurento
-media-server-6.0             6.1.1.trusty                               amd64        Kurento Media Server

Those version numbers don’t feel right. Your kurento-media-server-6.0 package is not matching the rest of the packages. Please make sure no packages have been kept back. You might have to run sudo apt-get dist-upgrade


Ivan Gracia



robert.corolea...@gmail.com

unread,
Nov 26, 2015, 7:26:43 AM11/26/15
to kurento, robert.corolea...@gmail.com
Ok. After I updated and upgraded and tested your project(which worked), my project works too now. Its weird since I thought I had the latest version, but it seems it was my mistake.
Thank you again and sorry for all the trouble. Now I will try and get the newest everything so I won't have problems.

Ivan Gracia

unread,
Nov 26, 2015, 7:47:39 AM11/26/15
to kurento, robert.corolea...@gmail.com
No worries! Checking against the latest should be the first option ;-)
On jue, 26 nov 2015 at 13:26, <robert.corolea...@gmail.com> wrote:
Ok. After I updated and upgraded and tested your project(which worked), my project works too now. Its weird since I thought I had the latest version, but it seems it was my mistake.
Thank you again and sorry for all the trouble. Now I will try and get the newest everything so I won't have problems.

--
Reply all
Reply to author
Forward
0 new messages