A complete newbie here…
I’m currently trying to create a video player using python-vlc and PyQt5 (on a Mac) and it’s going pretty well…. My code is way to messy and embarrassing and filled with awkwardly named variables, so I’d have to clean it up thoroughly before I’d dare post it here (apologies for that). However, in the meantime, I’m struggling with a specific problem with which I hope someone can help me:
I’m trying to get some textual feedback on screen whenever stuff happens (skipping ahead, changing speed, volume, etc.). It seems to me that the simplest way would be to use Vlc’s builtin ‘marquee’ function, but I really can’t get it to work. I have searched everywhere for examples or docs on how to use it and found very few pages, most of which point to the humongous vlc.py file which comes with the ‘python-vlc’ distribution (iirc). Apparently, it’s way over my head because I can’t quite figure out what’s going on there or how to extract the information I need from it.
I wonder it anyone can provide or point me to a really simple example of using marquee with python-vlc. Something like play a video -> press a button -> marquee text appears. Many thanks!!!
Let me just quickly outline what I did try:
I tried to add the marquee option while creating the vlc instance with:
self.Instance = vlc.Instance("--sub-source marq")
and:
self.Instance = vlc.Instance("--sub-filter=marq")
I also tried:
self.instance = vlc.Instance("--video-title-show --video-title-timeout 1 --sub-source marq --verbose -1") #as suggested somewhere
Also tried to add the option while creating the media player with:
self.mediaplayer = self.instance.media_player_new("sub-filter=marq") #completely breaks video playback
and:
self.mediaplayer = self.instance.media_player_new(sys.argv[1], "sub-filter=marq") # IndexError: list index out of range
I tried each one separately as well as different combinations to no avail…
When I add the line (whether in the __init__ method or any other method):
self.mediaplayer.video_set_marquee_int(vlc.VideoMarqueeOption.Enable, 1)
No errors generated and nothing happens…
When I try to add another line containing the marquee option, such as:
self.mediaplayer.video_set_marquee_string(VideoMarqueeOption.Text, "Some Text")
I get NameError: name 'VideoMarqueeOption' is not defined
So I really don’t understand what’s going on here….
Any help with this will be greatly appreciated at this point (just please don’t refer me again to that vlc.py file…)
This is the simplest example I can think of.
That is because
VideoMarqueeOptionis a function in vlc.py that converts a named option to a number.You will have a similar problem with
Position.So either use the vlc function i.e.
vlc.VideoMarqueeOptionor a fixed parameter e.g. 1At this point I dash your hopes and refer you to either the vlc documentation or vlc.py for a full list of the options and their number equivalents. :)