0

When I want to start to play an mp4 file from python using python-vlc, I will do

    import vlc
    from time import sleep
        
    movie = "/path/to/movie.mp4"
    subs = "/path/to/subs.srt"
    
    i = vlc.Instance()
    media_player = i.media_player_new()
    media = i.media_new(movie)
    media.slaves_add(vlc.MediaSlaveType.subtitle, 1, "file://{}".format(subs))
    media_player.set_media(media)
    media_player.play()
    sleep(10)

However, I now have an mkv file which includes an srt file. How would I start playing this file using python-vlc with the included srt file?

Jason Aller
  • 3,541
  • 28
  • 38
  • 38
Yo.
  • 15
  • 6

1 Answers1

0

One way to do it is to give options when you create the Instance. E.g.:

i = vlc.Instance((' --sub-file <your srt file> '))

I have gotten this to work.