Page 1 of 1

switching hls streams of different bit rates

Posted: 11 Dec 2013 04:12
by lzuwei
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.

Re: switching hls streams of different bit rates

Posted: 11 Dec 2013 13:39
by sherington
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.

Re: switching hls streams of different bit rates

Posted: 12 Dec 2013 03:54
by lzuwei
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.

Re: switching hls streams of different bit rates

Posted: 12 Dec 2013 07:56
by sherington
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.

Re: switching hls streams of different bit rates

Posted: 12 Dec 2013 17:35
by lzuwei
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.

Re: switching hls streams of different bit rates

Posted: 12 Dec 2013 21:28
by sherington
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.

Re: switching hls streams of different bit rates

Posted: 10 Apr 2014 20:05
by diman23
Hi everyone, does VLC 2.0.8 support switching in HLS? Or is it only possible with 2.1.x?

Re: switching hls streams of different bit rates

Posted: 22 Apr 2014 15:02
by Jean-Baptiste Kempf
No. It's always automatic.