How to set SDP for RTP streaming

This forum is about all development around libVLC.
dani924
New Cone
New Cone
Posts: 3
Joined: 29 Mar 2019 11:25

How to set SDP for RTP streaming

Postby dani924 » 05 Jun 2019 18:19

I'm trying to play video received over RTP from SIP client. I'm using LibVLCSharp for UWP.
This is the code I used:

Code: Select all

public MainPage() { this.InitializeComponent(); Loaded += (s, e) => { _libVLC = new LibVLC(VideoView.SwapChainOptions); _mediaPlayer = new MediaPlayer(_libVLC); VideoView.MediaPlayer = _mediaPlayer; this._mediaPlayer.Play(new Media(_libVLC, "rtp://@10.2.4.108:15012", FromType.FromLocation)); }; }

But there is error
main demux error: SDP required
main demux error: A description in SDP format is required to receive the RTP stream. Note that rtp:// URIs cannot work with dynamic RTP payload format (96).
rtp demux debug: unknown payload (96)

Adding "--rtp-dynamic-pt=96" into options parameter when creating new LibVLC didn't help.

I have SDP but I don't know how to "give it" to VLC. Is there a way to pass it as a parameter somewhere?
I thought that saving SDP file as .sdp and then instancing Media with sdp location and type = FromType.FromPath could work
but line below crashes application

Code: Select all

this._mediaPlayer.Play(new Media(_libVLC, "ms-appx:///NewFolder1/sdp file.sdp", FromType.FromPath));

Rémi Denis-Courmont
Developer
Developer
Posts: 15266
Joined: 07 Jun 2004 16:01
VLC version: master
Operating System: Linux
Contact:

Re: How to set SDP for RTP streaming

Postby Rémi Denis-Courmont » 05 Jun 2019 22:24

Write the SDP to a file and give the file URI to LibVLC. Alternatively, prepend "sdp://" to the raw SDP and use that as media location.
Rémi Denis-Courmont
https://www.remlab.net/
Private messages soliciting support will be systematically discarded

ikcontrols
New Cone
New Cone
Posts: 1
Joined: 24 Jun 2019 11:32

Re: How to set SDP for RTP streaming

Postby ikcontrols » 24 Jun 2019 11:34

Hi,
SIP protocol is used to initiate a session between two endpoints: it does not carry any voice or video data (stream) itself, it only allows two endpoints to set up connection (using SDP incapsulated in SIP messages) to transfer that traffic (voice or video) between each other via other protocol.

dani924
New Cone
New Cone
Posts: 3
Joined: 29 Mar 2019 11:25

Re: How to set SDP for RTP streaming

Postby dani924 » 04 Jul 2019 17:14

Hi,
SIP protocol is used to initiate a session between two endpoints: it does not carry any voice or video data (stream) itself, it only allows two endpoints to set up connection (using SDP incapsulated in SIP messages) to transfer that traffic (voice or video) between each other via other protocol.

Hi, yes I know that SIP is only used for session initiation. But after session is initialized two SIP clients will start exchanging audio/video encapsulated in RTP packets between themselves.
I need to play video received from other client in UWP app.

I tried playing video via libVLCSharp using

Code: Select all

this._mediaPlayer.Play(new Media(_libVLC, "rtp://@10.2.4.108:15012", FromType.FromLocation));
But it asked me for SDP.
So since I have SDP from session initialization phase I wanted to use that SDP as a source for VLC.

When I entered sdp://my_sdp as network URL into VLC desktop app it start playing video that SIP client is sending to me.

But problem I encountered is that it didn't work in code.
I tried code below but it wouldn't play video.
I got this in log:
ps demux warning: this does not look like an MPEG PS stream, continuing anyway
ps demux warning: garbage at input from 225, trying to resync...

Code: Select all

public MainPage() { this.InitializeComponent(); Loaded += (s, e) => { _libVLC = new LibVLC(VideoView.SwapChainOptions); _mediaPlayer = new MediaPlayer(_libVLC); VideoView.MediaPlayer = _mediaPlayer; this._mediaPlayer.Play(new Media(_libVLC, "sdp://v=0 o=- 29878 0 IN IP4 10.2.4.108 s=Visu c=IN IP4 10.2.4.108 t=0 0 m=audio 15000 RTP/AVP 0 a=rtpmap:0 PCMU/8000 m=video 15002 RTP/AVP 115 a=rtpmap:115 H263-1998/90000/90000 a=fmtp:115 VGA=2;CIF=1;QCIF=1;CIF4=2;I=1;J=1;T=1", FromType.FromLocation)); };

Turns out problem was that I put SDP in one line so it didn't have new line separators.
When I changed it to code below it started working.
Maybe this helps someone who has the same problem in the future.

Code: Select all

this._mediaPlayer.Play(new Media(_libVLC, "sdp://" + "v=0\n" + "o=-29878 0 IN IP4 10.2.4.108\n" + "s=Visu\n" + "c=IN IP4 10.2.4.108\n" + "t=0 0\n" + "m=audio 15000 RTP/AVP 0\n" + "a=rtpmap:0 PCMU/8000\n" + "m=video 15002 RTP/AVP 115\n" + "a=rtpmap:115 H263-1998/90000/90000\n" + "a=fmtp:115 VGA=2;CIF=1;QCIF=1;CIF4=2;I=1;J=1;T=1" , FromType.FromLocation));


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 23 guests