I want to stream a complete playlist (m3u) using libvlc with Python.
I was able to stream a single video using the following code:
inst = vlc.Instance()
param=[
"test.mp4"
,"sout=#rtp{dst=224.1.1.10,port=10100,mux=ts}"
]
Media = inst.media_new(*param)
player = Media.player_new_from_media()
player.play()
The problem is, it seems there is no way to pass options to a playlist. I tried to pass them when creating the vlc instance but that doesn't work.
inst = vlc.Instance('--sout=#gather:rtp{dst=224.1.1.10,port=10100,mux=ts}')
Media_list = inst.media_list_new(['test.m3u'])
list_player = inst.media_list_player_new()
list_player.set_media_list(Media_list)
list_player.play()
The same code works correctly when playing locally.
Thanks,
Well, it looks like there is no way to set the streaming options at the VLC instance level.
What I did instead was to loop through all media in the medialist and set the proper options via the add_option function.
If you have to do that, careful since you have to prepend : before the option
media.add_option(":sout=#gather:rtp{dst=%s,port=%d,mux=ts}"%(multicast_address,video_port))