Play stream using VLC Mesdia Player

About encoding, codec settings, muxers and filter usage
chamanlata
Blank Cone
Blank Cone
Posts: 17
Joined: 19 Feb 2019 06:16

Play stream using VLC Mesdia Player

Postby chamanlata » 21 Feb 2019 07:05

I am just using this code to play a stream .but this code is not running please help

Code: Select all

libvlc_instance_t * inst; libvlc_media_player_t *mp; libvlc_media_t *m; /* Load the VLC engine */ inst = libvlc_new (0, NULL); /* Create a new item */ m = libvlc_media_new_path (inst, "rtp://10.0.0.1:5100/Video2"); //m = libvlc_media_new_path (inst, "/path/to/test.mov"); mp = libvlc_media_player_new_from_media (m); libvlc_media_player_play (mp);

unidan
Developer
Developer
Posts: 1493
Joined: 25 Mar 2018 01:00

Re: Play stream using VLC Mesdia Player

Postby unidan » 21 Feb 2019 10:27

Hi, what do you mean by "it's not running" ?

chamanlata
Blank Cone
Blank Cone
Posts: 17
Joined: 19 Feb 2019 06:16

Re: Play stream using VLC Mesdia Player

Postby chamanlata » 21 Feb 2019 11:29

Hi,
Now my code is working fine and video is playing successfully .but the issue now is that it just play the video for the time dfepend on Sleep function.How can I play it without sleep function until it is finished
libvlc_instance_t * inst;
libvlc_media_player_t *mp;
libvlc_media_t *m;

/* Load the VLC engine */
inst = libvlc_new (0, NULL);

/* Create a new item */
m = libvlc_media_new_path (inst, "rtp://10.0.0.1:5100/Video2");
//m = libvlc_media_new_path (inst, "/path/to/test.mov");

mp = libvlc_media_player_new_from_media (m);

libvlc_media_player_play (mp);
Sleep(30000)

unidan
Developer
Developer
Posts: 1493
Joined: 25 Mar 2018 01:00

Re: Play stream using VLC Mesdia Player

Postby unidan » 21 Feb 2019 13:41

You have to add a callback to wait for the end, block your thread on a semaphore and release it in the callback.

check these functions:
https://www.videolan.org/developers/vlc ... 082b38948e
https://www.videolan.org/developers/vlc ... fd2387f2cc
https://www.videolan.org/developers/vlc ... c56f4cf766

chamanlata
Blank Cone
Blank Cone
Posts: 17
Joined: 19 Feb 2019 06:16

Re: Play stream using VLC Mesdia Player

Postby chamanlata » 26 Feb 2019 11:40

Hi @unidan
when I am using the stream like for mms:// or with rtsp:// they all are worked fine but if I am using rtp stream then got the error"VLC is unable to play invalid mrl"
Please help !!
m = libvlc_media_new_path (inst, "rtp://@10.0.0.1:5100/Video2");

unidan
Developer
Developer
Posts: 1493
Joined: 25 Mar 2018 01:00

Re: Play stream using VLC Mesdia Player

Postby unidan » 26 Feb 2019 11:59

Please give more logs. Does it works with VLC ?

chamanlata
Blank Cone
Blank Cone
Posts: 17
Joined: 19 Feb 2019 06:16

Re: Play stream using VLC Mesdia Player

Postby chamanlata » 27 Feb 2019 04:39

These are the logs whenever I am trying to use the play any RTP address.

[032569dc] main demux error: socket bind error (Cannot assign requested address)
[032569dc] main demux error: socket bind error (Cannot assign requested address)
[030305bc] main input error: open of `rtp://@10.0.0.1:5100/Video2' failed
[030305bc] main input error: Your input can't be opened
[030305bc] main input error: VLC is unable to open the MRL 'rtp://@10.0.0.1:5100/Video2'.

chubinou
Developer
Developer
Posts: 521
Joined: 23 Jul 2015 15:19

Re: Play stream using VLC Mesdia Player

Postby chubinou » 27 Feb 2019 09:49

Hi,

Is 10.0.0.1 the address of your player? RTP works by opening a port on your client and waiting for the server to send you packets on this port.

RTP address are usually something like rtp://my.ip.add.ress:port/

chamanlata
Blank Cone
Blank Cone
Posts: 17
Joined: 19 Feb 2019 06:16

Re: Play stream using VLC Mesdia Player

Postby chamanlata » 27 Feb 2019 12:07

rtp://10.0.0.1:5100/Video2 is the address from where I have to receive the Live stream in VLC.But I am Not able to do that.
I already open the port No 5100 and I also tried with the format rtp://@:5100\Video2 but it is also not working?

chubinou
Developer
Developer
Posts: 521
Joined: 23 Jul 2015 15:19

Re: Play stream using VLC Mesdia Player

Postby chubinou » 27 Feb 2019 14:38

How is your streamer configured?

either it sends you the stream in unicast (or broadcast) to your player (then you can use rtp://@:5100)
or it sends the stream to a multicast address (ie: 239.0.0.1), then you should put rtp://239.0.0.1:5100/

chamanlata
Blank Cone
Blank Cone
Posts: 17
Joined: 19 Feb 2019 06:16

Re: Play stream using VLC Mesdia Player

Postby chamanlata » 28 Feb 2019 06:05

Yes, It is worked For me. Thank you for your time RTP://@:5100


Return to “VLC stream-output (sout)”

Who is online

Users browsing this forum: No registered users and 13 guests