How to make videos output in one window when trying to play multiple videos with python-vlc?

This forum is about all development around libVLC.
mikehoncho
New Cone
New Cone
Posts: 1
Joined: 09 Jul 2021 10:10

How to make videos output in one window when trying to play multiple videos with python-vlc?

Postby mikehoncho » 09 Jul 2021 10:14

Python3.7 python-vlc1.0.12118 Windows10

I have some videos that I need to show during live streaming, and the live streaming software grabs a video stream from a windows window.

I played these videos in python using python-vlc, but playing every video, python-vlc will open a new window "VLC (Direct3D11 output)", how can I play the video continuously with only one window?

This is the code:

Code: Select all

import os import time os.environ['PYTHON_VLC_MODULE_PATH'] = r"D:\Program Files\VideoLAN\VLC" import vlc # creating a media player object media_player = vlc.MediaListPlayer() # creating Instance class object player = vlc.Instance() # creating a new media list media_list = player.media_list_new() # creating a new media media = player.media_new(r'E:\Video\sample1.mp4') # adding media to media list media_list.add_media(media) # setting media list to the media player media_player.set_media_list(media_list) # creating a new media media = player.media_new(r'E:\Video\sample2.mp4') # adding media to media list media_list.add_media(media) # setting media list to the media player media_player.set_media_list(media_list) # start playing video media_player.play_item_at_index(0) time.sleep(5) # playing next media in list while True: media_player.next() time.sleep(5)

Krilya
New Cone
New Cone
Posts: 6
Joined: 02 Aug 2022 10:30

Re: How to make videos output in one window when trying to play multiple videos with python-vlc?

Postby Krilya » 02 Aug 2022 11:11

because you haven't set a window for the player. you can use the tkinter module to create a window and then assign it to the player.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 6 guests