switching hls streams of different bit rates

This forum is about all development around libVLC.
lzuwei
New Cone
New Cone
Posts: 6
Joined: 21 Oct 2013 10:29

switching hls streams of different bit rates

Postby lzuwei » 11 Dec 2013 04:12

I am using libvlc to play hls streams. I am able to play the stream but I am unable to swtich between hls streams present in the .m3u8 files.
However, VLC Player is able to switch between the streams without any issues.

I would like to know if certain settings or library calls need to be made in order to enable adaptive streaming on hls.
Below is what I use to call libvlc assuming I have instantiated the vlc instance to vlc

libvlc_media_new_location(vlc, "http://stream-hls.imrsv.com/twoman/variant.m3u8");

I am using libvlc 2.1.0 Rincewind

Thank you for the help.

sherington
Cone that earned his stripes
Cone that earned his stripes
Posts: 491
Joined: 10 Sep 2008 11:57
VLC version: master
Operating System: Linux

Re: switching hls streams of different bit rates

Postby sherington » 11 Dec 2013 13:39

Generally speaking, when you play a play-list file vlc will parse it to create sub-items (one sub-item for each corresponding item in the playlist) and fire a "finished" event.

libvlc then provides functions to get the sub-items, but you must wait until you get the finished event.

You can then play whichever one you want.

lzuwei
New Cone
New Cone
Posts: 6
Joined: 21 Oct 2013 10:29

Re: switching hls streams of different bit rates

Postby lzuwei » 12 Dec 2013 03:54

I am confused here,
based on what you are saying, after I parse in the playlist file to
libvlc_media_new_location(vlc, "http://stream-hls.imrsv.com/twoman/variant.m3u8");

I will wait for the finished event.
What functions are available to allow me to switch between the streams?

I had the impression that for HLS adaptive streaming, the client and server needs to exchange bandwidth information in order to determine if a change in bitrate is needed.
Does libvlc do that automatically or it requires the user to manually do that on the application code.

If you need to do it manually, how does the libvlc provide the users this information about bandwidth and changing of the streams.

sherington
Cone that earned his stripes
Cone that earned his stripes
Posts: 491
Joined: 10 Sep 2008 11:57
VLC version: master
Operating System: Linux

Re: switching hls streams of different bit rates

Postby sherington » 12 Dec 2013 07:56

I can't speak to the detail of how your adaptive streaming works, I have no idea, what I'm telling you is what happens generally when you "play" a playlist, to try and give you a pointer.

Each item in the playlist is an opaque libvlc_media_t, and libvlc provides functions, as per the documentation linked in this very forum, to get those individual items from the playlist, and play them, and even get meta data from them.

That's as much as I know on this subject.

lzuwei
New Cone
New Cone
Posts: 6
Joined: 21 Oct 2013 10:29

Re: switching hls streams of different bit rates

Postby lzuwei » 12 Dec 2013 17:35

Thank you for you help sherington,
I will look into the playlist API in libvlc and VLC source codes to get an idea how vlc player does the adaptive switching.

If anyone else has an idea on how to do this, I really appreciate the help.

sherington
Cone that earned his stripes
Cone that earned his stripes
Posts: 491
Joined: 10 Sep 2008 11:57
VLC version: master
Operating System: Linux

Re: switching hls streams of different bit rates

Postby sherington » 12 Dec 2013 21:28

Hmmm... I just tested your playlist URL. It seems to not work in this case like I suggested it works in general for playlists. Sorry for the distraction.

diman23
Blank Cone
Blank Cone
Posts: 14
Joined: 23 Aug 2013 00:26
VLC version: 2.0.0
Operating System: win7 / linux
Location: Germany

Re: switching hls streams of different bit rates

Postby diman23 » 10 Apr 2014 20:05

Hi everyone, does VLC 2.0.8 support switching in HLS? Or is it only possible with 2.1.x?

Jean-Baptiste Kempf
Site Administrator
Site Administrator
Posts: 37523
Joined: 22 Jul 2005 15:29
VLC version: 4.0.0-git
Operating System: Linux, Windows, Mac
Location: Cone, France
Contact:

Re: switching hls streams of different bit rates

Postby Jean-Baptiste Kempf » 22 Apr 2014 15:02

No. It's always automatic.
Jean-Baptiste Kempf
http://www.jbkempf.com/ - http://www.jbkempf.com/blog/category/Videolan
VLC media player developer, VideoLAN President and Sites administrator
If you want an answer to your question, just be specific and precise. Don't use Private Messages.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 9 guests