Server Side Recording rtsp stream ( or at least WebRTC)

1,057 views
Skip to first unread message

GeorgeTheKing

unread,
May 21, 2022, 9:34:19 PM5/21/22
to kurento
Hello.

I have an rtsp stream that I'm looking to stream and record, I started with https://github.com/lulop-k/kurento-rtsp2webrtc and I see in the maliinglist that rtsp2webrtc can be later on enhanced to do the recording as well. Not sure if this is the best approach, but this is the best I/m aware of.

When I use the rtsp2webrtc project, with very minor changes to fix how the ire servers are pulled,  I get the below error when I start to play the rtsp stream:

2022-05-22T01:16:10.483036383Z 6:21:42.750001709     1 0x7fbea4003190 ERROR         playerendpoint kmsplayerendpoint.c:696:kms_player_end_point_add_appsrc: Cannot link elements: appsrc2 to kmsplayerendpoint0_kmsagnosticbin2-2
2022-05-22T01:16:10.484777630Z 6:21:42.751797608     1 0x7fbe30001ca0 WARN                 basesrc gstbasesrc.c:2948:gst_base_src_loop:<appsrc2> error: Internal data flow error.
2022-05-22T01:16:10.484789710Z 6:21:42.751812506     1 0x7fbe30001ca0 WARN                 basesrc gstbasesrc.c:2948:gst_base_src_loop:<appsrc2> error: streaming task paused, reason not-linked (-1)
2022-05-22T01:16:10.484941774Z 6:21:42.751917146     1 0x55c4cb7a3330 ERROR   KurentoMediaElementImpl MediaElementImpl.cpp:456:processBusMessage:<kmsplayerendpoint0> Error code 1: Internal data flow error., source: appsrc2, element: kmsplayerendpoint0, debug info: gstbasesrc.c(2948): gst_base_src_loop (): /GstPipeline:pipeline2/KmsPlayerEndpoint:kmsplayerendpoint0/GstAppSrc:appsrc2:
2022-05-22T01:16:10.484965086Z streaming task paused, reason not-linked (-1)

Does anybody have any insight on what could be wrong or where I should heck for more details?

Thank you.

Juan Navarro

unread,
May 23, 2022, 6:52:19 AM5/23/22
to kur...@googlegroups.com
That's a 7 years old example

The more modern version of that is the Kurento Player tutorial:

https://doc-kurento.readthedocs.io/en/latest/user/tutorials.html#webrtc-media-player

This, together with the Hello World Recording tutorial:

https://doc-kurento.readthedocs.io/en/latest/user/tutorials.html#webrtc-recording

should be enough to get the basic concepts of Kurento. Basically, to use a PlayerEndpoint, and connect it to a WebRtcEndpoint and/or a RecorderEndpoint.


I'd first use the Player tutorial to confirm that your RTSP stream can be played back. If that works, then add the RecorderEndpoint to start recording to files.


Regards
--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/kurento/094082f3-fc4c-4773-88c6-213383bc206en%40googlegroups.com.

GeorgeTheKing

unread,
May 23, 2022, 7:29:46 AM5/23/22
to kurento
Thank you Jun. Will follow your recommendations.

GeorgeTheKing

unread,
May 23, 2022, 5:23:57 PM5/23/22
to kurento
It seems like the java code is not working for me, even in JS code I need to pass the TURN server information, I don't seem to find anything about this in the java client, is that still required?

I have attached the player log file to this email.
I also attached the information that chrome provides in "about://webrtc-internals"

This is when I stream the rtsp using the JS client - using  https://github.com/lulop-k/kurento-rtsp2webrtc
   "pid":, 97095 - working

This is when I stream the rtsp using the java client - using https://github.com/Kurento/kurento-tutorial-java
   "pid": 97811 - not working

Is the kurento-java client in github? I tried to look for the source code and see if I can figure out anything about the ICE Servers.

Thank you.

webrtc_internals_dump (2).txt
player_log.txt

GeorgeTheKing

unread,
May 23, 2022, 5:35:15 PM5/23/22
to kurento
After I sent the email I realized that the change needs to be done on the client side, in the JS client. I updated: https://github.com/Kurento/kurento-tutorial-java/blob/master/kurento-player/src/main/resources/static/js/index.js#L108 and now it works.

GeorgeTheKing

unread,
May 23, 2022, 5:43:02 PM5/23/22
to kurento
I'm still getting:

2022-05-23 21:41:12.307  INFO 59 --- [ventExec-e2-t21] o.kurento.tutorial.player.PlayerHandler  : ErrorEvent: Error code 1: Internal data flow error., source: appsrc75, element: kmsplayerendpoint5, debug info: gstbasesrc.c(2948): gst_base_src_loop (): /GstPipeline:pipeline5/KmsPlayerEndpoint:kmsplayerendpoint5/GstAppSrc:appsrc75:

streaming task paused, reason not-linked (-1)


Mahendra Gurjar

unread,
May 24, 2022, 1:23:49 AM5/24/22
to kur...@googlegroups.com
What parameters do you pass for TURN server details?

GeorgeTheKing

unread,
May 24, 2022, 8:16:14 AM5/24/22
to kurento
On the client side, in JS, I build the:

options.configuration: {
    iceServers: [{"urls":"stun:stun.l.google.com:19302"},{"urls":"turn:TURN_FQDN:3478?transport=udp","username":"USER","credential":"PASS"}]
}

then the options are sent to WebRtcPeerSendrecv or WebRtcPeerRecvonly.

On the server side:

I use the docker version and I pass:

KMS_TURN_URL=USER:PASS@TURN_IP_ADDRESS:3478?transport=udp


TURN_FQDN, TURN_IP_ADDRESS, USER, PASS - above are just placeholders.

I would like to avoid publishing the TURN server in JS, not 100% secure to advertise my TURN SERVER credentials.

Mahendra Gurjar

unread,
May 24, 2022, 8:30:13 AM5/24/22
to kur...@googlegroups.com
Add TURN server with caller and callee end point.

callerWebRtcEndpoint.setTurnUrl()

GeorgeTheKing

unread,
May 24, 2022, 9:59:10 AM5/24/22
to kurento
Thank you, i'll do that.

Juan Navarro

unread,
May 24, 2022, 11:26:46 AM5/24/22
to kur...@googlegroups.com
Looks like if Kurento wasn't able to receive the RTSP stream.

Please try these commands to see what happens. You are using the Docker images, right, in that case,

1. Open up a terminal inside a Kurento Docker container:

docker run --rm -ti --entrypoint /bin/bash kurento/kurento-media-server:latest

2. Ensure that required tools are installed:

apt-get update ; apt-get install \
    gstreamer1.5-{tools,libav} \
    gstreamer1.5-plugins-{base,good,bad,ugly}

3. Set your RTSP URI into an environment variable:

RTSP_URI="rtsp://127.0.0.1:8554/video.sdp"

4. Try to play the RTSP stream with a basic command. Note any warnings or errors:

GST_DEBUG="3,rtspsrc:5" \
gst-launch-1.5 --verbose \
    playbin uri="$RTSP_URI" uridecodebin0::source::latency=500

5. Also try with a bit more complex command with both audio and video (assuming your media includes both audio and video...)

GST_DEBUG="3,rtspsrc:5" \
gst-launch-1.5 --verbose \
    uridecodebin uri="$RTSP_URI" source::latency=500 name=src \
        src. ! "audio/x-raw" ! audioconvert ! fakesink \
        src. ! "video/x-raw" ! videoconvert ! fakesink


If you have a local installation of Ubuntu 16.04 or 18.04 somewhere, you could also run these commands directly, and instead of "fakesink" you can use "autoaudiosink" and "autovideosink" to have the video presented in the screen and speakers. Otherwise we need to send the media to a "fakesink" because inside the Docker container there are no speakers or graphical system, but at least it should allow you to see if there are any errors.


--
Juan Navarro
Kurento developer
@j1elo at GitHub & Twitter

GeorgeTheKing

unread,
May 24, 2022, 11:41:07 AM5/24/22
to kurento
Thank you Juan.
Reply all
Reply to author
Forward
0 new messages