i am trying to make a media player that generates random subtitles based on nltk library. I am using the vlc python for it, for now i do not care about interface. But i have problem understanding how to put subtitles, even as a srt file. The function is SubtitleTrack() inside vlc.py. Somewhere else i saw that i must use the add_slave() function.
My code until now is:
import vlc
Instance = vlc.Instance()
player = Instance.media_player_new()
Media = Instance.media_new('Test.avi')
Sub = player.add_slave(player,'Test.srt', True)
player.set_media(Media)
player.play()
The version of libvlc is 2.2.6
SubtitleTrack()
is a class.
What you want to do is add the subtitles after you hit play. How you do this, from my understanding depends on the version.
import vlc
Instance = vlc.Instance()
player = Instance.media_player_new()
Media = Instance.media_new('Test.avi')
player.set_media(Media)
player.play()
player.video_set_subtitle_file('Test.srt')
I don't have the add_slave()
function on my local version of vlc, but I would assume it's safe to say functionality stayed the same for compatibility reasons.